Skip to content

Commit 07345b4

Browse files
authored
Merge pull request #1635 from Arcanemagus/rules-docs-url
Add URL to rule documentation to the metadata
2 parents c23d395 + bf544dc commit 07345b4

File tree

71 files changed

+244
-72
lines changed

Some content is hidden

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

71 files changed

+244
-72
lines changed

lib/rules/boolean-prop-naming.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const has = require('has');
88
const Components = require('../util/Components');
99
const propsUtil = require('../util/props');
10+
const docsUrl = require('../util/docsUrl');
1011

1112
// ------------------------------------------------------------------------------
1213
// Rule Definition
@@ -17,7 +18,8 @@ module.exports = {
1718
docs: {
1819
category: 'Stylistic Issues',
1920
description: 'Enforces consistent naming for boolean props',
20-
recommended: false
21+
recommended: false,
22+
url: docsUrl('boolean-prop-naming')
2123
},
2224

2325
schema: [{

lib/rules/button-has-type.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
const getProp = require('jsx-ast-utils/getProp');
88
const getLiteralPropValue = require('jsx-ast-utils/getLiteralPropValue');
9+
const docsUrl = require('../util/docsUrl');
910

1011
// ------------------------------------------------------------------------------
1112
// Helpers
@@ -27,7 +28,8 @@ module.exports = {
2728
docs: {
2829
description: 'Forbid "button" element without an explicit "type" attribute',
2930
category: 'Possible Errors',
30-
recommended: false
31+
recommended: false,
32+
url: docsUrl('button-has-type')
3133
},
3234
schema: [{
3335
type: 'object',

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const variableUtil = require('../util/variable');
1111
const annotations = require('../util/annotations');
1212
const astUtil = require('../util/ast');
1313
const propsUtil = require('../util/props');
14+
const docsUrl = require('../util/docsUrl');
1415

1516
// ------------------------------------------------------------------------------
1617
// Rule Definition
@@ -20,7 +21,8 @@ module.exports = {
2021
meta: {
2122
docs: {
2223
description: 'Enforce all defaultProps are defined and not "required" in propTypes.',
23-
category: 'Best Practices'
24+
category: 'Best Practices',
25+
url: docsUrl('default-props-match-prop-types')
2426
},
2527

2628
schema: [{

lib/rules/destructuring-assignment.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
'use strict';
55

66
const Components = require('../util/Components');
7+
const docsUrl = require('../util/docsUrl');
78

89
const DEFAULT_OPTION = 'always';
910

@@ -12,7 +13,8 @@ module.exports = {
1213
docs: {
1314
description: 'Enforce consistent usage of destructuring assignment of props, state, and context',
1415
category: 'Stylistic Issues',
15-
recommended: false
16+
recommended: false,
17+
url: docsUrl('destructuring-assignment')
1618
},
1719
schema: [{
1820
type: 'string',

lib/rules/display-name.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
const has = require('has');
88
const Components = require('../util/Components');
9+
const docsUrl = require('../util/docsUrl');
910

1011
// ------------------------------------------------------------------------------
1112
// Rule Definition
@@ -16,7 +17,8 @@ module.exports = {
1617
docs: {
1718
description: 'Prevent missing displayName in a React component definition',
1819
category: 'Best Practices',
19-
recommended: true
20+
recommended: true,
21+
url: docsUrl('display-name')
2022
},
2123

2224
schema: [{

lib/rules/forbid-component-props.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Constants
911
// ------------------------------------------------------------------------------
@@ -19,7 +21,8 @@ module.exports = {
1921
docs: {
2022
description: 'Forbid certain props on components',
2123
category: 'Best Practices',
22-
recommended: false
24+
recommended: false,
25+
url: docsUrl('forbid-component-props')
2326
},
2427

2528
schema: [{

lib/rules/forbid-dom-props.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Constants
911
// ------------------------------------------------------------------------------
@@ -19,7 +21,8 @@ module.exports = {
1921
docs: {
2022
description: 'Forbid certain props on DOM Nodes',
2123
category: 'Best Practices',
22-
recommended: false
24+
recommended: false,
25+
url: docsUrl('forbid-dom-props')
2326
},
2427

2528
schema: [{

lib/rules/forbid-elements.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict';
66

77
const has = require('has');
8+
const docsUrl = require('../util/docsUrl');
89

910
// ------------------------------------------------------------------------------
1011
// Rule Definition
@@ -15,7 +16,8 @@ module.exports = {
1516
docs: {
1617
description: 'Forbid certain elements',
1718
category: 'Best Practices',
18-
recommended: false
19+
recommended: false,
20+
url: docsUrl('forbid-elements')
1921
},
2022

2123
schema: [{

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Constants
911
// ------------------------------------------------------------------------------
@@ -18,7 +20,8 @@ module.exports = {
1820
docs: {
1921
description: 'Forbid using another component\'s propTypes',
2022
category: 'Best Practices',
21-
recommended: false
23+
recommended: false,
24+
url: docsUrl('forbid-foreign-prop-types')
2225
}
2326
},
2427

lib/rules/forbid-prop-types.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
const variableUtil = require('../util/variable');
77
const propsUtil = require('../util/props');
88
const astUtil = require('../util/ast');
9+
const docsUrl = require('../util/docsUrl');
910

1011
// ------------------------------------------------------------------------------
1112
// Constants
@@ -22,7 +23,8 @@ module.exports = {
2223
docs: {
2324
description: 'Forbid certain propTypes',
2425
category: 'Best Practices',
25-
recommended: false
26+
recommended: false,
27+
url: docsUrl('forbid-prop-types')
2628
},
2729

2830
schema: [{

lib/rules/jsx-boolean-value.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Rule Definition
911
// ------------------------------------------------------------------------------
@@ -48,7 +50,8 @@ module.exports = {
4850
docs: {
4951
description: 'Enforce boolean attributes notation in JSX',
5052
category: 'Stylistic Issues',
51-
recommended: false
53+
recommended: false,
54+
url: docsUrl('jsx-boolean-value')
5255
},
5356
fixable: 'code',
5457

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict';
66

77
const has = require('has');
8+
const docsUrl = require('../util/docsUrl');
89

910
// ------------------------------------------------------------------------------
1011
// Rule Definition
@@ -14,7 +15,8 @@ module.exports = {
1415
docs: {
1516
description: 'Validate closing bracket location in JSX',
1617
category: 'Stylistic Issues',
17-
recommended: false
18+
recommended: false,
19+
url: docsUrl('jsx-closing-bracket-location')
1820
},
1921
fixable: 'code',
2022

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict';
66

77
const astUtil = require('../util/ast');
8+
const docsUrl = require('../util/docsUrl');
89

910
// ------------------------------------------------------------------------------
1011
// Rule Definition
@@ -14,7 +15,8 @@ module.exports = {
1415
docs: {
1516
description: 'Validate closing tag location for multiline JSX',
1617
category: 'Stylistic Issues',
17-
recommended: false
18+
recommended: false,
19+
url: docsUrl('jsx-closing-tag-location')
1820
},
1921
fixable: 'whitespace'
2022
},

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
'use strict';
77

8+
const docsUrl = require('../util/docsUrl');
9+
810
// ------------------------------------------------------------------------------
911
// Constants
1012
// ------------------------------------------------------------------------------
@@ -31,7 +33,8 @@ module.exports = {
3133
'Disallow unnecessary JSX expressions when literals alone are sufficient ' +
3234
'or enfore JSX expressions on literals in JSX children or attributes',
3335
category: 'Stylistic Issues',
34-
recommended: false
36+
recommended: false,
37+
url: docsUrl('jsx-curly-brace-presence')
3538
},
3639
fixable: 'code',
3740

lib/rules/jsx-curly-spacing.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'use strict';
1212

1313
const has = require('has');
14+
const docsUrl = require('../util/docsUrl');
1415

1516
// ------------------------------------------------------------------------------
1617
// Rule Definition
@@ -27,7 +28,8 @@ module.exports = {
2728
docs: {
2829
description: 'Enforce or disallow spaces inside of curly braces in JSX attributes',
2930
category: 'Stylistic Issues',
30-
recommended: false
31+
recommended: false,
32+
url: docsUrl('jsx-curly-spacing')
3133
},
3234
fixable: 'code',
3335

lib/rules/jsx-equals-spacing.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Rule Definition
911
// ------------------------------------------------------------------------------
@@ -13,7 +15,8 @@ module.exports = {
1315
docs: {
1416
description: 'Disallow or enforce spaces around equal signs in JSX attributes',
1517
category: 'Stylistic Issues',
16-
recommended: false
18+
recommended: false,
19+
url: docsUrl('jsx-equals-spacing')
1720
},
1821
fixable: 'code',
1922

lib/rules/jsx-filename-extension.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'use strict';
66

77
const path = require('path');
8+
const docsUrl = require('../util/docsUrl');
89

910
// ------------------------------------------------------------------------------
1011
// Constants
@@ -23,7 +24,8 @@ module.exports = {
2324
docs: {
2425
description: 'Restrict file extensions that may contain JSX',
2526
category: 'Stylistic Issues',
26-
recommended: false
27+
recommended: false,
28+
url: docsUrl('jsx-filename-extension')
2729
},
2830

2931
schema: [{

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Rule Definition
911
// ------------------------------------------------------------------------------
@@ -13,7 +15,8 @@ module.exports = {
1315
docs: {
1416
description: 'Ensure proper position of the first property in JSX',
1517
category: 'Stylistic Issues',
16-
recommended: false
18+
recommended: false,
19+
url: docsUrl('jsx-first-prop-new-line')
1720
},
1821
fixable: 'code',
1922

lib/rules/jsx-handler-names.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
'use strict';
66

7+
const docsUrl = require('../util/docsUrl');
8+
79
// ------------------------------------------------------------------------------
810
// Rule Definition
911
// ------------------------------------------------------------------------------
@@ -13,7 +15,8 @@ module.exports = {
1315
docs: {
1416
description: 'Enforce event handler naming conventions in JSX',
1517
category: 'Stylistic Issues',
16-
recommended: false
18+
recommended: false,
19+
url: docsUrl('jsx-handler-names')
1720
},
1821

1922
schema: [{

lib/rules/jsx-indent-props.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'use strict';
3131

3232
const astUtil = require('../util/ast');
33+
const docsUrl = require('../util/docsUrl');
3334

3435
// ------------------------------------------------------------------------------
3536
// Rule Definition
@@ -39,7 +40,8 @@ module.exports = {
3940
docs: {
4041
description: 'Validate props indentation in JSX',
4142
category: 'Stylistic Issues',
42-
recommended: false
43+
recommended: false,
44+
url: docsUrl('jsx-indent-props')
4345
},
4446
fixable: 'code',
4547

lib/rules/jsx-indent.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'use strict';
3131

3232
const astUtil = require('../util/ast');
33+
const docsUrl = require('../util/docsUrl');
3334

3435
// ------------------------------------------------------------------------------
3536
// Rule Definition
@@ -39,7 +40,8 @@ module.exports = {
3940
docs: {
4041
description: 'Validate JSX indentation',
4142
category: 'Stylistic Issues',
42-
recommended: false
43+
recommended: false,
44+
url: docsUrl('jsx-indent')
4345
},
4446
fixable: 'whitespace',
4547
schema: [{

0 commit comments

Comments
 (0)