Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylelint-config: Resolve nested selectors with selector-class-pattern #10563

Merged
merged 1 commit into from
May 7, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented May 7, 2024

🎫 Ticket

Partially addresses #10545 (cc @anselmbradford)

πŸ›  Summary of changes

Updates Stylelint configuration to specify optional resolveNestedSelectors property of the configured selector-class-pattern rule.

πŸ“œ Testing Plan

Verify yarn lint:css passes.

Optional: Validate that interpolated selector names consistently enforce the selector name validation:

Example:

diff --git a/app/javascript/packages/document-capture/components/_file-input.scss b/app/javascript/packages/document-capture/components/_file-input.scss
index 8967e4e1f9..8dcafd7c8e 100644
--- a/app/javascript/packages/document-capture/components/_file-input.scss
+++ b/app/javascript/packages/document-capture/components/_file-input.scss
@@ -10,2 +10,10 @@
   outline-offset: 2px;
+
+  &--foo {
+    color: red;
+  }
+
+  &__foo {
+    color: red;
+  }
 }
$ yarn lint:css
yarn run v1.22.22
$ stylelint 'app/assets/stylesheets/**/*.scss' 'app/javascript/**/*.scss' 'app/components/*.scss'

app/javascript/packages/document-capture/components/_file-input.scss
 16:3  βœ–  Class selectors should be named using "Two Dashes Style" BEM format. See:                                 selector-class-pattern
          https://en.bem.info/methodology/naming-convention/#two-dashes-style

changelog: Internal, Build Tooling, Resolve nested selectors with Stylelint selector-class-pattern configuration
@aduth aduth merged commit a349b66 into main May 7, 2024
2 checks passed
@aduth aduth deleted the aduth-stylelint-resolve-nested-selectors branch May 7, 2024 15:40
@aduth
Copy link
Member Author

aduth commented May 7, 2024

Published to NPM as @18f/identity-stylelint-config@4.1.0

https://www.npmjs.com/package/@18f/identity-stylelint-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants