diff --git a/packages/language-services/src/features/__tests__/do-diagnostics.test.ts b/packages/language-services/src/features/__tests__/do-diagnostics.test.ts index 128597b7..5966ff4c 100644 --- a/packages/language-services/src/features/__tests__/do-diagnostics.test.ts +++ b/packages/language-services/src/features/__tests__/do-diagnostics.test.ts @@ -41,6 +41,29 @@ test("reports an unknown at-rule", async () => { ]); }); +test("does not lint if configured", async () => { + const document = fileSystemProvider.createDocument(` +@tailwind base; +`); + + ls.configure({ + ...defaultConfiguration, + scss: { + ...defaultConfiguration.scss, + diagnostics: { + ...defaultConfiguration.scss.diagnostics, + lint: { + ...defaultConfiguration.scss.diagnostics.lint, + enabled: false, + }, + }, + }, + }); + const result = await ls.doDiagnostics(document); + + assert.deepStrictEqual(result, []); +}); + test("ignores unknown at-rules if configured", async () => { const document = fileSystemProvider.createDocument(` @tailwind base; diff --git a/packages/vscode-css-languageservice/src/services/cssValidation.ts b/packages/vscode-css-languageservice/src/services/cssValidation.ts index afe13ab7..dfcccd9d 100644 --- a/packages/vscode-css-languageservice/src/services/cssValidation.ts +++ b/packages/vscode-css-languageservice/src/services/cssValidation.ts @@ -30,15 +30,12 @@ export class CSSValidation { const entries: nodes.IMarker[] = []; entries.push.apply(entries, nodes.ParseErrorCollector.entries(stylesheet)); - entries.push.apply( - entries, - LintVisitor.entries( - stylesheet, - document, - new LintConfigurationSettings(settings && settings.lint !== false ? settings.lint : undefined), - this.cssDataManager, - ), - ); + if (settings && settings.lint !== false) { + entries.push.apply( + entries, + LintVisitor.entries(stylesheet, document, new LintConfigurationSettings(settings.lint), this.cssDataManager), + ); + } const ruleIds: string[] = []; for (const r in Rules) {