-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: prettier reset trailingComma: all #972
Conversation
Codecov Report
@@ Coverage Diff @@
## master #972 +/- ##
==========================================
+ Coverage 42.43% 42.45% +0.01%
==========================================
Files 64 64
Lines 2922 2923 +1
Branches 633 633
==========================================
+ Hits 1240 1241 +1
Misses 1411 1411
Partials 271 271
Continue to review full report at Codecov.
|
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.
Why is there a new file packages/examples/graphiql-cdn/graphiql.css
?
Could you also point me to the config where you enabled the trailing comma? I can't find it amongst all those changes :/
@Neitsch this needs rebased but that new file will already exist as of the new master |
as you can see though, adding these extra commas somehow decreases coverage significantly |
@Neitsch again, everything passes but codecov's test coverage comparison :/ |
/packages/graphiql/test/vendor | ||
|
||
# Funky codemirror-graphql build pattern | ||
/packages/codemirror-graphql/** |
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.
You have to be very careful with this pattern; if this line matches a directory then files in that directory will not be re-included by the !
rule. ESLint uses the same algorithm as gitignore; which states:
An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.
To fix you have to match JUST the files explicitly:
/packages/codemirror-graphql/** | |
/packages/codemirror-graphql/**/*.ts | |
/packages/codemirror-graphql/**/*.tsx | |
/packages/codemirror-graphql/**/*.js | |
/packages/codemirror-graphql/**/*.jsx |
Maybe we should note this more strongly here:
Line 7 in 2da818b
# First: ignore FILES (not folders!) |
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.
ok, the above suggestion works except it needs to ignore everything but src
though. the whole issue with codemirror-graphql
is that it builds to the root for easy resolutions, and the new eslintignore file doesnt ignore the built files anymore. the subpackage .gitignore
honors this and we need the .eslinignore
to do the same
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.
Yes; that's why I left the !.../src/**
line below :) It's only the actual /**
line I changed to make more explicit to only match files and not folders. I believe this will achieve the outcome you desire.
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.
Couple notes 👍
|
||
# breaks prettier graphql parser | ||
packages/graphql-language-service-server/src/__tests__/__queries__/test.graphql | ||
packages/codemirror-graphql/src/__tests__/schema-kitchen-sink.graphql |
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.
Maybe we should ignore all the graphql files in __tests__
; some of them might test whitespace?
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.
good point... that reminds me of at least one test "fix" i had to make that was suspicious in this PR...
@@ -14,7 +14,7 @@ const INVERSE = '\x1b[7m'; | |||
const RESET = '\x1b[0m'; | |||
const YELLOW = '\x1b[33m'; | |||
|
|||
const options = ['--trailing-comma=es5']; | |||
const options = ['--config ../../.prettierrc']; |
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.
These options should be separate (for spawn
), and we should pass a fixed path so that it doesn't matter where the script is called from.
const options = ['--config ../../.prettierrc']; | |
const options = ['--config', `${__dirname}/../.prettierrc`]; |
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.
ah yes, absolute path is much better.
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.
really, the script is so simple now, we could just invoke it directly
@benjie once we are done with this PR (it looks like we will have to add a fair amount of test coverage to make this one pass) and some of the other big ones, lets sit down with @IvanGoncharov, you and myself and do one last pass at auditing our eslint/prettier setup |
Sounds like a plan. Fair warning: I am not a fan of YAML. |
Thanks for fixing the trailing comma stuff! Let's ship it 👍 |
@Neitsch @benjie i think we should scrap this PR personally. We already have es5 commas, so all object literals have trailing commas, etc. The commit you saw was where we enforced es5 commas, stripping out the extra es2018 commas downstream. This |
I wouldn't worry about increasing code coverage when the changes are just formatting. It's okay to ignore that one status 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.
@acao I'd like to see this PR done as two separate commits:
- Commit 1: changes the configuration of ESLint/prettier/etc
- Commit 2: autofix changes ONLY - no manual changes.
This will make it a lot easier to review.
I believe we can completely ignore codecov for this PR.
I agree on the approach, but I think we should just close it. we dont even
need this config change. we already have es5 commas
…On Tue, Oct 15, 2019 at 6:17 AM Benjie Gillam ***@***.***> wrote:
***@***.**** requested changes on this pull request.
@acao <https://github.com/acao> I'd like to see this PR done as two
separate commits:
- Commit 1: changes the configuration of ESLint/prettier/etc
- Commit 2: autofix changes ONLY - no manual changes.
This will make it a lot easier to review.
I believe we can completely ignore codecov for this PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#972?email_source=notifications&email_token=AAKOFF6TO2RK3JNTFDXBUFTQOWKDZA5CNFSM4I5ZHHK2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCH6RMZI#pullrequestreview-301799013>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKOFF7TOQ4OVMO5R4F5TNTQOWKDZANCNFSM4I5ZHHKQ>
.
|
It's certainly not a big priority. Let's close it and come back to it later. |
in the eslint upgrade and typescript conversion kerfuffle we accidentally reverted to es5 commas briefly. re-adding all those es2017 compatible commas!