-
Notifications
You must be signed in to change notification settings - Fork 4
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 to Stylelint 15 #32
Conversation
9a63b0b
to
ef42e02
Compare
Hi @kevindew I've rebased this PR as I'll see if I can fit in some testing on |
Great stuff @colinrotherham - do you happen to know if any views are forming about the use of "Prettier". I'm somewhat expecting that the release path for this will be us saying "these type of rules won't be checked any more, if you care about them use prettier, if you don't accept that part of your SCSS won't be linted anymore" |
Yeah we're happy to apply formatting using Prettier for other languages But I've now opened a PR to review all the changes to confirm we're all happy: |
ef42e02
to
42505df
Compare
42505df
to
a3f45ba
Compare
Pushed again with |
Pretty happy to use Prettier for formatting on my side, whichever the language. I find the gain of consistency and not having to make decisions about the formatting outweighs any surprising format that may have been chosen by the tool (but which is usually thought through anyway). I quite welcome Stylelint going for separating itself from the formating and pushing towards Prettier. |
a3f45ba
to
beca6ce
Compare
Rebased to pick up #36 |
beca6ce
to
c9aea1b
Compare
Rebased with latest package updates |
c9aea1b
to
69f3f74
Compare
Added the Dependabot security bump from: Going to bring this out of draft too as it can be considered ready for review |
69f3f74
to
e54bc58
Compare
e54bc58
to
0bab4e7
Compare
If it's of interest, for people that may not want to move to Prettier, the stylistic rules that were removed from Stylelint 15 have been extracted by someone in their own stylelint-stylistic plugin, which gives another route for tackling formatting 😊 |
@romaricpascal Oh that's great. Hmm I wonder if that can offer us a backwards compatible option. It'd be cool if we could say to people "As stylelint recommends using prettier we recommend that, however if you don't want to and don't want to lose any rules add the stylelint-stylistic plugin" What I'm not clear on, with that option, is if we could have configuration for rules that target stylelint-stylistic and not have errors if the plugin is not enabled. |
Would be great to write a CHANGELOG entry that says you're now free to use your own formatter i.e. Either switch to stylelint-stylistic (easy) or adopt Prettier (hard) Worth a check to see if anything in stylelint-stylistic conflicts with |
Yeah I'm expecting there's a couple of things that differ. I'm assuming (but haven't checked) that stylelint-stylistic follows stylelint-config-recommended - so I'd expect all the rules we're deleting in this PR are examples of deviations. |
I had a quick look this morning and
The formatting set by
Unfortunately, Stylelint treats unknown rules as errors, so we do need to clean up the rules that were deprecated 😢 Nothing to stop the update, just inform what we can recommend. Maybe something in the line of:
|
9b65c44
to
9c7456c
Compare
Looking neat to me and the changelog reads well as well 🙌🏻 @kevindew I'll leave you the final word on the extra changes (that rule for the property values look really useful) 😊 |
I've pushed up the star Stylelint 15 feature: // Disallow unknown property and value pairs
// https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/
'declaration-property-value-no-unknown': true, But it flags invalid CSS for Sass mixins and functions: padding: govuk-spacing(2) 0; Will do some more digging |
That's an unfortunate side effect. Could do a two step update, maybe?
|
@romaricpascal Let's remove it as it's not enabled by default yet in Stylelint Yeah, it's quite nice to allow files: ['**/*.scss'],
rules: {
// Disallow unknown property and value pairs (except govuk mixins and functions)
// https://stylelint.io/user-guide/rules/declaration-property-value-no-unknown/
'declaration-property-value-no-unknown': [
true, {
ignoreProperties: {
'/.+/': '/govuk\\-/'
}
}
]
} Would have to do something like: 1.0.0 — Breaking release to remove stylistic rules With more investigation into the |
9c7456c
to
9baa94b
Compare
Two steps sound good to me! I think we should nudge people to experiment with that new rule (as it's super handy) to see how it breaks for them on their project and inform a possible shared configuration, hopefully one that'll work neatly with scss files as well 😊 |
9baa94b
to
b022e42
Compare
Ready for review again 😊 All working brilliantly on GOV.UK Frontend It's nice to see Sass formatting applied on save or commit (via Prettier) |
Blocked waiting for alphagov/stylelint-config-gds#32
b022e42
to
fb663dc
Compare
Rebased to bring in #43 and updated to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for taking this further forward, it looks nearly ready to go. I've made some suggestions on the changelog - I feel like we need to emphasise further the impact of the loss of rules.
This updates the core stylelint dependency to stylelint 15.x and updates the stylelint config versions to stylelint 15 compatible versions (I picked the latest versions).
fb663dc
to
a11aff1
Compare
We're good to go on this. Thanks @kevindew for steering us through the process 😊 |
This PR pulls in a few contributions from #30, #36 and #44 to update this project to use Stylelint 15.
The upgrade to Stylelint 15 includes:
But includes one major change worth shouting about:
Breaking change: Removal of stylistic rules
For more information, our rules configuration was updated in a separate PR:
Read about other breaking changes in the Stylelint Migrating to v15.0.0 guide.