-
Notifications
You must be signed in to change notification settings - Fork 105
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
Prettier and eslint improvements (no dependency upgrades yet) #574
Prettier and eslint improvements (no dependency upgrades yet) #574
Conversation
mattpocock
commented
Aug 20, 2024
•
edited
Loading
edited
- Make prettier run on the entire repo, not just the source files
- Remove prettier from eslint configs
- Made the CI check that code is formatted correctly
|
@@ -41,8 +42,6 @@ | |||
"@typescript-eslint/parser": "4.28.1", | |||
"babel-jest": "27.5.1", | |||
"eslint": "7.30.0", | |||
"eslint-config-prettier": "7.1.0", |
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.
[Non-blocker] Is there a reason to avoid eslint-config-prettier
? I thought it's meant to prevent conflicting rules
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.
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 for the link
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 also agree with removing eslint-config-prettier
and the prettier docs advise to essentially do the same (i.e. let linters lint, and formatters format)
package.json
Outdated
"lint": "eslint ./src --ext .ts", | ||
"format": "prettier --write 'src/**/*.ts?(x)' && npm run lint -- --fix", | ||
"format": "prettier --write . && npm run lint -- --fix", | ||
"format-check": "prettier --check .", |
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.
Lets utilize prettier and eslint's cacheing options
- https://prettier.io/docs/en/cli#--cache
- https://eslint.org/docs/latest/use/command-line-interface#caching
"lint": "eslint ./src --ext .ts", | |
"format": "prettier --write 'src/**/*.ts?(x)' && npm run lint -- --fix", | |
"format": "prettier --write . && npm run lint -- --fix", | |
"format-check": "prettier --check .", | |
"lint": "eslint ./src --ext .ts --cache --cache-location 'node_modules/.cache/eslintcache", | |
"format": "prettier --write --cache --cache-location='node_modules/.cache/prettiercache' . && npm run lint -- --fix", | |
"format-check": "prettier --check --cache --cache-location='node_modules/.cache/prettiercache' .", |
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.
Getting this warning from Prettier:
[warn] Ignored unknown option --cache.
[warn] Ignored unknown option --cache-location=node_modules/.cache/prettiercache.
@@ -41,8 +42,6 @@ | |||
"@typescript-eslint/parser": "4.28.1", | |||
"babel-jest": "27.5.1", | |||
"eslint": "7.30.0", | |||
"eslint-config-prettier": "7.1.0", |
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 also agree with removing eslint-config-prettier
and the prettier docs advise to essentially do the same (i.e. let linters lint, and formatters format)
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.
lgtm 👍 last things:
- let's just make sure we make the one change as per @dmmulroy's comment
- Resolve merge conflicts
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
tests/index.test.ts
Outdated
type ExpecteResult = Result<[ string, number, boolean ], (string | number | boolean)[]> | ||
const heterogenousList: HeterogenousList = [okAsync('Yooooo'), okAsync(123), okAsync(true)] | ||
|
||
type ExpecteResult = Result<[string, number, boolean], [string, number, boolean]> |
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.
Is this change intentional?
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.
@mattpocock Isn't that the reason tests are failing?
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.
Apparently not intentional, let me check
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.
Looks like I was pulling from origin/master instead of upstream/master, my bad. Fixed.
…' of https://github.com/mattpocock/neverthrow into matt/prettier-and-eslint-improvements--no-upgrades-yet-
This PR is getting a bit out of hand. I am having real trouble rebasing every time a new change is merged. I'll create a new PR which adds the ability to run prettier, but doesn't format the whole repo. Once that's merged we can format the repo properly. |