Skip to content

Commit

Permalink
Add "no global scoped selector" rule for CSS Modules (#414)
Browse files Browse the repository at this point in the history
* `npm i stylelint-css-modules-no-global-scoped-selector --force`

* Enable rule

* Add explicit `override` to `package.json`

* Add disable to fixture CSS

* Create clean-ads-work.md
  • Loading branch information
iansan5653 committed May 8, 2024
1 parent 1e1da55 commit 308d8e7
Show file tree
Hide file tree
Showing 5 changed files with 713 additions and 42 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-ads-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/stylelint-config": minor
---

Enable `css-modules/no-global-scoped-selector` rule for CSS Modules
1 change: 1 addition & 0 deletions __tests__/__fixtures__/good/example.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
overflow: hidden;
}

/* stylelint-disable-next-line css-modules/no-global-scoped-selector */
:root {
--offset: -500px;
}
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default {
},
{
files: ['**/*.module.css'],
plugins: ['stylelint-css-modules-no-global-scoped-selector'],
rules: {
'property-no-unknown': [
true,
Expand All @@ -202,6 +203,7 @@ export default {
ignoreFunctions: ['global'],
},
],
'css-modules/no-global-scoped-selector': true,
// temporarily disabiling Primer plugins while we work on upgrades https://github.com/github/primer/issues/3165
'primer/spacing': null,
'primer/borders': null,
Expand Down

0 comments on commit 308d8e7

Please sign in to comment.