-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Fix prettier, eslint and stylelint config and also enable automatic execution #530
base: main
Are you sure you want to change the base?
Fix prettier, eslint and stylelint config and also enable automatic execution #530
Conversation
Upgrade prettier to latest supported Downgrade eslint-config-prettier to version that supports eslint v6 Add npm format scripts for prettier Exclude coverage and dist from prettier execution Update lint-staged to run prettier
We're using the main husky package, not Yorkie
As recommended by eslint-config-prettier-check
✅ Deploy Preview for creativecommons-chooser ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Run full lint format and build
I'm not aware of a general solution for a containerised application with git hooks but from a quick look:
|
Fixes
Description
Runs prettier automatically for consistency. Also fixes eslint and stylelint config.
NB: these changes might be problematic with the new docker setup of this project (#517). If git commits are made on the host machine and git hooks don't execute within the container, then node, npm and packages may not have been installed so the hooks will fail.
Technical details
Add and configure husky to run lint-staged (latest v8.x, since v9 drops node v14 support):
npm install --save-dev husky@8.0.3
npx husky add .husky/pre-commit npx lint-staged
Upgrade Prettier and add
npm run format
scripts:npm update prettier
Downgrade
eslint-config-prettier
to be compatible with eslint v6 (current v7.2.0 requires eslint upgrade):npm install --save-dev eslint-config-prettier@6.15.0
Ignores
coverage
anddist
directories when running PrettierUpdate
lint-staged
to run prettierRemove git-hooks config from
package.json
(this project uses Husky not Yorkie)Check eslint <-> prettier conflicts and remove problematic rules:
Set
lint-staged
to runstylelint
on the same file patterns as the npm script is configured to. This potentially needs further work as a separate PR because currently onmain
, if you runnpx stylelint **/*.{css,vue} --fix
(the equivalent of whatlint-staged
runs it against), there's a bunch of things flagged in thestatic
directory.Tests
npm run lint
andnpm run format
and check that tests and builds still work OKChecklist
Update index.md
).main
ormaster
).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin