Skip to content
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

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
category: 'Stylistic Issues',
description: 'Enforces consistent naming for boolean props',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/button-has-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Forbid "button" element without an explicit "type" attribute',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/default-props-match-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce all defaultProps are defined and not "required" in propTypes.',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce consistent usage of destructuring assignment of props, state, and context',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevent missing displayName in a React component definition',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-component-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Forbid certain props on components',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-dom-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Forbid certain props on DOM Nodes',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Forbid certain elements',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-foreign-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Forbid using another component\'s propTypes',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/forbid-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Forbid certain propTypes',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/function-component-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Standardize the way function component get defined',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-boolean-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce boolean attributes notation in JSX',
category: 'Stylistic Issues',
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-child-element-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Ensures inline tags are not rendered without spaces between them',
category: 'Stylistic Issues',
recommended: false,
url: docsUrl('jsx-child-element-spacing'),
},
fixable: null,

messages,

Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-closing-bracket-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Validate closing bracket location in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-closing-tag-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Validate closing tag location for multiline JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description:
'Disallow unnecessary JSX expressions when literals alone are sufficient '
Expand Down
3 changes: 0 additions & 3 deletions lib/rules/jsx-curly-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@ const messages = {
module.exports = {
meta: {
type: 'layout',

docs: {
description: 'Enforce consistent line breaks inside jsx curly',
category: 'Stylistic Issues',
recommended: false,
url: docsUrl('jsx-curly-newline'),
},

fixable: 'whitespace',

schema: [
{
oneOf: [
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-curly-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-equals-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Disallow or enforce spaces around equal signs in JSX attributes',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-filename-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Restrict file extensions that may contain JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-first-prop-new-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Ensure proper position of the first property in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce shorthand or standard form for React fragments',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-handler-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce event handler naming conventions in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-indent-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Validate props indentation in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Validate JSX indentation',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Report missing `key` props in iterators/collection literals',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-max-depth.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Validate JSX maximum depth',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-max-props-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Limit maximum of props on a single line in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Require or prevent a new line after jsx elements and expressions.',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of Function.prototype.bind and arrow functions in React component props',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-comment-textnodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function checkText(node, context) {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Comments inside children section of tag should be placed inside braces',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-constructed-context-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents JSX context provider values from taking values that will cause needless rerenders.',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-duplicate-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Enforce no duplicate props',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-literals.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevent using string literals in React component definition',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-script-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Forbid `javascript:` URLs',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-target-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
fixable: 'code',
docs: {
description: 'Forbid `target="_blank"` attribute without `rel="noreferrer"`',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-no-undef.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow undeclared variables in JSX',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-one-expression-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Limit to one expression per line in JSX',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-pascal-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce PascalCase for user-defined JSX components',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-props-no-multi-spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Disallow multiple spaces between inline JSX props',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-props-no-spreading.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevent JSX prop spreading',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-sort-default-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const messages = {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce default props alphabetical sorting',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-sort-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ function validateReservedFirstConfig(context, reservedFirst) {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce props alphabetical sorting',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-space-before-closing.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
deprecated: true,
docs: {
description: 'Validate spacing before closing bracket in JSX',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-tag-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ const optionDefaults = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Validate whitespace in and around the JSX opening and closing brackets',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-uses-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const docsUrl = require('../util/docsUrl');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevent React to be marked as unused',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-uses-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const isTagName = (name) => isTagNameRe.test(name);

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevent variables used in JSX to be marked as unused',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jsx-wrap-multilines.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const messages = {

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Prevent missing parentheses around multilines JSX',
category: 'Stylistic Issues',
Expand Down
Loading