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

Update linting to use Stylelint v15 and Prettier #179

Merged
merged 9 commits into from
Nov 13, 2023
Merged

Conversation

paulrobertlloyd
Copy link
Collaborator

@paulrobertlloyd paulrobertlloyd commented Jul 27, 2023

  • stylelint-config-gds has been updated to v1.0.0 to support Stylelint v15
  • Stylelint v15 deprecated its stylistic rules, and recommends using Prettier to format (S)CSS

This PR updates Stylelint dependencies, and adds Prettier to format all code, except JavaScript which is formatted using StandardJS. This is the same approach used by govuk-frontend (broadly speaking).

If we agree this is the right approach to linting going forward, I will update the other relevant X-GOVUK projects to follow the same.

@paulrobertlloyd paulrobertlloyd added the dependencies Pull requests that update a dependency file label Jul 27, 2023
@frankieroberto
Copy link
Contributor

Seems fine to me. Does prettier have an autofix mode which we can set up as a GitHub action to run on PRs? (I think this is quite a friendly way to allow contributors to not have to think about style issues)

@paulrobertlloyd
Copy link
Collaborator Author

@frankieroberto It does. How would imagine this working though; a workflow that adds a commit with fixes upon a PR being merged? Do you have an example of such a workflow?

@frankieroberto
Copy link
Contributor

@frankieroberto It does. How would imagine this working though; a workflow that adds a commit with fixes upon a PR being merged? Do you have an example of such a workflow?

@paulrobertlloyd forgot to reply to this before, sorry.

There’s an example of such a workflow on the on BAT design history. It's not a ton of code. Basically the workflow runs the linter in autofix mode, then commits and pushes any changes (on a PR), and then re-runs it without autofix mode (in order to report status).

@frankieroberto frankieroberto merged commit 00166d0 into main Nov 13, 2023
1 check passed
@frankieroberto frankieroberto deleted the update-linting branch November 13, 2023 10:43
@frankieroberto
Copy link
Contributor

@paulrobertlloyd updated this and merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants