You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Playboard team, we use the eslint-plugin-x and during development, we found out that eslint with its max-len rule and prettier didn't work together. The main problem is there are some cases that prettier doesn't want to transform the code even when the code's length surpasses the limit.
Some cases:
Strings length (e.g: long imports paths, long attribute names in vue files, long describe() titles, long URL ). Further info
Template Literals when there are some expressions inside prettier doesn't do a wrap transformation itself. It is a known discussion topic of the prettier formatter.
How can the project be improved?
In the Playboard team, we use the
eslint-plugin-x
and during development, we found out thateslint
with itsmax-len
rule andprettier
didn't work together. The main problem is there are some cases thatprettier
doesn't want to transform the code even when the code's length surpasses the limit.Some cases:
vue
files, longdescribe()
titles, long URL ). Further infoprettier
doesn't do a wrap transformation itself. It is a known discussion topic of theprettier
formatter.<div class="example-component example-component--expanded">
How can this be solved?
Proposed solution
In Play team core repository we defined a configuration in
.eslintrc.js
which solved these issues.ignoreStrings
flag.ignoreTemplateLiterals
flag.play-core
repository.ignoreHTMLAttributeValues
flag.Customizations supported
I would suggest using our approach or something along those lines in
eslint-plugin-x
so everyone could have a general config that solves these issues.Suggestions:
.vue
files, which disabled the originalmax/len
but used the extended onevue/max-len
max-len
Additional information
Previously prettier would have formatted this with one class per line. like so:
<div class="example-component example-component--expanded example-component--collapsed" >
But it is no longer an option since prettier@2.5.0.
Further info:
eslint
configCode of Conduct
The text was updated successfully, but these errors were encountered: