From 0a47a442678887d0ec5c3e0f44970a77247a96c7 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Wed, 12 May 2021 23:31:05 +0200 Subject: [PATCH] Update eslint server (support rulesCustomizations setting) --- LSP-eslint.sublime-settings | 3 + language-server/compile-language-server.sh | 5 +- language-server/out/diff.js | 2 +- language-server/out/eslintServer.js | 115 +++++- language-server/out/linkedMap.js | 403 +++++++++++++++++++++ language-server/package-lock.json | 133 +++++-- language-server/package.json | 12 +- language-server/update-info.log | 4 +- sublime-package.json | 38 +- 9 files changed, 660 insertions(+), 55 deletions(-) create mode 100644 language-server/out/linkedMap.js diff --git a/LSP-eslint.sublime-settings b/LSP-eslint.sublime-settings index 697dad0..535f937 100644 --- a/LSP-eslint.sublime-settings +++ b/LSP-eslint.sublime-settings @@ -64,6 +64,9 @@ "vue", "markdown", ], + // Override the severity of one or more rules, regardless of the project's ESLint config. Use globs to + // apply default severities for multiple rules. + "rulesCustomizations": [], // Turns on quiet mode, which ignores warnings. "quiet": false, // Run the linter on save or on type. diff --git a/language-server/compile-language-server.sh b/language-server/compile-language-server.sh index f830076..abea73f 100755 --- a/language-server/compile-language-server.sh +++ b/language-server/compile-language-server.sh @@ -28,11 +28,10 @@ popd || exit pushd "${TEMP_DIR}" || exit echo 'Enter commit SHA, branch or tag (for example 2.1.0) to build' -read -rp 'SHA, branch or tag (default: master): ' ref +read -rp 'SHA, branch or tag (default: main): ' ref -# use the "master" branch by default if [ "${ref}" = "" ]; then - ref="master" + ref="main" fi temp_zip="src-${ref}.zip" diff --git a/language-server/out/diff.js b/language-server/out/diff.js index 30c00b2..b670b03 100644 --- a/language-server/out/diff.js +++ b/language-server/out/diff.js @@ -541,7 +541,7 @@ class LcsDiff { } else { // We didn't actually remember enough of the history. - //Since we are quiting the diff early, we need to shift back the originalStart and modified start + //Since we are quitting the diff early, we need to shift back the originalStart and modified start //back into the boundary limits since we decremented their value above beyond the boundary limit. originalStart++; modifiedStart++; diff --git a/language-server/out/eslintServer.js b/language-server/out/eslintServer.js index 93cca54..d8f1b84 100644 --- a/language-server/out/eslintServer.js +++ b/language-server/out/eslintServer.js @@ -12,6 +12,7 @@ const fs = require("fs"); const child_process_1 = require("child_process"); const os_1 = require("os"); const diff_1 = require("./diff"); +const linkedMap_1 = require("./linkedMap"); var Is; (function (Is) { const toString = Object.prototype.toString; @@ -141,6 +142,18 @@ var CodeActionsOnSaveMode; CodeActionsOnSaveMode["all"] = "all"; CodeActionsOnSaveMode["problems"] = "problems"; })(CodeActionsOnSaveMode || (CodeActionsOnSaveMode = {})); +var RuleSeverity; +(function (RuleSeverity) { + // Original ESLint values + RuleSeverity["info"] = "info"; + RuleSeverity["warn"] = "warn"; + RuleSeverity["error"] = "error"; + // Added severity override changes + RuleSeverity["off"] = "off"; + RuleSeverity["default"] = "default"; + RuleSeverity["downgrade"] = "downgrade"; + RuleSeverity["upgrade"] = "upgrade"; +})(RuleSeverity || (RuleSeverity = {})); var TextDocumentSettings; (function (TextDocumentSettings) { function hasLibrary(settings) { @@ -172,7 +185,27 @@ function loadNodeModule(moduleName) { } return undefined; } -function makeDiagnostic(problem) { +const ruleSeverityCache = new linkedMap_1.LRUCache(1024); +let ruleCustomizationsKey; +function asteriskMatches(matcher, ruleId) { + return matcher.startsWith('!') + ? !(new RegExp(`^${matcher.slice(1).replace(/\*/g, '.*')}$`, 'g').test(ruleId)) + : new RegExp(`^${matcher.replace(/\*/g, '.*')}$`, 'g').test(ruleId); +} +function getSeverityOverride(ruleId, customizations) { + if (ruleSeverityCache.has(ruleId)) { + return ruleSeverityCache.get(ruleId); + } + let result; + for (const customization of customizations) { + if (asteriskMatches(customization.rule, ruleId)) { + result = customization.severity; + } + } + ruleSeverityCache.set(ruleId, result); + return result; +} +function makeDiagnostic(settings, problem) { const message = problem.message; const startLine = Is.nullOrUndefined(problem.line) ? 0 : Math.max(0, problem.line - 1); const startChar = Is.nullOrUndefined(problem.column) ? 0 : Math.max(0, problem.column - 1); @@ -180,7 +213,7 @@ function makeDiagnostic(problem) { const endChar = Is.nullOrUndefined(problem.endColumn) ? startChar : Math.max(0, problem.endColumn - 1); const result = { message: message, - severity: convertSeverity(problem.severity), + severity: convertSeverityToDiagnosticWithOverride(problem.severity, getSeverityOverride(problem.ruleId, settings.rulesCustomizations)), source: 'eslint', range: { start: { line: startLine, character: startChar }, @@ -251,17 +284,51 @@ function recordCodeAction(document, diagnostic, problem) { suggestions: problem.suggestions }); } -function convertSeverity(severity) { +function adjustSeverityForOverride(severity, severityOverride) { + switch (severityOverride) { + case RuleSeverity.info: + case RuleSeverity.warn: + case RuleSeverity.error: + return severityOverride; + case RuleSeverity.downgrade: + switch (convertSeverityToDiagnostic(severity)) { + case node_1.DiagnosticSeverity.Error: + return RuleSeverity.warn; + case node_1.DiagnosticSeverity.Warning: + case node_1.DiagnosticSeverity.Information: + return RuleSeverity.info; + } + case RuleSeverity.upgrade: + switch (convertSeverityToDiagnostic(severity)) { + case node_1.DiagnosticSeverity.Information: + return RuleSeverity.warn; + case node_1.DiagnosticSeverity.Warning: + case node_1.DiagnosticSeverity.Error: + return RuleSeverity.error; + } + default: + return severity; + } +} +function convertSeverityToDiagnostic(severity) { + // RuleSeverity concerns an overridden rule. A number is direct from ESLint. switch (severity) { // Eslint 1 is warning case 1: + case RuleSeverity.warn: return node_1.DiagnosticSeverity.Warning; case 2: + case RuleSeverity.error: return node_1.DiagnosticSeverity.Error; + case RuleSeverity.info: + return node_1.DiagnosticSeverity.Information; default: return node_1.DiagnosticSeverity.Error; } } +function convertSeverityToDiagnosticWithOverride(severity, severityOverride) { + return convertSeverityToDiagnostic(adjustSeverityForOverride(severity, severityOverride)); +} /** * Check if the path follows this pattern: `\\hostname\sharename`. * @@ -304,16 +371,21 @@ function isUNC(path) { return true; } function getFileSystemPath(uri) { - const result = uri.fsPath; + let result = uri.fsPath; if (process.platform === 'win32' && result.length >= 2 && result[1] === ':') { // Node by default uses an upper case drive letter and ESLint uses // === to compare paths which results in the equal check failing // if the drive letter is lower case in th URI. Ensure upper case. - return result[0].toUpperCase() + result.substr(1); + result = result[0].toUpperCase() + result.substr(1); } - else { - return result; + if (process.platform === 'win32' || process.platform === 'darwin') { + const realpath = fs.realpathSync.native(result); + // Only use the real path if only the casing has changed. + if (realpath.toLowerCase() === result.toLowerCase()) { + result = realpath; + } } + return result; } function getFilePath(documentOrUri) { if (!documentOrUri) { @@ -368,7 +440,7 @@ process.on('uncaughtException', (error) => { }); const connection = node_1.createConnection(); connection.console.info(`ESLint server running in node ${process.version}`); -// Is instantiated in the initalize handle; +// Is instantiated in the initialize handle; let documents; const _globalPaths = { yarn: { @@ -1004,6 +1076,11 @@ function validate(document, settings, publishDiagnostics = true) { fixTypes = undefined; } } + const newRuleCustomizationsKey = JSON.stringify(settings.rulesCustomizations); + if (ruleCustomizationsKey !== newRuleCustomizationsKey) { + ruleCustomizationsKey = newRuleCustomizationsKey; + ruleSeverityCache.clear(); + } const content = document.getText(); const uri = document.uri; const file = getFilePath(document); @@ -1024,12 +1101,12 @@ function validate(document, settings, publishDiagnostics = true) { if (docReport.messages && Array.isArray(docReport.messages)) { docReport.messages.forEach((problem) => { if (problem) { - const isWarning = convertSeverity(problem.severity) === node_1.DiagnosticSeverity.Warning; + const isWarning = convertSeverityToDiagnostic(problem.severity) === node_1.DiagnosticSeverity.Warning; if (settings.quiet && isWarning) { // Filter out warnings when quiet mode is enabled return; } - const diagnostic = makeDiagnostic(problem); + const diagnostic = makeDiagnostic(settings, problem); diagnostics.push(diagnostic); if (fixTypes !== undefined && CLIEngine.hasRule(cli) && problem.ruleId !== undefined && problem.fix !== undefined) { const rule = cli.getRules().get(problem.ruleId); @@ -1239,13 +1316,15 @@ class Fixes { if (d !== 0) { return d; } - if (a.edit.range[1] === 0) { + const al = a.edit.range[1] - a.edit.range[0]; + if (al === 0) { return -1; } - if (b.edit.range[1] === 0) { + const bl = b.edit.range[1] - b.edit.range[0]; + if (bl === 0) { return 1; } - return a.edit.range[1] - b.edit.range[1]; + return al - bl; }); } getApplicable() { @@ -1375,7 +1454,8 @@ messageQueue.registerRequest(node_1.CodeActionRequest.type, (params) => { return node_1.TextEdit.insert(node_1.Position.create(editInfo.line - 1, 0), `${indentationText}// eslint-disable-next-line ${editInfo.ruleId}${os_1.EOL}`); } function createDisableSameLineTextEdit(editInfo) { - return node_1.TextEdit.insert(node_1.Position.create(editInfo.line - 1, Number.MAX_VALUE), ` // eslint-disable-line ${editInfo.ruleId}`); + // Todo@dbaeumer Use uinteger.MAX_VALUE instead. + return node_1.TextEdit.insert(node_1.Position.create(editInfo.line - 1, 2147483647), ` // eslint-disable-line ${editInfo.ruleId}`); } function createDisableFileTextEdit(editInfo) { // If firts line contains a shebang, insert on the next line instead. @@ -1391,6 +1471,10 @@ messageQueue.registerRequest(node_1.CodeActionRequest.type, (params) => { return array[length - 1]; } return resolveSettings(textDocument).then(async (settings) => { + // The file is not validated at all or we couldn't load an eslint library for it. + if (settings.validate !== Validate.on || !TextDocumentSettings.hasLibrary(settings)) { + return result.all(); + } const problems = codeActions.get(uri); // We validate on type and have no problems ==> nothing to fix. if (problems === undefined && settings.run === 'onType') { @@ -1449,7 +1533,8 @@ messageQueue.registerRequest(node_1.CodeActionRequest.type, (params) => { workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createDisableSameLineTextEdit(editInfo)); } else { - const lineText = textDocument.getText(node_1.Range.create(node_1.Position.create(editInfo.line - 1, 0), node_1.Position.create(editInfo.line - 1, Number.MAX_VALUE))); + // Todo@dbaeumer Use uinteger.MAX_VALUE instead. + const lineText = textDocument.getText(node_1.Range.create(node_1.Position.create(editInfo.line - 1, 0), node_1.Position.create(editInfo.line - 1, 2147483647))); const matches = /^([ \t]*)/.exec(lineText); const indentationText = matches !== null && matches.length > 0 ? matches[1] : ''; workspaceChange.getTextEditChange({ uri, version: documentVersion }).add(createDisableLineTextEdit(editInfo, indentationText)); diff --git a/language-server/out/linkedMap.js b/language-server/out/linkedMap.js new file mode 100644 index 0000000..d5f1e87 --- /dev/null +++ b/language-server/out/linkedMap.js @@ -0,0 +1,403 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; +var Touch; +(function (Touch) { + Touch.None = 0; + Touch.First = 1; + Touch.AsOld = Touch.First; + Touch.Last = 2; + Touch.AsNew = Touch.Last; +})(Touch = exports.Touch || (exports.Touch = {})); +class LinkedMap { + constructor() { + this[Symbol.toStringTag] = 'LinkedMap'; + this._map = new Map(); + this._head = undefined; + this._tail = undefined; + this._size = 0; + this._state = 0; + } + clear() { + this._map.clear(); + this._head = undefined; + this._tail = undefined; + this._size = 0; + this._state++; + } + isEmpty() { + return !this._head && !this._tail; + } + get size() { + return this._size; + } + get first() { + var _a; + return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value; + } + get last() { + var _a; + return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value; + } + has(key) { + return this._map.has(key); + } + get(key, touch = Touch.None) { + const item = this._map.get(key); + if (!item) { + return undefined; + } + if (touch !== Touch.None) { + this.touch(item, touch); + } + return item.value; + } + set(key, value, touch = Touch.None) { + let item = this._map.get(key); + if (item) { + item.value = value; + if (touch !== Touch.None) { + this.touch(item, touch); + } + } + else { + item = { key, value, next: undefined, previous: undefined }; + switch (touch) { + case Touch.None: + this.addItemLast(item); + break; + case Touch.First: + this.addItemFirst(item); + break; + case Touch.Last: + this.addItemLast(item); + break; + default: + this.addItemLast(item); + break; + } + this._map.set(key, item); + this._size++; + } + return this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return undefined; + } + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return undefined; + } + if (!this._head || !this._tail) { + throw new Error('Invalid list'); + } + const item = this._head; + this._map.delete(item.key); + this.removeItem(item); + this._size--; + return item.value; + } + forEach(callbackfn, thisArg) { + const state = this._state; + let current = this._head; + while (current) { + if (thisArg) { + callbackfn.bind(thisArg)(current.value, current.key, this); + } + else { + callbackfn(current.value, current.key, this); + } + if (this._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + current = current.next; + } + } + keys() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.key, done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + values() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.value, done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + entries() { + const map = this; + const state = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]() { + return iterator; + }, + next() { + if (map._state !== state) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: [current.key, current.value], done: false }; + current = current.next; + return result; + } + else { + return { value: undefined, done: true }; + } + } + }; + return iterator; + } + [Symbol.iterator]() { + return this.entries(); + } + trimOld(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; + } + this._head = current; + this._size = currentSize; + if (current) { + current.previous = undefined; + } + this._state++; + } + addItemFirst(item) { + // First time Insert + if (!this._head && !this._tail) { + this._tail = item; + } + else if (!this._head) { + throw new Error('Invalid list'); + } + else { + item.next = this._head; + this._head.previous = item; + } + this._head = item; + this._state++; + } + addItemLast(item) { + // First time Insert + if (!this._head && !this._tail) { + this._head = item; + } + else if (!this._tail) { + throw new Error('Invalid list'); + } + else { + item.previous = this._tail; + this._tail.next = item; + } + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = undefined; + this._tail = undefined; + } + else if (item === this._head) { + // This can only happend if size === 1 which is handle + // by the case above. + if (!item.next) { + throw new Error('Invalid list'); + } + item.next.previous = undefined; + this._head = item.next; + } + else if (item === this._tail) { + // This can only happend if size === 1 which is handle + // by the case above. + if (!item.previous) { + throw new Error('Invalid list'); + } + item.previous.next = undefined; + this._tail = item.previous; + } + else { + const next = item.next; + const previous = item.previous; + if (!next || !previous) { + throw new Error('Invalid list'); + } + next.previous = previous; + previous.next = next; + } + item.next = undefined; + item.previous = undefined; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error('Invalid list'); + } + if ((touch !== Touch.First && touch !== Touch.Last)) { + return; + } + if (touch === Touch.First) { + if (item === this._head) { + return; + } + const next = item.next; + const previous = item.previous; + // Unlink the item + if (item === this._tail) { + // previous must be defined since item was not head but is tail + // So there are more than on item in the map + previous.next = undefined; + this._tail = previous; + } + else { + // Both next and previous are not undefined since item was neither head nor tail. + next.previous = previous; + previous.next = next; + } + // Insert the node at head + item.previous = undefined; + item.next = this._head; + this._head.previous = item; + this._head = item; + this._state++; + } + else if (touch === Touch.Last) { + if (item === this._tail) { + return; + } + const next = item.next; + const previous = item.previous; + // Unlink the item. + if (item === this._head) { + // next must be defined since item was not tail but is head + // So there are more than on item in the map + next.previous = undefined; + this._head = next; + } + else { + // Both next and previous are not undefined since item was neither head nor tail. + next.previous = previous; + previous.next = next; + } + item.next = undefined; + item.previous = this._tail; + this._tail.next = item; + this._tail = item; + this._state++; + } + } + toJSON() { + const data = []; + this.forEach((value, key) => { + data.push([key, value]); + }); + return data; + } + fromJSON(data) { + this.clear(); + for (const [key, value] of data) { + this.set(key, value); + } + } +} +exports.LinkedMap = LinkedMap; +class LRUCache extends LinkedMap { + constructor(limit, ratio = 1) { + super(); + this._limit = limit; + this._ratio = Math.min(Math.max(0, ratio), 1); + } + get limit() { + return this._limit; + } + set limit(limit) { + this._limit = limit; + this.checkTrim(); + } + get ratio() { + return this._ratio; + } + set ratio(ratio) { + this._ratio = Math.min(Math.max(0, ratio), 1); + this.checkTrim(); + } + get(key, touch = Touch.AsNew) { + return super.get(key, touch); + } + peek(key) { + return super.get(key, Touch.None); + } + set(key, value) { + super.set(key, value, Touch.Last); + this.checkTrim(); + return this; + } + checkTrim() { + if (this.size > this._limit) { + this.trimOld(Math.round(this._limit * this._ratio)); + } + } +} +exports.LRUCache = LRUCache; +//# sourceMappingURL=linkedMap.js.map \ No newline at end of file diff --git a/language-server/package-lock.json b/language-server/package-lock.json index f256492..3ce210d 100644 --- a/language-server/package-lock.json +++ b/language-server/package-lock.json @@ -1,41 +1,122 @@ { "name": "eslint-server", - "version": "2.1.14", - "lockfileVersion": 1, + "version": "2.1.20", + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "eslint-server", + "version": "2.1.20", + "license": "MIT", + "dependencies": { + "vscode-languageserver": "7.0.0", + "vscode-languageserver-textdocument": "1.0.1", + "vscode-uri": "^2.1.2" + }, + "devDependencies": { + "@types/node": "^15.0.3", + "typescript": "^4.2.4" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@types/node": { + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.3.tgz", + "integrity": "sha512-/WbxFeBU+0F79z9RdEOXH4CsDga+ibi5M8uEYr91u3CkT/pdWcV8MCook+4wDPnZBexRdwWS+PiVZ2xJviAzcQ==", + "dev": true + }, + "node_modules/typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/vscode-jsonrpc": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", + "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", + "engines": { + "node": ">=8.0.0 || >=10.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", + "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", + "dependencies": { + "vscode-languageserver-protocol": "3.16.0" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", + "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", + "dependencies": { + "vscode-jsonrpc": "6.0.0", + "vscode-languageserver-types": "3.16.0" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", + "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" + }, + "node_modules/vscode-uri": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==" + } + }, "dependencies": { "@types/node": { - "version": "14.14.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz", - "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw==", + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.3.tgz", + "integrity": "sha512-/WbxFeBU+0F79z9RdEOXH4CsDga+ibi5M8uEYr91u3CkT/pdWcV8MCook+4wDPnZBexRdwWS+PiVZ2xJviAzcQ==", "dev": true }, "typescript": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", - "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", "dev": true }, "vscode-jsonrpc": { - "version": "6.0.0-next.7", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0-next.7.tgz", - "integrity": "sha512-1nG+6cuTtpzmXe7yYfO9GCkYlyV6Ai+jDnwidHiT2T7zhc+bJM+VTtc0T/CdTlDyTNTqIcCj0V1nD4TcVjJ7Ug==" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", + "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==" }, "vscode-languageserver": { - "version": "7.0.0-next.10", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0-next.10.tgz", - "integrity": "sha512-49Ud6FtO//AeACkZc208s7hx8trkJgJ+JsfBsUxbcLp4ScZk+mFbl3zNFv8/mllxRZF2le+vCgOmhLzTyemJHw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", + "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", "requires": { - "vscode-languageserver-protocol": "3.16.0-next.10" + "vscode-languageserver-protocol": "3.16.0" } }, "vscode-languageserver-protocol": { - "version": "3.16.0-next.10", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.10.tgz", - "integrity": "sha512-YRTctHUZvts0Z1xXKNYU0ha0o+Tlgtwr+6O8OmDquM086N8exiSKBMwMC+Ra1QtIE+1mfW43Wxsme2FnMkAS9A==", + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", + "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", "requires": { - "vscode-jsonrpc": "6.0.0-next.7", - "vscode-languageserver-types": "3.16.0-next.4" + "vscode-jsonrpc": "6.0.0", + "vscode-languageserver-types": "3.16.0" } }, "vscode-languageserver-textdocument": { @@ -44,14 +125,14 @@ "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==" }, "vscode-languageserver-types": { - "version": "3.16.0-next.4", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.4.tgz", - "integrity": "sha512-NlKJyGcET/ZBCCLBYIPaGo2c37R03bPYeWXozUtnjyye7+9dhlbMSODyoG2INcQf8zFmB4qhm2UOJjgYEgPCNA==" + "version": "3.16.0", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", + "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" }, "vscode-uri": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.1.tgz", - "integrity": "sha512-eY9jmGoEnVf8VE8xr5znSah7Qt1P/xsCdErz+g8HYZtJ7bZqKH5E3d+6oVNm1AC/c6IHUDokbmVXKOi4qPAC9A==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==" } } } diff --git a/language-server/package.json b/language-server/package.json index 923bef3..2c77c02 100644 --- a/language-server/package.json +++ b/language-server/package.json @@ -1,6 +1,6 @@ { "name": "eslint-server", - "version": "2.1.14", + "version": "2.1.20", "private": true, "author": "Microsoft Corporation", "license": "MIT", @@ -15,13 +15,13 @@ "node": "*" }, "dependencies": { - "vscode-uri": "^2.1.1", - "vscode-languageserver": "7.0.0-next.10", - "vscode-languageserver-textdocument": "1.0.1" + "vscode-languageserver": "7.0.0", + "vscode-languageserver-textdocument": "1.0.1", + "vscode-uri": "^2.1.2" }, "scripts": {}, "devDependencies": { - "@types/node": "^14.14.6", - "typescript": "^4.0.5" + "@types/node": "^15.0.3", + "typescript": "^4.2.4" } } diff --git a/language-server/update-info.log b/language-server/update-info.log index d8f36d9..7f627db 100644 --- a/language-server/update-info.log +++ b/language-server/update-info.log @@ -1,2 +1,2 @@ -Archive: src-master.zip -8c4e0924063224245ddb4d7e059a5ab573fec17f +Archive: src-main.zip +2e0e525e6ab1cb40154ba2313ef857b58a65b1bd diff --git a/sublime-package.json b/sublime-package.json index fe2466a..cd8afed 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -249,7 +249,8 @@ "default": "separateLine", "description": "Configure the disable rule code action to insert the comment on the same line or a new line." } - } + }, + "additionalProperties": false }, "codeAction.showDocumentation": { "type": "object", @@ -262,8 +263,41 @@ "default": true, "description": "Show the documentation code actions." } - } + }, + "additionalProperties": false }, + "rulesCustomizations": { + "markdownDescription": "Override the severity of one or more rules, regardless of the project's ESLint config. Use globs to apply default severities for multiple rules. Contains two properties:\n\n - `\"rule\"`: Select on rules with names that match, factoring in asterisks as wildcards: `{ \"rule\": \"no-*\", \"severity\": \"warn\" }`. Prefix the name with a `\"!\"` to target all rules that _don't_ match the name: `{ \"rule\": \"!no-*\", \"severity\": \"info\" }`\n - `\"severity\"`: Sets a new severity for matched rule(s), `\"downgrade\"`s them to a lower severity, `\"upgrade\"`s them to a higher severity, or `\"default\"`s them to their original severity\n\nIn this example, all rules are overridden to warnings:\n```json\n\"eslint.rules.customizations\": [\n { \"rule\": \"*\", \"severity\": \"warn\" }\n]\n```\n\nIn this example, `no-` rules are informative, other rules are downgraded, and `\"radix\"` is reset to default:\n```json\n\"eslint.rules.customizations\": [\n { \"rule\": \"no-*\", \"severity\": \"info\" },\n { \"rule\": \"!no-*\", \"severity\": \"downgrade\" },\n { \"rule\": \"radix\", \"severity\": \"default\" }\n]\n```", + "items": { + "properties": { + "severity": { + "enum": [ + "downgrade", + "error", + "info", + "default", + "upgrade", + "warn" + ], + "type": "string" + }, + "rule": { + "type": "string" + }, + }, + "required": ["severity", "rule"], + "defaultSnippets": [ + { + "body": { + "rule": "$1", + "severity": "$0" + } + } + ], + "type": "object" + }, + "type": "array" + } } } },