-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
lib/config/rules/import.js
Outdated
@@ -75,4 +75,6 @@ module.exports = { | |||
'import/max-dependencies': 'off', | |||
// Forbid unassigned imports | |||
'import/no-unassigned-import': 'off', | |||
// Forbid anonymous values as default exports <FEEDBACK> | |||
'import/no-anonymous-default-export': 'off', |
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.
Thoughts on this, IIRC I've seen our code export defaults before. Are there any specific types we should explicitly 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.
I think we can turn this on, we prefer named functions anyways, and exporting literals is a pretty uncommon case.
@@ -7,6 +7,8 @@ module.exports = { | |||
'global-require': 'off', | |||
// Enforces error handling in callbacks | |||
'handle-callback-err': ['warn', '^.*(e|E)rr(or)?$'], | |||
// disallow use of the Buffer() constructor | |||
'no-buffer-constructor': '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.
security vulnerability, see https://eslint.org/docs/rules/no-buffer-constructor
lib/config/rules/react.js
Outdated
@@ -1,8 +1,12 @@ | |||
module.exports = { | |||
// General | |||
|
|||
// Enforces consistent naming for boolean props <FEEDBACK> | |||
'react/boolean-prop-naming': 'off', |
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 seems useful but could cause some frustrations adopting in a large code base. Doesn't seem to have a fixer either.
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
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.
It would be cool if we could do the opposite of the default (never start with is/ has), as this is our standard.
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.
What the reasoning behind that being our standard?
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.
🤷♂️ it's just kind of what we landed on, it's consistent with our Ruby components and it avoids some kind of unnecessary duplication from my perspective
lib/config/rules/stylistic-issues.js
Outdated
@@ -129,6 +135,8 @@ module.exports = { | |||
'operator-linebreak': ['warn', 'after', {overrides: {'?': 'before', ':': 'before'}}], | |||
// Enforce padding within blocks | |||
'padded-blocks': 'off', | |||
// require or disallow padding lines between statements <FEEDBACK> | |||
'padding-line-between-statements': 'off', |
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 rule has lots of config options: https://eslint.org/docs/rules/padding-line-between-statements
I'd say just keep it off.
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 great, left some comments but Im in agreement on almost everything
lib/config/rules/import.js
Outdated
@@ -75,4 +75,6 @@ module.exports = { | |||
'import/max-dependencies': 'off', | |||
// Forbid unassigned imports | |||
'import/no-unassigned-import': 'off', | |||
// Forbid anonymous values as default exports <FEEDBACK> | |||
'import/no-anonymous-default-export': 'off', |
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 can turn this on, we prefer named functions anyways, and exporting literals is a pretty uncommon case.
lib/config/rules/possible-errors.js
Outdated
// enforce “for” loop update clause moving the counter in the right direction. | ||
'for-direction': 'error', | ||
// enforce return statements in getters <FEEDBACK> | ||
'getter-return': ['error', {'allowImplicit': true}], |
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.
No need for the quotes on allowImplicit, and 👍
lib/config/rules/react.js
Outdated
@@ -1,8 +1,12 @@ | |||
module.exports = { | |||
// General | |||
|
|||
// Enforces consistent naming for boolean props <FEEDBACK> | |||
'react/boolean-prop-naming': 'off', |
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.
It would be cool if we could do the opposite of the default (never start with is/ has), as this is our standard.
@@ -78,6 +88,8 @@ module.exports = { | |||
'react/jsx-boolean-value': 'warn', | |||
// Validate closing bracket location in JSX | |||
'react/jsx-closing-bracket-location': ['warn', {location: 'tag-aligned'}], | |||
// Validate closing tag location in JSX | |||
'react/jsx-closing-tag-location': '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.
I think we want line-aligned
for the option here
lib/config/rules/stylistic-issues.js
Outdated
@@ -1,8 +1,12 @@ | |||
// see http://eslint.org/docs/rules/#stylistic-issues | |||
|
|||
module.exports = { | |||
// enforce linebreaks after opening and before closing array brackets <FEEDBACK> | |||
'array-bracket-newline': ['error', {'multiline': true}], |
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.
No need for quotes when names are valid identifiers
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.
Disabling this rule, it's not behaving as expected, or maybe I'm misunderstanding it.
Lint errors show that there should be no linebreak when we specify multiline: true
.
https://circleci.com/gh/Shopify/eslint-plugin-shopify/144
package.json
Outdated
@@ -58,18 +58,18 @@ | |||
"eslint": "<5 >=4.3.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 think we need this to be >=4.7.0
now
@@ -1,8 +1,12 @@ | |||
// see http://eslint.org/docs/rules/#stylistic-issues | |||
|
|||
module.exports = { | |||
// enforce linebreaks after opening and before closing array brackets | |||
'array-bracket-newline': 'off', |
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.
Disabled this, I misunderstood what the multiline
option meant.
Perhaps multiline should be renamed to multiline-element to avoid confusion.
eslint/eslint#8981 (comment)
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 kinda like this one, but don't like some of the edge cases that it forbids/allows. Ultimately, I don't see anyone violating this rule so ¯\(ツ)/¯
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.
Boo, what a terrible option :/
// Enforce spacing inside array brackets | ||
'array-bracket-spacing': ['warn', 'never'], | ||
// enforce line breaks after each array element | ||
'array-element-newline': 'off', |
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.
👍
02e8d19
to
48ac1f3
Compare
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 of minor changes and LGTM. This is a pro PR 👍
@@ -75,4 +75,6 @@ module.exports = { | |||
'import/max-dependencies': 'off', | |||
// Forbid unassigned imports | |||
'import/no-unassigned-import': 'off', | |||
// Forbid anonymous values as default exports | |||
'import/no-anonymous-default-export': '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.
👍
// enforce “for” loop update clause moving the counter in the right direction. | ||
'for-direction': 'error', | ||
// enforce return statements in getters | ||
'getter-return': ['error', {allowImplicit: true}], |
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.
👍
@@ -1,6 +1,10 @@ | |||
// see http://eslint.org/docs/rules/#possible-errors | |||
|
|||
module.exports = { | |||
// enforce “for” loop update clause moving the counter in the right direction. | |||
'for-direction': '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.
👍
@@ -1,8 +1,12 @@ | |||
module.exports = { | |||
// General | |||
|
|||
// Enforces consistent naming for boolean props | |||
'react/boolean-prop-naming': 'off', |
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.
👍
// Prevent missing displayName in a React component definition | ||
'react/display-name': ['warn', {ignoreTranspilerName: false}], | ||
// Prevent extraneous defaultProps on components | ||
'react/default-props-match-prop-types': '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.
👍
I assume we'll have to turn this off in the TS config.
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.
Yup.
@@ -129,6 +135,8 @@ module.exports = { | |||
'operator-linebreak': ['warn', 'after', {overrides: {'?': 'before', ':': 'before'}}], | |||
// Enforce padding within blocks | |||
'padded-blocks': 'off', | |||
// require or disallow padding lines between statements | |||
'padding-line-between-statements': 'off', |
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.
👍
Yeesh. I'm sure there are useful permutations of this, but who would be able to read the config? 😕
@@ -137,6 +145,8 @@ module.exports = { | |||
'require-jsdoc': 'off', | |||
// Enforce spacing before and after semicolons | |||
'semi-spacing': ['warn', {before: false, after: true}], | |||
// enforce location of semicolons | |||
'semi-style': ['error', 'last'], |
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.
👍
@@ -155,6 +165,8 @@ module.exports = { | |||
'space-unary-ops': ['warn', {words: true, nonwords: false}], | |||
// Require or disallow a space immediately following the // or /* in a comment | |||
'spaced-comment': ['warn', 'always', {markers: ['=']}], | |||
// enforce spacing around colons of switch statements | |||
'switch-colon-spacing': ['error', {'after': true, 'before': false}], |
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.
👍
package.json
Outdated
@@ -45,7 +45,7 @@ | |||
"babel-cli": "^6.24.1", | |||
"babel-core": "^6.25.0", | |||
"babel-preset-shopify": "^16.1.0", | |||
"eslint": "^4.3.0", | |||
"eslint": "^4.7.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.
4.7.1 😛
@@ -7,6 +7,8 @@ module.exports = { | |||
'jsx-a11y/alt-text': 'error', | |||
// Enforce all anchors to contain accessible content. | |||
'jsx-a11y/anchor-has-content': 'error', | |||
// Enforce all anchors are valid, navigable elements. | |||
'jsx-a11y/anchor-is-valid': '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.
👍
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 replaces jsx-a11y/href-no-hash
. The old rule's config should be deleted.
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, nice catch!
ef6eadf
to
dfd4d9c
Compare
4.7.0
out of date
plugins as per david-dm listingRules descriptions tagged with
<FEEDBACK>
could use some discussion/feedback.