Skip to content

Commit

Permalink
fix: respect somesass.*.diagnostics.lint.enabled
Browse files Browse the repository at this point in the history
Make it possible to turn off all lint rules.
  • Loading branch information
wkillerud committed Dec 8, 2024
1 parent 93a9439 commit 9bb800b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9bb800b

Please sign in to comment.