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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 3 additions & 1 deletion
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: [{

0 commit comments

Comments
 (0)