Skip to content

Commit 132cab6

Browse files
authored
fix: reduce excess stylelint warnings from bundle module (#3655)
* fix: reduce excess stylelint warnings from bundle module file Fixes large number of stylelint warnings appearing after yarn start. These were the result of stylelint running on the tools/bundle/dist/index.module.css file. - Add stylelint override to better lint module files that have a different class format. - Mirror stylelintignore within ignorefiles setting to bandaid issues with stylelintignore not being used for linting that happens after yarn start. - Fix a stylelint config entry for theme-alignment to remove negation and make sure it applies to both legacy files.
1 parent 8827633 commit 132cab6

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

stylelint.config.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ module.exports = {
1414
"@spectrum-tools/stylelint-theme-alignment",
1515
// "stylelint-high-performance-animation",
1616
],
17+
ignoreFiles: [
18+
// Static utility assets
19+
"tokens/custom-*/*.css",
20+
"tools/generator/**/*.css",
21+
// Compiled and generated files
22+
"**/dist/**",
23+
".storybook/storybook-static/**/*.css",
24+
"**/*-generated.css",
25+
"tools/bundle/src/*.css",
26+
"**/node_modules/**",
27+
// Test files
28+
"plugins/*/expected/*.css",
29+
"plugins/*/fixtures/*.css",
30+
],
1731
rules: {
1832
/** --------------------------------------------------------------
1933
* Disabled rules
@@ -210,7 +224,7 @@ module.exports = {
210224
},
211225
{
212226
/* Validate that the legacy themes don't introduce any new selectors or custom properties */
213-
files: ["components/*/themes/*.css", "!components/*/themes/spectrum.css"],
227+
files: ["components/*/themes/express.css", "components/*/themes/spectrum.css"],
214228
rules: {
215229
"spectrum-tools/no-unused-custom-properties": null,
216230
"selector-class-pattern": [
@@ -235,5 +249,17 @@ module.exports = {
235249
],
236250
}
237251
},
252+
{
253+
/* Module CSS file classes have an underscore before classes, and use underscores instead of a dash as separators (e.g. _spectrum_well) */
254+
files: ["*.module.css"],
255+
rules: {
256+
"selector-class-pattern": [
257+
"^_spectrum$|^(_)?(spectrum|is|u)(_|-)[A-Za-z0-9-_]+", {
258+
resolveNestedSelectors: true
259+
}
260+
],
261+
"keyframes-name-pattern": null,
262+
}
263+
},
238264
],
239265
};

0 commit comments

Comments
 (0)