-
Notifications
You must be signed in to change notification settings - Fork 18
Add support for ESLint doc url meta, update dependencies, support TypeScript 2.7 #84
Conversation
Request for commentscc @lemonmade @ismail-syed @GoodForOneFare
|
Personally, I would prefer the |
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 is great! Do we have to do something to have our own rules support he new doc links thing?
key: v1-npm-deps-{{ arch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- node_modules | ||
- run: yarn run 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.
Probably would have been better as a separate PR?
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.
Yeah I got a bit carried away 😅
svg: 'always', | ||
png: 'always', | ||
jpg: 'always', | ||
ico: 'always', |
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.
Also want .graphql/ .css/ .scss?
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, addressed in d2f1785
lib/config/rules/jest.js
Outdated
@@ -17,4 +17,16 @@ module.exports = { | |||
'jest/prefer-to-be-undefined': 'error', | |||
// Ensure `expect()` is called with a single argument and there is an actual expectation made. | |||
'jest/valid-expect': 'error', | |||
// Suggest using expect.assertions() OR expect.hasAssertions() | |||
'jest/valid-expect-in-promise': '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 you are missing a rule (the above us not the correct description for the rule)
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.
Also, this rule should definitely be on, it’s a very common problem
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 catch, it was missing https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/prefer-expect-assertions.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.
Also, this rule should definitely be on, it’s a very common problem
Turned on in 23be4b8
// Ensures the proper number of arguments are passed to Promise functions | ||
'promise/valid-params': 'error', | ||
// Avoid calling new on a Promise static method | ||
'promise/no-new-statics': '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 see no reason to leave this 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’s already handled by another rule (no-new
)
lib/config/rules/react.js
Outdated
@@ -49,6 +51,8 @@ module.exports = { | |||
'react/no-render-return-value': 'error', | |||
// Prevent usage of setState | |||
'react/no-set-state': 'off', | |||
// Prevent this from being used in stateless functional components | |||
'react/no-this-in-sfc': '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.
Same here — this is a great rule
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.
Turned on in f18da27
lib/config/rules/react.js
Outdated
@@ -92,6 +96,8 @@ module.exports = { | |||
|
|||
// Enforce boolean attributes notation in JSX | |||
'react/jsx-boolean-value': 'error', | |||
// Enforce or disallow spaces inside of curly braces in JSX attributes and expressions | |||
'react/jsx-child-element-spacing': '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’d want this rule on as well
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.
If Prettier already takes care of this for devs, I’m not sure this needs to be turned on
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 don't know if Prettier would take care of this? It's more of a clarification mechanism for developers, and in any case, Prettier is not necessarily being used when using this particular set of rules (if it does conflict with Prettier, we can turn it off just for the prettier 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.
Oh you're right, I was thinking of another rule that had to do with styles and has almost the same name. Turned on in 9978763
All the Jest rules are good but I think we need to disable the lowercase one for now until we can turn it off for describe, as we recommend using the full component/ class name there where appropriate. |
Thank you for the feedback! Recap of the changes:
How do we feel about this rule https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/consistent-test-it.md?
Yes we do. I'm opening a new branch for that. |
When I wrote Glad to see there's an open PR for adding ignore options |
Just published: @lemonmade
I agree this is a useful rule, any suggestions on how to deal with it? Edit: found a workaround: <span className={styles.HeaderTextShopify}>Shopify</span>{' '}
Polaris |
I still might be misunderstanding the rule, but I don't think they conflict. The biggest overlap is that Prettier might sometimes change code that this rule would flag to not require the explicit space at all (example from the rule): <div>
Here is a
<a>link</a>
</div>
// becomes with Prettier:
<div>Here is a <a>link</a></div>
// which is acceptable for this rule, which deals only with newline-separate siblings I think I confirmed that Prettier does not try to correct the case where you make explicitly no space between newline-separate children. I think we are fine to leave this on, and it just kind of works in tandem with the Prettier formatting. |
Thanks, I guess I was a bit confused because you can't add a trailing space into an element ( Let's ship it! |
Add docs meta to custom rules
Rewrite rules in imperative tone
Released under version
20.0.0
.eslint-plugin-ava
^4.4.0
4.5.1
eslint-plugin-import
^2.8.0
2.9.0
eslint-plugin-jest
^21.5.0
21.14.1
eslint-plugin-lodash
^2.5.0
2.6.1
eslint-plugin-node
^5.2.1
6.0.1
eslint-plugin-prettier
^2.4.0
2.6.0
eslint-plugin-promise
^3.6.0
3.7.0
eslint-plugin-react
^7.5.1
7.7.0
eslint-plugin-typescript
^0.8.1
0.10.0
react/forbid-dom-props
(disabled)react/jsx-child-element-spacing
errorreact/jsx-max-depth
(disabled)react/jsx-sort-default-props
(disabled)react/no-this-in-sfc
errorimport/group-exports
(disabled)import/no-self-import
errorimport/no-default-export
(disabled)import/no-useless-path-segments
errorjest/prefer-expect-assertions
(disabled)jest/valid-expect-in-promise
errorjest/valid-describe
errorjest/consistent-test-it
errorjest/no-test-prefixes
errorjest/lowercase-name
errorjest/no-jest-import
errorpromise/valid-params
errorpromise/no-new-statics
(disabled)typescript/explicit-function-return-type
(disabled)typescript/no-non-null-assertion
errorimport/extensions
due to changes in its implementation: some extensions are explicitly allowed inimport
s:.svg
,.png
,.jpg
,.ico
..json
is still required as well.