-
Notifications
You must be signed in to change notification settings - Fork 3
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
ENH Loosen rules #13
ENH Loosen rules #13
Conversation
895eac8
to
c328060
Compare
@@ -43,7 +43,7 @@ module.exports = { | |||
{ | |||
// turned off otherwise non-admin modules will complain about importing components from admin | |||
// via the novel silverstripe js component sharing setup | |||
'import/no-extraneous-dependencies': [ |
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.
import/no-extraneous-dependencies
is no longer the warning being thrown in most cases - but not all caseds, so need to change it to import/no-unresolved
All of the inline // eslint-disable-next-line import/no-extraneous-dependencies
scattered out through the codebase probably were not doing much before, so I've removed them all
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.
so I've removed them all
As in there are separate PRs for this in silverstripe/admin, etc? Where are those PRs? Or did I misunderstand this statement?
Edit: nvm I see your comment further down saying we shouldn't touch the other modules for now. Agreed.
@@ -83,7 +83,7 @@ module.exports = { | |||
'off' | |||
], | |||
'react/prefer-stateless-function': [ | |||
'error', |
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 didn't used to throw errors, possibly the detection is now better
16d2b39
to
44c471e
Compare
Little script I wrote to fix a few of the things in
To automatically file issues similar to phpcbf: |
44c471e
to
397bac7
Compare
397bac7
to
77e01df
Compare
"max-len": [ | ||
"error", | ||
{ | ||
"code": 200, |
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.
200 character line limit is required to support things like this - https://github.com/silverstripe/silverstripe-admin/blob/1/client/src/lib/dependency-injection/tests/ApolloGraphqlScaffoldingContainer-test.js#L164
Presumably there previously wasn't a line limit
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.
Arguably things like that shouldn't exist, and should be refactored into something we can actually read and interpret. Something for us to consider when revisiting these 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.
Looks okay with the caveat that we will be revisiting this post-beta to make more intentional decisions on these rule changes.
Issue silverstripe/silverstripe-admin#1411
Follow up issue silverstripe/silverstripe-admin#1433
There is a huge number of linting issues, over 2,000 on admin alone - https://github.com/silverstripe/silverstripe-admin/actions/runs/3869147541/jobs/6595073564#step:12:4367. Fixing this will be a massive job.
I think it would be a very poor use of time to refactor all of these just for the sake of airbnb's updated style guide, I'm also I'm not sure I particularly like some of the things in their style guide anyway, such as prefer destructuring which makes harder to read code IMO.
It's too much work to do this pre-beta. I think we should just ignore all the new failures for now (though raise warnings for some things) and maybe aim to implement some of these rules, though realistically this will struggle to get priorities. Note that AirBNB's style guide is MUCH more comprehensive than PSR2/PSR12
The only other realistic option is too disable linting in CI, though that's pretty awful. Who knows when we'll turn it back on?
Some examples of rules being loosened for existing code - there are very large numbers of examples for most of these.
silverstripe/admin/client/src/stories/ValueTracker.js
48:41 error Must use destructuring props assignment react/destructuring-assignment
silverstripe/admin/client/src/lib/castStringToElement.js
50:23 error Prop spreading is forbidden react/jsx-props-no-spreading
silverstripe/admin/client/src/components/TreeDropdownField/TreeDropdownField.js
739:7 error Use array destructuring prefer-destructuring
"TODO" section of .eslintrc.js - these are things think we should just ignore for now to get the CMS beta over the line and aim to fix at a later time, there are well over a hundred warnings to fix for all of the following. I don't see anything here as particularly high value.:
silverstripe/admin/client/src/containers/InsertLinkModal/tests/InsertLinkModal-test.js
12:1 error Component should be written as a pure function react/prefer-stateless-function
silverstripe/admin/client/src/state/toasts/ToastsReducer.js
117:24 error Default parameters should be last default-param-last