-
Notifications
You must be signed in to change notification settings - Fork 33
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
chore: add scripts to format/lint only the delta files #305
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scripts/* | ||
.eslintignore | ||
.prettierignore | ||
.github/workflows/* | ||
*.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
scripts/* | ||
.eslintignore | ||
.prettierignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,13 +44,19 @@ | |
], | ||
"scripts": { | ||
"toc": "doctoc README.md", | ||
"lint": "(prettier . --check || true) && eslint .", | ||
"lint": "prettier . --check && eslint .", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If "unformatted files exist" is an expected state of this repository, then |
||
"lint:delta": "npm-run-all -p prettier:delta eslint:delta", | ||
"prettier:delta": "prettier --check `./scripts/changed-files`", | ||
"eslint:delta": "eslint `./scripts/changed-files`", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can understand the rationale behind incremental prettier, but incremental ESLint goes a step too far in my book. ESLint in our config has most of its formatting checks disabled via eslint-config-prettier, which means its mostly running code quality checks1 ("this should be a Why go out of our way to avoid catching non-stylistic code quality issues? Footnotes
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, you would do things differently. I got that the first time around. Listen, we just went through that discussion. At this point in time, I will not have something that force changing large sway of code to appease automatic checks on formatting or linting. Nobody force you to use those delta scripts. You are quite welcome and encouraged to have new code conform to the lint checks. But, and I'll repeat again to be clear, at this point in time I will not have something that force changing large sway of code to appease automatic checks on formatting or linting. Now, can we consider this particular discussion done, and move to other things? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My apologies, I got a little unproductively worked up. I get a little passionate about testing practices 😅 |
||
"format": "prettier . --write && eslint . --fix", | ||
"format:delta": "npm-run-all format:prettier:delta format:eslint:delta", | ||
"format:prettier:delta": "prettier --write `./scripts/changed-files`", | ||
"format:eslint:delta": "eslint --fix `./scripts/changed-files`", | ||
"test": "vitest run --coverage", | ||
"test:watch": "vitest", | ||
"test:update": "vitest run --update", | ||
"setup": "npm install && npm run validate", | ||
"validate": "npm-run-all lint test", | ||
"validate": "npm-run-all test", | ||
"contributors:add": "all-contributors add", | ||
"contributors:generate": "all-contributors generate" | ||
}, | ||
|
@@ -72,6 +78,7 @@ | |
"eslint-config-prettier": "9.1.0", | ||
"eslint-config-standard": "17.1.0", | ||
"eslint-plugin-import": "2.29.1", | ||
"eslint-plugin-json-files": "^4.1.0", | ||
"eslint-plugin-n": "16.6.2", | ||
"eslint-plugin-promise": "6.1.1", | ||
"eslint-plugin-simple-import-sort": "10.0.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
git diff --name-only --diff-filter=d main |
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 file conflicts with the
ignorePatterns
section of.eslintrc.cjs
, and it's producing warningsI added
ignorePatterns: ['!/.*']
to ensure.eslintrc.cjs
itself would be linted, but that made the assumption ESLint itself was only ever going to be used with.
as its argument. That pattern needs to be more specific now