-
Notifications
You must be signed in to change notification settings - Fork 131
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
Update stylelint config #10545
Comments
@anselmbradford Thanks for the pointers and feedback! I'll plan to review these soon, and will follow-up by end-of-day tomorrow. |
Some initial impressions before I look to make some changes here based on your feedback. Let me know what you think!
I think we may hold off on this until the point where Stylelint goes ESM-only, or at least we make the decision to do so for shared configuration. This would at least require that we get this project itself on ESM, which it's not currently. As it stands, I don't think Stylelint's switch to ESM has a meaningful impact on most downstream projects, and ESM projects can still load the configuration as CommonJS. The reason I wouldn't want to do a "hybrid" package like Stylelint is that it'll require a pre-publish build step to compile separate ESM and CJS versions, which adds a lot of unnecessary complexity.
I think that makes a lot of sense! I'll look to enable that option..
I think you're right, but this also feels like a substantial change that is quite likely to flag new, previously-unflagged code, since it's enforcing a lot more rules. I think we'll want to save this until at least the next major release, which with Stylelint major releases probably won't be too long 😅
I think I generally agree with this, though the Prettier documentation is written with the assumption that a project is using Prettier, where the original inclusion of But since we require Prettier as a peer dependency anyways, it might be better to encourage projects to lint Sass formatting using Prettier. At the very least, I think it should be possible to easily disable the plugin if someone did want to do that. |
One thing to perhaps test is when downstream projects have |
Yeah, the way we currently assign exports would prevent people from being able to reference the file directly from within the package. In other words, only I wouldn't expect it to be very common that someone copies the source |
I spent some time trying out replacing |
Also, I think migrating to the standard ruleset is probably a good idea to bring this configuration closer in line with the TTS Engineering guidelines, which also recommend this ruleset: https://guides.18f.gov/engineering/languages-runtimes/css/#setting-up-stylelint-locally |
Yeah I'd probably update to the standard config and turn off any rules you're concerned might be too much at this stage, then make a release with the turned off rules, and then on the next Stylelint major release start removing disabled rules. |
Good idea. Maybe we can configure all the rules as |
After spending a little time with trying to create a deprecation path, I realized it's going to be a substantial effort to list and override each additional rule to be downgraded to a warning. Instead, here's what I'm planning:
|
These are now both available on NPM! https://www.npmjs.com/package/@18f/identity-stylelint-config?activeTab=versions You should be able to install I'll plan to close this issue as completed, with a couple caveats:
{
"extends": "@18f/identity-stylelint-config",
"rules": {
"prettier/prettier": null
}
}
Thanks again for the continued feedback and ideas, @anselmbradford ! |
The latest stylelint has deprecated commonjs and moved to ESM https://stylelint.io/migration-guide/to-16/
It looks like the config for
@18f/identity-stylelint-config
should be updated to ESM https://github.com/18F/identity-idp/blob/main/app/javascript/packages/stylelint-config/index.js#L1Could we add the
{ resolveNestedSelectors: true }
option toselector-class-pattern
to lint nested class names inside SCSS? See https://stylelint.io/user-guide/rules/selector-class-pattern/#optional-secondary-optionsIt seems like
stylelint-config-standard-scss
should replacestylelint-config-recommended-scss
, as it extends bothstylelint-config-standard
andstylelint-config-recommended-scss
(see example docs at https://stylelint.io/user-guide/get-started/#linting-css-like-languages-and-css-within-containers)Use of
stylelint-prettier
is not recommended, according to https://prettier.io/docs/en/integrating-with-linters.html#notesThe text was updated successfully, but these errors were encountered: