-
Notifications
You must be signed in to change notification settings - Fork 394
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
Wrap strings at 80 characters #715
Conversation
so, I can write a styled component 100 symbols long (I think it's not good). Is there an option for
👍
could you elaborate, please? give more details? |
@shcheklein
to this
The latter exceeds the 80 character limit where |
Hm... The longest line there,
is exactly 80 chars long. |
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.
see some comments from me and @jorgeorpinel
@algomaster99 any progress on this? do you need any help? |
@shcheklein #715 (comment) see this |
To summarize, the conversation in #715 (review) (now resolved), Prettier has a weird behavior (introduced in prettier/prettier/pull/5979) that elongates some lines inside js template literals during formatting. But then hen ESLint reports an error in those lines...
I think that we should not include special ignore comments because we'll forget to remove them later. Unless, perhaps, they only affect that one specific line and we keep track of this bug on Prettier. However we may be forced to do this unless there is some way to force merging this without CI checks having passed. Is this possible @shcheklein? |
+1
+1
it's technically possible, but we are not going to do this since it will affect all other PRs after that - and the general status of the repo (README.md badge) |
Do you see any other alternatives/ workarounds @algomaster99? Not requiring |
No, not yet. Thinking to open issues in prettier. Here it is: prettier/prettier#6716. |
See prettier/prettier#6262 (comment). Since we cannot stop |
@jorgeorpinel @shcheklein They have replied. I say we go with |
So, first of all we have two different problems, right?
Have you tried to google if there is a solution on the eslint side? It might be that we will have to got with that eslint-disable-next-line clause. Or alternatively just cut the description length. Have we decided what do we do with styled blocks? And what the problem with them in the first place? |
@algomaster99 please, check also the latest reply in the issue you created in the Prettier repo. There is an option to use a common eslint-prrettier config. I haven't check which of our problems would is solve, which would it ignore, etc. Btw, eslint only checks the correctness it doesn't modify code, right? Prettier modifies it. |
Yes.
What do you think of point 2 above?
There was one option available for |
Eslint is a code linter while prettier is a formatter. Eslint understands our code and throws errors which are more based on the syntax like Eslint will throw errors/warnings if there are unused imports, etc. But to answer your question, they both can modify it.
You can check a more elaborate difference here - https://prettier.io/docs/en/comparison.html |
would be great to see if there is a global
I'm not sure I understand how eslint's option helps overriding prettier's behavior.
do we use it? |
No, pre-commit hook runs I will update you when I progress on this issue. Will try turning off all the conflicting rules. |
sounds good ... I would focus though on the problems we have and cherry-pick relevant rules if possible |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@shcheklein sorry, my mistake. It was |
So there are two packages installed in our project called -
Now to include these two configurations, we simply need to add one line in {
"extends": [
"plugin:prettier/recommended"
]
} Now getting back to the problem, |
@shcheklein |
it's already here, right?
@algomaster99 as I mentioned your plan |
@shcheklein the rule are already off since we have already written the line We just turned on one -
|
@algomaster99 I meant this line: |
so, do we need to do more changes? what about "/* eslint-disable max-len */"? as we discussed we don't consider this as a solution, right? Could you once again summarize the problems and solutions you want to apply to each of them and describe what is still missing? |
Problem 1
Proposed solution
P.S. I also checked if any rule of Problem 2
Proposed solution
|
@algomaster99 thanks for the great summary! I vote for the solutions 1 and 2 for problems 1 and 2 respectively. This way we always accept the way prettier formats the code and we adjust ESLint to be compatible with it. It's also aligned with the way we already do this by applying |
So that running |
To be honest I'm not sure how does exactly Since it's already enabled (I mean |
eddfce4
to
fd4fe9c
Compare
Did this not fix probelm 1? I also think this is the best strategy. See recommended ESLint config. Or are you saying their recommended config doesn't already disable I also vote for solution #1 here since it doesn't require maintaining several For problem 2, could the assertion strings simply be re-written to be shorter so we avoid this problem? E.g.
+1 |
Oh no! I'm 10 minutes late to comment on this PR after it was merged! Took me like 15 to read everything and write that last note 😋 |
// eslint-disable-next-line max-len | ||
it("Throws error if item has source: false and doesn't have children", () => { |
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 think we could've just shortened this string to something like "Throws error if source:false in leaf item"
.
This reverts commit fd8fbbc.
TL;DR: See summary in #715 (comment) and discussion below.
Fixes #548
styled
blocks, I have disabled eslint max-len checking becauseeslint
was automatically convertingto
svg
tag, I thought to letd
attributes as it is.helper.test.js
, eslint was not allowing to break parametes into multiple line.