Skip to content

Commit d11d55d

Browse files
Vlad Esinljharb
Vlad Esin
authored andcommitted
Add support --fix-type
1) Add the type field in rule's meta 2) Fix the fixable field
1 parent 78ddd46 commit d11d55d

File tree

84 files changed

+96
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+96
-17
lines changed

lib/rules/boolean-prop-naming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ const propWrapperUtil = require('../util/propWrapper');
1616

1717
module.exports = {
1818
meta: {
19+
type: 'suggestion',
1920
docs: {
2021
category: 'Stylistic Issues',
2122
description: 'Enforces consistent naming for boolean props',
2223
recommended: false,
2324
url: docsUrl('boolean-prop-naming')
2425
},
25-
2626
schema: [{
2727
additionalProperties: false,
2828
properties: {

lib/rules/button-has-type.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const optionDefaults = {
3636

3737
module.exports = {
3838
meta: {
39+
type: 'problem',
3940
docs: {
4041
description: 'Forbid "button" element without an explicit "type" attribute',
4142
category: 'Possible Errors',

lib/rules/default-props-match-prop-types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const docsUrl = require('../util/docsUrl');
1515

1616
module.exports = {
1717
meta: {
18+
type: 'suggestion',
1819
docs: {
1920
description: 'Enforce all defaultProps are defined and not "required" in propTypes.',
2021
category: 'Best Practices',

lib/rules/destructuring-assignment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const DEFAULT_OPTION = 'always';
1212

1313
module.exports = {
1414
meta: {
15+
type: 'suggestion',
1516
docs: {
1617
description: 'Enforce consistent usage of destructuring assignment of props, state, and context',
1718
category: 'Stylistic Issues',

lib/rules/display-name.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const propsUtil = require('../util/props');
1616

1717
module.exports = {
1818
meta: {
19+
type: 'suggestion',
1920
docs: {
2021
description: 'Prevent missing displayName in a React component definition',
2122
category: 'Best Practices',

lib/rules/forbid-component-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const DEFAULTS = ['className', 'style'];
1919

2020
module.exports = {
2121
meta: {
22+
type: 'suggestion',
2223
docs: {
2324
description: 'Forbid certain props on components',
2425
category: 'Best Practices',

lib/rules/forbid-dom-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const DEFAULTS = [];
1919

2020
module.exports = {
2121
meta: {
22+
type: 'suggestion',
2223
docs: {
2324
description: 'Forbid certain props on DOM Nodes',
2425
category: 'Best Practices',

lib/rules/forbid-elements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const docsUrl = require('../util/docsUrl');
1414

1515
module.exports = {
1616
meta: {
17+
type: 'suggestion',
1718
docs: {
1819
description: 'Forbid certain elements',
1920
category: 'Best Practices',

lib/rules/forbid-foreign-prop-types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const ast = require('../util/ast');
1010

1111
module.exports = {
1212
meta: {
13+
type: 'suggestion',
1314
docs: {
1415
description: 'Forbid using another component\'s propTypes',
1516
category: 'Best Practices',

lib/rules/forbid-prop-types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const DEFAULTS = ['any', 'array', 'object'];
2222

2323
module.exports = {
2424
meta: {
25+
type: 'suggestion',
2526
docs: {
2627
description: 'Forbid certain propTypes',
2728
category: 'Best Practices',

lib/rules/function-component-definition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function isFunctionExpressionWithName(node) {
9898

9999
module.exports = {
100100
meta: {
101+
type: 'suggestion',
101102
docs: {
102103
description: 'Standardize the way function component get defined',
103104
category: 'Stylistic issues',

lib/rules/jsx-boolean-value.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function isNever(configuration, exceptions, propName) {
4848

4949
module.exports = {
5050
meta: {
51+
type: 'suggestion',
5152
docs: {
5253
description: 'Enforce boolean attributes notation in JSX',
5354
category: 'Stylistic Issues',

lib/rules/jsx-child-element-spacing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ const INLINE_ELEMENTS = new Set([
3939

4040
module.exports = {
4141
meta: {
42+
type: 'layout',
4243
docs: {
4344
description: 'Ensures inline tags are not rendered without spaces between them',
4445
category: 'Stylistic Issues',
4546
recommended: false,
4647
url: docsUrl('jsx-child-element-spacing')
4748
},
48-
fixable: null,
49+
// fixable: null,
4950
schema: [
5051
{
5152
type: 'object',

lib/rules/jsx-closing-bracket-location.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const docsUrl = require('../util/docsUrl');
1313
// ------------------------------------------------------------------------------
1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Validate closing bracket location in JSX',
1819
category: 'Stylistic Issues',
1920
recommended: false,
2021
url: docsUrl('jsx-closing-bracket-location')
2122
},
22-
fixable: 'code',
23+
fixable: 'whitespace',
2324

2425
schema: [{
2526
oneOf: [

lib/rules/jsx-closing-tag-location.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const docsUrl = require('../util/docsUrl');
1313
// ------------------------------------------------------------------------------
1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Validate closing tag location for multiline JSX',
1819
category: 'Stylistic Issues',

lib/rules/jsx-curly-brace-presence.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const DEFAULT_CONFIG = {props: OPTION_NEVER, children: OPTION_NEVER};
3232

3333
module.exports = {
3434
meta: {
35+
type: 'suggestion',
3536
docs: {
3637
description:
3738
'Disallow unnecessary JSX expressions when literals alone are sufficient ' +

lib/rules/jsx-curly-newline.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,13 @@ function getNormalizedOption(context) {
3636
module.exports = {
3737
meta: {
3838
type: 'layout',
39-
4039
docs: {
4140
description: 'Enforce consistent line breaks inside jsx curly',
4241
category: 'Stylistic Issues',
4342
recommended: false,
4443
url: docsUrl('jsx-curly-newline')
4544
},
46-
4745
fixable: 'whitespace',
48-
4946
schema: [
5047
{
5148
oneOf: [

lib/rules/jsx-curly-spacing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ const SPACING_VALUES = [SPACING.always, SPACING.never];
2626

2727
module.exports = {
2828
meta: {
29+
type: 'layout',
2930
docs: {
3031
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes',
3132
category: 'Stylistic Issues',
3233
recommended: false,
3334
url: docsUrl('jsx-curly-spacing')
3435
},
35-
fixable: 'code',
36+
fixable: 'whitespace',
3637

3738
schema: {
3839
definitions: {

lib/rules/jsx-equals-spacing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const docsUrl = require('../util/docsUrl');
1313

1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Disallow or enforce spaces around equal signs in JSX attributes',
1819
category: 'Stylistic Issues',
1920
recommended: false,
2021
url: docsUrl('jsx-equals-spacing')
2122
},
22-
fixable: 'code',
23+
fixable: 'whitespace',
2324

2425
schema: [{
2526
enum: ['always', 'never']

lib/rules/jsx-filename-extension.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const DEFAULTS = {
2222

2323
module.exports = {
2424
meta: {
25+
type: 'suggestion',
2526
docs: {
2627
description: 'Restrict file extensions that may contain JSX',
2728
category: 'Stylistic Issues',

lib/rules/jsx-first-prop-new-line.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const docsUrl = require('../util/docsUrl');
1313

1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Ensure proper position of the first property in JSX',
1819
category: 'Stylistic Issues',
1920
recommended: false,
2021
url: docsUrl('jsx-first-prop-new-line')
2122
},
22-
fixable: 'code',
23+
fixable: 'whitespace',
2324

2425
schema: [{
2526
enum: ['always', 'never', 'multiline', 'multiline-multiprop']

lib/rules/jsx-fragments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function replaceNode(source, node, text) {
2121

2222
module.exports = {
2323
meta: {
24+
type: 'suggestion',
2425
docs: {
2526
description: 'Enforce shorthand or standard form for React fragments',
2627
category: 'Stylistic Issues',

lib/rules/jsx-handler-names.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const docsUrl = require('../util/docsUrl');
1313

1414
module.exports = {
1515
meta: {
16+
type: 'suggestion',
1617
docs: {
1718
description: 'Enforce event handler naming conventions in JSX',
1819
category: 'Stylistic Issues',

lib/rules/jsx-indent-props.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ const docsUrl = require('../util/docsUrl');
3838
// ------------------------------------------------------------------------------
3939
module.exports = {
4040
meta: {
41+
type: 'layout',
4142
docs: {
4243
description: 'Validate props indentation in JSX',
4344
category: 'Stylistic Issues',
4445
recommended: false,
4546
url: docsUrl('jsx-indent-props')
4647
},
47-
fixable: 'code',
48+
fixable: 'whitespace',
4849

4950
schema: [{
5051
oneOf: [{

lib/rules/jsx-indent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const docsUrl = require('../util/docsUrl');
4040
// ------------------------------------------------------------------------------
4141
module.exports = {
4242
meta: {
43+
type: 'layout',
4344
docs: {
4445
description: 'Validate JSX indentation',
4546
category: 'Stylistic Issues',

lib/rules/jsx-key.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const defaultOptions = {
2020

2121
module.exports = {
2222
meta: {
23+
type: 'problem',
2324
docs: {
2425
description: 'Report missing `key` props in iterators/collection literals',
2526
category: 'Possible Errors',

lib/rules/jsx-max-depth.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const docsUrl = require('../util/docsUrl');
1515
// ------------------------------------------------------------------------------
1616
module.exports = {
1717
meta: {
18+
type: 'suggestion',
1819
docs: {
1920
description: 'Validate JSX maximum depth',
2021
category: 'Stylistic Issues',

lib/rules/jsx-max-props-per-line.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const docsUrl = require('../util/docsUrl');
1313

1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Limit maximum of props on a single line in JSX',
1819
category: 'Stylistic Issues',
1920
recommended: false,
2021
url: docsUrl('jsx-max-props-per-line')
2122
},
22-
fixable: 'code',
23+
fixable: 'whitespace',
2324
schema: [{
2425
type: 'object',
2526
properties: {

lib/rules/jsx-no-bind.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const violationMessageStore = {
2525

2626
module.exports = {
2727
meta: {
28+
type: 'suggestion',
2829
docs: {
2930
description: 'Prevents usage of Function.prototype.bind and arrow functions in React component props',
3031
category: 'Best Practices',

lib/rules/jsx-no-comment-textnodes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function checkText(node, context) {
3131

3232
module.exports = {
3333
meta: {
34+
type: 'suggestion',
3435
docs: {
3536
description: 'Comments inside children section of tag should be placed inside braces',
3637
category: 'Possible Errors',

lib/rules/jsx-no-duplicate-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const docsUrl = require('../util/docsUrl');
1414

1515
module.exports = {
1616
meta: {
17+
type: 'problem',
1718
docs: {
1819
description: 'Enforce no duplicate props',
1920
category: 'Possible Errors',

lib/rules/jsx-no-literals.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function trimIfString(val) {
1818

1919
module.exports = {
2020
meta: {
21+
type: 'suggestion',
2122
docs: {
2223
description: 'Prevent using string literals in React component definition',
2324
category: 'Stylistic Issues',

lib/rules/jsx-no-script-url.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function shouldVerifyProp(node, config) {
4444

4545
module.exports = {
4646
meta: {
47+
type: 'suggestion',
4748
docs: {
4849
description: 'Forbid `javascript:` URLs',
4950
category: 'Best Practices',

lib/rules/jsx-no-target-blank.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function hasSecureRel(element, allowReferrer) {
6161

6262
module.exports = {
6363
meta: {
64+
type: 'suggestion',
6465
docs: {
6566
description: 'Forbid target="_blank" attribute without rel="noopener noreferrer"',
6667
category: 'Best Practices',

lib/rules/jsx-no-undef.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const jsxUtil = require('../util/jsx');
1414

1515
module.exports = {
1616
meta: {
17+
type: 'problem',
1718
docs: {
1819
description: 'Disallow undeclared variables in JSX',
1920
category: 'Possible Errors',

lib/rules/jsx-one-expression-per-line.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const optionDefaults = {
1818

1919
module.exports = {
2020
meta: {
21+
type: 'layout',
2122
docs: {
2223
description: 'Limit to one expression per line in JSX',
2324
category: 'Stylistic Issues',

lib/rules/jsx-pascal-case.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const ALL_CAPS_TAG_REGEX = XRegExp('^[\\p{Lu}0-9]+([\\p{Lu}0-9_]*[\\p{Lu}0-9]+)?
2626

2727
module.exports = {
2828
meta: {
29+
type: 'suggestion',
2930
docs: {
3031
description: 'Enforce PascalCase for user-defined JSX components',
3132
category: 'Stylistic Issues',

lib/rules/jsx-props-no-multi-spaces.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ const docsUrl = require('../util/docsUrl');
1313

1414
module.exports = {
1515
meta: {
16+
type: 'layout',
1617
docs: {
1718
description: 'Disallow multiple spaces between inline JSX props',
1819
category: 'Stylistic Issues',
1920
recommended: false,
2021
url: docsUrl('jsx-props-no-multi-spaces')
2122
},
22-
fixable: 'code',
23+
fixable: 'whitespace',
2324
schema: []
2425
},
2526

lib/rules/jsx-props-no-spreading.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const DEFAULTS = {
2525

2626
module.exports = {
2727
meta: {
28+
type: 'suggestion',
2829
docs: {
2930
description: 'Prevent JSX prop spreading',
3031
category: 'Best Practices',

lib/rules/jsx-sort-default-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const propWrapperUtil = require('../util/propWrapper');
1616

1717
module.exports = {
1818
meta: {
19+
type: 'suggestion',
1920
docs: {
2021
description: 'Enforce default props alphabetical sorting',
2122
category: 'Stylistic Issues',

0 commit comments

Comments
 (0)