-
Notifications
You must be signed in to change notification settings - Fork 218
chore: lint-staged tooling to simplify pre-commit workflows #5393
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
base: main
Are you sure you want to change the base?
Conversation
|
yarn genversion --es6 --semi $VERSION_FILE | ||
git add $VERSION_FILE | ||
EOF | ||
yarn lint-staged --allow-empty |
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.
Much less complexity! 🥳
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
@@ -7,6 +7,6 @@ bracketSpacing: true | |||
arrowParens: always | |||
htmlWhitespaceSensitivity: ignore | |||
overrides: | |||
- files: '{tools,packages}/*/src/spectrum-*.css' | |||
- files: '{tools,packages}/*/src/*.css' |
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.
All CSS assets benefit from this expanded line-length in order to prevent var function wraps that could block proper downstream minification efforts.
@@ -91,11 +91,10 @@ The `:nonbreaking` variant lets us release patch updates quickly in cases where | |||
|
|||
There are several commands that can be useful in specific scenarios: | |||
|
|||
- `yarn build:clear-cache` to remove previously created artifacts of the `tsc build` process. | |||
- `yarn spectrum-vars` to ensure that theme files are up-to-date. |
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.
This command is no longer called directly so I removed it from the docs. All other updates are whitespace fixes from prettier.
governing permissions and limitations under the License. | ||
*/ | ||
|
||
export default { |
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.
This mimics our existing linting rules
], | ||
'{packages,tools}/*/src/**/!(*.css).ts': ['yarn lit-analyzer'], | ||
'package.json': () => [ | ||
'genversion --es6 --semi tools/base/src/version.js', |
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.
Am I correct that we only want to run genversion when the package.json is updated?
"lint:js": "pretty-quick --pattern \"tasks/**/*.js\" && pretty-quick --pattern \"scripts/**/*.js\"", | ||
"lint:packagejson": "pretty-quick --pattern package.json --pattern \"packages/*/package.json\" --pattern \"projects/*/package.json\" --pattern \"tools/*/package.json\" --pattern \"react/*/package.json\"", | ||
"lint:ts": "pretty-quick --pattern \"packages/**/*.ts\" && eslint -f pretty \"packages/**/*.ts\" && pretty-quick --pattern \"tools/**/*.ts\" && eslint -f pretty \"tools/**/*.ts\"", | ||
"lint": "git status --porcelain && git add . && yarn lint-staged", |
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.
This git status command checks first if there are uncommitted assets and adds them before linting.
@@ -90,7 +84,7 @@ | |||
"test:watch:flags:focus": "yarn build && run-p build:watch \"test:start --watch --group {1} --config web-test-runner.config.ci-chromium-flags.js\" --", | |||
"test:watch:focus": "yarn build && run-p build:watch \"test:start --watch --group {1}\" --", | |||
"update:spectrum-css": "node ./scripts/update-spectrum-css.js --latest || yarn update:spectrum-css:cleanup", | |||
"update:spectrum-css:cleanup": "yarn lint:packagejson && yarn --ignore-scripts && yarn process-spectrum", | |||
"update:spectrum-css:cleanup": "yarn --ignore-scripts && yarn process-spectrum && yarn lint", |
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.
I moved this order around because you can't run the linter until you've installed with yarn first anyway.
@@ -217,7 +217,6 @@ jobs: | |||
- run: | |||
name: Lint | |||
command: yarn lint | |||
- run: yarn analyze |
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.
This runs as part of the lint task if the appropriate files are edited
105dc3d
to
f46b5a0
Compare
Description
Swap out pretty-quick and manual linting calls in favor of the lint-staged tool which lets us define commands to run only when certain files are edited. These actions are only performed on files edited in a pull request or in git history to prevent leaking unrelated changes into pull requests which could expand scope of existing work.
Related issue(s)
Motivation and context
How has this been tested?
Test case 1
Test case 2
Did it pass in Desktop?
Did it pass in Mobile?
Did it pass in iPad?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.