diff --git a/client/src/extension.ts b/client/src/extension.ts index b11d4a64..eeaef516 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -186,6 +186,7 @@ enum RuleSeverity { info = 'info', warn = 'warn', error = 'error', + off = 'off', // Added severity override changes default = 'default', diff --git a/package.json b/package.json index bf6519cd..c5e7731c 100644 --- a/package.json +++ b/package.json @@ -392,7 +392,8 @@ "info", "default", "upgrade", - "warn" + "warn", + "off" ], "type": "string" }, diff --git a/playgrounds/6.0/.eslintrc.json b/playgrounds/6.0/.eslintrc.json index e5993173..f1cd36d2 100644 --- a/playgrounds/6.0/.eslintrc.json +++ b/playgrounds/6.0/.eslintrc.json @@ -13,6 +13,7 @@ "sourceType": "module" }, "rules": { + "no-use-before-define": "error", "no-useless-escape": "error", "no-const-assign": "warn", "no-this-before-super": "warn", diff --git a/playgrounds/6.0/.vscode/settings.json b/playgrounds/6.0/.vscode/settings.json index c1e304a5..ffcaef8b 100644 --- a/playgrounds/6.0/.vscode/settings.json +++ b/playgrounds/6.0/.vscode/settings.json @@ -44,7 +44,8 @@ { "rule": "!no-*", "severity": "upgrade" }, { "rule": "*console*", "severity": "upgrade" }, { "rule": "*semi*", "severity": "default" }, - { "rule": "radix", "severity": "default" } + { "rule": "radix", "severity": "default" }, + { "rule": "no-use-before-define", "severity": "off" } ], "editor.codeActionsOnSaveTimeout": 2000, "eslint.format.enable": true, diff --git a/server/src/eslintServer.ts b/server/src/eslintServer.ts index 54115f2a..6a860343 100644 --- a/server/src/eslintServer.ts +++ b/server/src/eslintServer.ts @@ -515,6 +515,7 @@ function recordCodeAction(document: TextDocument, diagnostic: Diagnostic, proble function adjustSeverityForOverride(severity: number | RuleSeverity, severityOverride?: RuleSeverity) { switch (severityOverride) { + case RuleSeverity.off: case RuleSeverity.info: case RuleSeverity.warn: case RuleSeverity.error: @@ -1404,6 +1405,11 @@ function validate(document: TextDocument, settings: TextDocumentSettings & { lib if (docReport.messages && Array.isArray(docReport.messages)) { docReport.messages.forEach((problem) => { if (problem) { + const isOff = getSeverityOverride(problem.ruleId, settings.rulesCustomizations) === RuleSeverity.off; + if (isOff) { + // Filter out rules with severity override to off + return; + } const isWarning = convertSeverityToDiagnostic(problem.severity) === DiagnosticSeverity.Warning; if (settings.quiet && isWarning) { // Filter out warnings when quiet mode is enabled