-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add --fix-type support #3165
base: master
Are you sure you want to change the base?
Add --fix-type support #3165
Conversation
1) Add the type field in rule's meta 2) Fix the fixable field
Co-Authored-By: Jordan Harband <[email protected]>
Co-Authored-By: Jordan Harband <[email protected]>
0cc60a3
to
3e7ebd5
Compare
Rebased |
docs: { | ||
description: 'Validate closing bracket location in JSX', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-closing-bracket-location'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
why is this change correct?
(if it is correct, i'd like to land it separately, before this 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.
it was part of the original PR
I'm not 100% sure what this property means because the documentation doesn't mention what is the difference between code
and whitespace
; possibly whitepsace
means that a fix will only change whitespace characters
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.
@ljharb I've reverted the changes to fixable
and category
in made by the previous PR author as they are not related to --fix-type
(purpose of this PR); please have a look, thanks!
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 like this change was correct, because the fix changes only spacing before the bracket (indents + newline), see eslint/eslint#15489 (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.
@sryze can we make a separate PR that changes all the "code"s to "whitespace"s?
lib/rules/jsx-curly-spacing.js
Outdated
docs: { | ||
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-curly-spacing'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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?
lib/rules/jsx-equals-spacing.js
Outdated
docs: { | ||
description: 'Disallow or enforce spaces around equal signs in JSX attributes', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-equals-spacing'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
and here?
lib/rules/jsx-first-prop-new-line.js
Outdated
docs: { | ||
description: 'Ensure proper position of the first property in JSX', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-first-prop-new-line'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
and here
lib/rules/jsx-indent-props.js
Outdated
docs: { | ||
description: 'Validate props indentation in JSX', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-indent-props'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
and here
docs: { | ||
description: 'Disallow multiple spaces between inline JSX props', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-props-no-multi-spaces'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
and here
deprecated: true, | ||
docs: { | ||
description: 'Validate spacing before closing bracket in JSX', | ||
category: 'Stylistic Issues', | ||
recommended: false, | ||
url: docsUrl('jsx-space-before-closing'), | ||
}, | ||
fixable: 'code', | ||
fixable: 'whitespace', |
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.
and here
lib/rules/no-array-index-key.js
Outdated
category: 'Best Practices', | ||
category: 'Possible Errors', |
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.
changing the category is a breaking change; also, this is indeed a best practice, and does not necessarily indicate a problem.
lib/rules/no-typos.js
Outdated
category: 'Stylistic Issues', | ||
category: 'Possible Errors', |
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 a breaking change, and also should be done in a separate PR.
category: 'Best Practices', | ||
category: 'Possible Errors', |
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 here
59af733
to
865ed16
Compare
069314a
to
181c68f
Compare
380e32c
to
51d342b
Compare
Add
type
property to all rules to support usage of eslint's--fix-type
optionFixes #2618. Fixes #2039.
Successor of this PR: #2619