Docs: add url to each of the rules (refs #6582) (#9788)
* Docs: add url to each of the rules (refs #6582)
Code mod:
export default function transformer(file, api) {
const j = api.jscodeshift;
const name = file.path.split('/').pop().replace(/.js$/, '');
return j(file.source)
.find(j.ObjectExpression)
.filter(path => path.parentPath.node.key && path.parentPath.node.key.name === 'docs')
.forEach(path => {
const prop = j.property('init', j.identifier('url'), j.literal(`https://eslint.org/docs/rules/${name}`));
j(path).replaceWith(j.objectExpression([...path.node.properties, prop]));
})
.toSource({lineTerminator: '\n'});
}
* New: internal-rules/consistent-docs-url (refs #6582)
Add a lint rule to ensure that each rule has a meta.docs.url property with the correct value.
Patrick McElhaney authored 6 years ago
Ilya Volodin committed 6 years ago
0 | 0 | rules: |
1 | 1 | rulesdir/no-invalid-meta: "error" |
2 | 2 | rulesdir/consistent-docs-description: "error" |
3 | rulesdir/consistent-docs-url: "error" |
74 | 74 | docs: { |
75 | 75 | description: "enforce getter and setter pairs in objects", |
76 | 76 | category: "Best Practices", |
77 | recommended: false | |
77 | recommended: false, | |
78 | url: "https://eslint.org/docs/rules/accessor-pairs" | |
78 | 79 | }, |
79 | 80 | schema: [{ |
80 | 81 | type: "object", |
15 | 15 | docs: { |
16 | 16 | description: "enforce linebreaks after opening and before closing array brackets", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/array-bracket-newline" | |
19 | 20 | }, |
20 | 21 | fixable: "whitespace", |
21 | 22 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "enforce consistent spacing inside array brackets", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/array-bracket-spacing" | |
18 | 19 | }, |
19 | 20 | fixable: "whitespace", |
20 | 21 | schema: [ |
141 | 141 | docs: { |
142 | 142 | description: "enforce `return` statements in callbacks of array methods", |
143 | 143 | category: "Best Practices", |
144 | recommended: false | |
144 | recommended: false, | |
145 | url: "https://eslint.org/docs/rules/array-callback-return" | |
145 | 146 | }, |
146 | 147 | |
147 | 148 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "enforce line breaks after each array element", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/array-element-newline" | |
19 | 20 | }, |
20 | 21 | fixable: "whitespace", |
21 | 22 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "require braces around arrow function bodies", |
20 | 20 | category: "ECMAScript 6", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/arrow-body-style" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: { |
18 | 18 | docs: { |
19 | 19 | description: "require parentheses around arrow function arguments", |
20 | 20 | category: "ECMAScript 6", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/arrow-parens" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "code", |
18 | 18 | docs: { |
19 | 19 | description: "enforce consistent spacing before and after the arrow in arrow functions", |
20 | 20 | category: "ECMAScript 6", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/arrow-spacing" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "whitespace", |
12 | 12 | docs: { |
13 | 13 | description: "enforce the use of variables within the scope they are defined", |
14 | 14 | category: "Best Practices", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/block-scoped-var" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow or enforce spaces inside of blocks after opening block and before closing block", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/block-spacing" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | fixable: "whitespace", |
15 | 15 | docs: { |
16 | 16 | description: "enforce consistent brace style for blocks", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/brace-style" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "require `return` statements after callbacks", |
14 | 14 | category: "Node.js and CommonJS", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/callback-return" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [{ |
13 | 13 | docs: { |
14 | 14 | description: "enforce camelcase naming convention", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/camelcase" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
112 | 112 | docs: { |
113 | 113 | description: "enforce or disallow capitalization of the first letter of a comment", |
114 | 114 | category: "Stylistic Issues", |
115 | recommended: false | |
115 | recommended: false, | |
116 | url: "https://eslint.org/docs/rules/capitalized-comments" | |
116 | 117 | }, |
117 | 118 | fixable: "code", |
118 | 119 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "enforce that class methods utilize `this`", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/class-methods-use-this" | |
17 | 18 | }, |
18 | 19 | schema: [{ |
19 | 20 | type: "object", |
78 | 78 | docs: { |
79 | 79 | description: "require or disallow trailing commas", |
80 | 80 | category: "Stylistic Issues", |
81 | recommended: false | |
81 | recommended: false, | |
82 | url: "https://eslint.org/docs/rules/comma-dangle" | |
82 | 83 | }, |
83 | 84 | fixable: "code", |
84 | 85 | schema: { |
14 | 14 | docs: { |
15 | 15 | description: "enforce consistent spacing before and after commas", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/comma-spacing" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "whitespace", |
15 | 15 | docs: { |
16 | 16 | description: "enforce consistent comma style", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/comma-style" | |
19 | 20 | }, |
20 | 21 | fixable: "code", |
21 | 22 | schema: [ |
22 | 22 | docs: { |
23 | 23 | description: "enforce a maximum cyclomatic complexity allowed in a program", |
24 | 24 | category: "Best Practices", |
25 | recommended: false | |
25 | recommended: false, | |
26 | url: "https://eslint.org/docs/rules/complexity" | |
26 | 27 | }, |
27 | 28 | |
28 | 29 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "enforce consistent spacing inside computed property brackets", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/computed-property-spacing" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "whitespace", |
55 | 55 | docs: { |
56 | 56 | description: "require `return` statements to either always or never specify values", |
57 | 57 | category: "Best Practices", |
58 | recommended: false | |
58 | recommended: false, | |
59 | url: "https://eslint.org/docs/rules/consistent-return" | |
59 | 60 | }, |
60 | 61 | |
61 | 62 | schema: [{ |
12 | 12 | docs: { |
13 | 13 | description: "enforce consistent naming when capturing the current execution context", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/consistent-this" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: { |
94 | 94 | docs: { |
95 | 95 | description: "require `super()` calls in constructors", |
96 | 96 | category: "ECMAScript 6", |
97 | recommended: true | |
97 | recommended: true, | |
98 | url: "https://eslint.org/docs/rules/constructor-super" | |
98 | 99 | }, |
99 | 100 | |
100 | 101 | schema: [] |
18 | 18 | docs: { |
19 | 19 | description: "enforce consistent brace style for all control statements", |
20 | 20 | category: "Best Practices", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/curly" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: { |
14 | 14 | docs: { |
15 | 15 | description: "require `default` cases in `switch` statements", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/default-case" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [{ |
15 | 15 | docs: { |
16 | 16 | description: "enforce consistent newlines before and after dots", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/dot-location" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [ |
21 | 21 | docs: { |
22 | 22 | description: "enforce dot notation whenever possible", |
23 | 23 | category: "Best Practices", |
24 | recommended: false | |
24 | recommended: false, | |
25 | url: "https://eslint.org/docs/rules/dot-notation" | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "require or disallow newline at the end of files", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/eol-last" | |
22 | 23 | }, |
23 | 24 | fixable: "whitespace", |
24 | 25 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "require the use of `===` and `!==`", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/eqeqeq" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: { |
13 | 13 | docs: { |
14 | 14 | description: "enforce \"for\" loop update clause moving the counter in the right direction.", |
15 | 15 | category: "Possible Errors", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/for-direction" | |
17 | 18 | }, |
18 | 19 | fixable: null, |
19 | 20 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "require or disallow spacing between function identifiers and their invocations", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/func-call-spacing" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | fixable: "whitespace", |
69 | 69 | docs: { |
70 | 70 | description: "require function names to match the name of the variable or property to which they are assigned", |
71 | 71 | category: "Stylistic Issues", |
72 | recommended: false | |
72 | recommended: false, | |
73 | url: "https://eslint.org/docs/rules/func-name-matching" | |
73 | 74 | }, |
74 | 75 | |
75 | 76 | schema: { |
28 | 28 | docs: { |
29 | 29 | description: "require or disallow named `function` expressions", |
30 | 30 | category: "Stylistic Issues", |
31 | recommended: false | |
31 | recommended: false, | |
32 | url: "https://eslint.org/docs/rules/func-names" | |
32 | 33 | }, |
33 | 34 | |
34 | 35 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "enforce the consistent use of either `function` declarations or expressions", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/func-style" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "enforce consistent line breaks inside function parentheses", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/function-paren-newline" | |
22 | 23 | }, |
23 | 24 | fixable: "whitespace", |
24 | 25 | schema: [ |
29 | 29 | docs: { |
30 | 30 | description: "enforce consistent spacing around `*` operators in generator functions", |
31 | 31 | category: "ECMAScript 6", |
32 | recommended: false | |
32 | recommended: false, | |
33 | url: "https://eslint.org/docs/rules/generator-star-spacing" | |
33 | 34 | }, |
34 | 35 | |
35 | 36 | fixable: "whitespace", |
46 | 46 | docs: { |
47 | 47 | description: "enforce `return` statements in getters", |
48 | 48 | category: "Possible Errors", |
49 | recommended: false | |
49 | recommended: false, | |
50 | url: "https://eslint.org/docs/rules/getter-return" | |
50 | 51 | }, |
51 | 52 | fixable: null, |
52 | 53 | schema: [ |
50 | 50 | docs: { |
51 | 51 | description: "require `require()` calls to be placed at top-level module scope", |
52 | 52 | category: "Node.js and CommonJS", |
53 | recommended: false | |
53 | recommended: false, | |
54 | url: "https://eslint.org/docs/rules/global-require" | |
54 | 55 | }, |
55 | 56 | |
56 | 57 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "require `for-in` loops to include an `if` statement", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/guard-for-in" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "require error handling in callbacks", |
15 | 15 | category: "Node.js and CommonJS", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/handle-callback-err" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "disallow specified identifiers", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/id-blacklist" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: { |
14 | 14 | docs: { |
15 | 15 | description: "enforce minimum and maximum identifier lengths", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/id-length" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "require identifiers to match a specified regular expression", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/id-match" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
11 | 11 | docs: { |
12 | 12 | description: "enforce the location of arrow function bodies", |
13 | 13 | category: "Stylistic Issues", |
14 | recommended: false | |
14 | recommended: false, | |
15 | url: "https://eslint.org/docs/rules/implicit-arrow-linebreak" | |
15 | 16 | }, |
16 | 17 | fixable: "whitespace", |
17 | 18 | schema: [ |
24 | 24 | description: "enforce consistent indentation", |
25 | 25 | category: "Stylistic Issues", |
26 | 26 | recommended: false, |
27 | replacedBy: ["indent"] | |
27 | replacedBy: ["indent"], | |
28 | url: "https://eslint.org/docs/rules/indent-legacy" | |
28 | 29 | }, |
29 | 30 | |
30 | 31 | deprecated: true, |
491 | 491 | docs: { |
492 | 492 | description: "enforce consistent indentation", |
493 | 493 | category: "Stylistic Issues", |
494 | recommended: false | |
494 | recommended: false, | |
495 | url: "https://eslint.org/docs/rules/indent" | |
495 | 496 | }, |
496 | 497 | |
497 | 498 | fixable: "whitespace", |
46 | 46 | docs: { |
47 | 47 | description: "require or disallow initialization in variable declarations", |
48 | 48 | category: "Variables", |
49 | recommended: false | |
49 | recommended: false, | |
50 | url: "https://eslint.org/docs/rules/init-declarations" | |
50 | 51 | }, |
51 | 52 | |
52 | 53 | schema: { |
40 | 40 | docs: { |
41 | 41 | description: "enforce the consistent use of either double or single quotes in JSX attributes", |
42 | 42 | category: "Stylistic Issues", |
43 | recommended: false | |
43 | recommended: false, | |
44 | url: "https://eslint.org/docs/rules/jsx-quotes" | |
44 | 45 | }, |
45 | 46 | |
46 | 47 | fixable: "whitespace", |
130 | 130 | docs: { |
131 | 131 | description: "enforce consistent spacing between keys and values in object literal properties", |
132 | 132 | category: "Stylistic Issues", |
133 | recommended: false | |
133 | recommended: false, | |
134 | url: "https://eslint.org/docs/rules/key-spacing" | |
134 | 135 | }, |
135 | 136 | |
136 | 137 | fixable: "whitespace", |
67 | 67 | docs: { |
68 | 68 | description: "enforce consistent spacing before and after keywords", |
69 | 69 | category: "Stylistic Issues", |
70 | recommended: false | |
70 | recommended: false, | |
71 | url: "https://eslint.org/docs/rules/keyword-spacing" | |
71 | 72 | }, |
72 | 73 | |
73 | 74 | fixable: "whitespace", |
14 | 14 | docs: { |
15 | 15 | description: "enforce position of line comments", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/line-comment-position" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "enforce consistent linebreak style", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/linebreak-style" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | fixable: "whitespace", |
54 | 54 | docs: { |
55 | 55 | description: "require empty lines around comments", |
56 | 56 | category: "Stylistic Issues", |
57 | recommended: false | |
57 | recommended: false, | |
58 | url: "https://eslint.org/docs/rules/lines-around-comment" | |
58 | 59 | }, |
59 | 60 | |
60 | 61 | fixable: "whitespace", |
17 | 17 | description: "require or disallow newlines around directives", |
18 | 18 | category: "Stylistic Issues", |
19 | 19 | recommended: false, |
20 | replacedBy: ["padding-line-between-statements"] | |
20 | replacedBy: ["padding-line-between-statements"], | |
21 | url: "https://eslint.org/docs/rules/lines-around-directive" | |
21 | 22 | }, |
22 | 23 | schema: [{ |
23 | 24 | oneOf: [ |
14 | 14 | docs: { |
15 | 15 | description: "require or disallow an empty line between class members", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/lines-between-class-members" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "whitespace", |
13 | 13 | docs: { |
14 | 14 | description: "enforce a maximum depth that blocks can be nested", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/max-depth" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
67 | 67 | docs: { |
68 | 68 | description: "enforce a maximum line length", |
69 | 69 | category: "Stylistic Issues", |
70 | recommended: false | |
70 | recommended: false, | |
71 | url: "https://eslint.org/docs/rules/max-len" | |
71 | 72 | }, |
72 | 73 | |
73 | 74 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "enforce a maximum number of lines per file", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/max-lines" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "enforce a maximum depth that callbacks can be nested", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/max-nested-callbacks" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
21 | 21 | docs: { |
22 | 22 | description: "enforce a maximum number of parameters in function definitions", |
23 | 23 | category: "Stylistic Issues", |
24 | recommended: false | |
24 | recommended: false, | |
25 | url: "https://eslint.org/docs/rules/max-params" | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "enforce a maximum number of statements allowed per line", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/max-statements-per-line" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [ |
21 | 21 | docs: { |
22 | 22 | description: "enforce a maximum number of statements allowed in function blocks", |
23 | 23 | category: "Stylistic Issues", |
24 | recommended: false | |
24 | recommended: false, | |
25 | url: "https://eslint.org/docs/rules/max-statements" | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "enforce a particular style for multiline comments", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/multiline-comment-style" | |
18 | 19 | }, |
19 | 20 | fixable: "whitespace", |
20 | 21 | schema: [{ enum: ["starred-block", "separate-lines", "bare-block"] }] |
15 | 15 | docs: { |
16 | 16 | description: "enforce newlines between operands of ternary expressions", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/multiline-ternary" | |
19 | 20 | }, |
20 | 21 | schema: [ |
21 | 22 | { |
76 | 76 | docs: { |
77 | 77 | description: "require constructor names to begin with a capital letter", |
78 | 78 | category: "Stylistic Issues", |
79 | recommended: false | |
79 | recommended: false, | |
80 | url: "https://eslint.org/docs/rules/new-cap" | |
80 | 81 | }, |
81 | 82 | |
82 | 83 | schema: [ |
23 | 23 | docs: { |
24 | 24 | description: "require parentheses when invoking a constructor with no arguments", |
25 | 25 | category: "Stylistic Issues", |
26 | recommended: false | |
26 | recommended: false, | |
27 | url: "https://eslint.org/docs/rules/new-parens" | |
27 | 28 | }, |
28 | 29 | |
29 | 30 | schema: [], |
21 | 21 | description: "require or disallow an empty line after variable declarations", |
22 | 22 | category: "Stylistic Issues", |
23 | 23 | recommended: false, |
24 | replacedBy: ["padding-line-between-statements"] | |
24 | replacedBy: ["padding-line-between-statements"], | |
25 | url: "https://eslint.org/docs/rules/newline-after-var" | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | schema: [ |
14 | 14 | description: "require an empty line before `return` statements", |
15 | 15 | category: "Stylistic Issues", |
16 | 16 | recommended: false, |
17 | replacedBy: ["padding-line-between-statements"] | |
17 | replacedBy: ["padding-line-between-statements"], | |
18 | url: "https://eslint.org/docs/rules/newline-before-return" | |
18 | 19 | }, |
19 | 20 | fixable: "whitespace", |
20 | 21 | schema: [], |
16 | 16 | docs: { |
17 | 17 | description: "require a newline after each call in a method chain", |
18 | 18 | category: "Stylistic Issues", |
19 | recommended: false | |
19 | recommended: false, | |
20 | url: "https://eslint.org/docs/rules/newline-per-chained-call" | |
20 | 21 | }, |
21 | 22 | fixable: "whitespace", |
22 | 23 | schema: [{ |
87 | 87 | docs: { |
88 | 88 | description: "disallow the use of `alert`, `confirm`, and `prompt`", |
89 | 89 | category: "Best Practices", |
90 | recommended: false | |
90 | recommended: false, | |
91 | url: "https://eslint.org/docs/rules/no-alert" | |
91 | 92 | }, |
92 | 93 | |
93 | 94 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `Array` constructors", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-array-constructor" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
27 | 27 | docs: { |
28 | 28 | description: "disallow `await` inside of loops", |
29 | 29 | category: "Possible Errors", |
30 | recommended: false | |
30 | recommended: false, | |
31 | url: "https://eslint.org/docs/rules/no-await-in-loop" | |
31 | 32 | }, |
32 | 33 | schema: [] |
33 | 34 | }, |
24 | 24 | docs: { |
25 | 25 | description: "disallow bitwise operators", |
26 | 26 | category: "Stylistic Issues", |
27 | recommended: false | |
27 | recommended: false, | |
28 | url: "https://eslint.org/docs/rules/no-bitwise" | |
28 | 29 | }, |
29 | 30 | |
30 | 31 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow use of the Buffer() constructor", |
14 | 14 | category: "Node.js and CommonJS", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-buffer-constructor" | |
16 | 17 | }, |
17 | 18 | schema: [] |
18 | 19 | }, |
13 | 13 | docs: { |
14 | 14 | description: "disallow the use of `arguments.caller` or `arguments.callee`", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-caller" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow lexical declarations in case clauses", |
14 | 14 | category: "Best Practices", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/no-case-declarations" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "disallow `catch` clause parameters from shadowing variables in the outer scope", |
21 | 21 | category: "Variables", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-catch-shadow" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow reassigning class members", |
17 | 17 | category: "ECMAScript 6", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-class-assign" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow comparing against -0", |
14 | 14 | category: "Possible Errors", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/no-compare-neg-zero" | |
16 | 17 | }, |
17 | 18 | fixable: null, |
18 | 19 | schema: [] |
21 | 21 | docs: { |
22 | 22 | description: "disallow assignment operators in conditional expressions", |
23 | 23 | category: "Possible Errors", |
24 | recommended: true | |
24 | recommended: true, | |
25 | url: "https://eslint.org/docs/rules/no-cond-assign" | |
25 | 26 | }, |
26 | 27 | |
27 | 28 | schema: [ |
29 | 29 | docs: { |
30 | 30 | description: "disallow arrow functions where they could be confused with comparisons", |
31 | 31 | category: "ECMAScript 6", |
32 | recommended: false | |
32 | recommended: false, | |
33 | url: "https://eslint.org/docs/rules/no-confusing-arrow" | |
33 | 34 | }, |
34 | 35 | |
35 | 36 | fixable: "code", |
19 | 19 | docs: { |
20 | 20 | description: "disallow the use of `console`", |
21 | 21 | category: "Possible Errors", |
22 | recommended: true | |
22 | recommended: true, | |
23 | url: "https://eslint.org/docs/rules/no-console" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "disallow reassigning `const` variables", |
17 | 17 | category: "ECMAScript 6", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-const-assign" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow constant expressions in conditions", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-constant-condition" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "disallow `continue` statements", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-continue" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow control characters in regular expressions", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-control-regex" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow the use of `debugger`", |
17 | 17 | category: "Possible Errors", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-debugger" | |
19 | 20 | }, |
20 | 21 | fixable: "code", |
21 | 22 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow deleting variables", |
15 | 15 | category: "Variables", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-delete-var" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow division operators explicitly at the beginning of regular expressions", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-div-regex" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow duplicate arguments in `function` definitions", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-dupe-args" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow duplicate class members", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-dupe-class-members" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
86 | 86 | docs: { |
87 | 87 | description: "disallow duplicate keys in object literals", |
88 | 88 | category: "Possible Errors", |
89 | recommended: true | |
89 | recommended: true, | |
90 | url: "https://eslint.org/docs/rules/no-dupe-keys" | |
90 | 91 | }, |
91 | 92 | |
92 | 93 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "disallow duplicate case labels", |
16 | 16 | category: "Possible Errors", |
17 | recommended: true | |
17 | recommended: true, | |
18 | url: "https://eslint.org/docs/rules/no-duplicate-case" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [] |
103 | 103 | docs: { |
104 | 104 | description: "disallow duplicate module imports", |
105 | 105 | category: "ECMAScript 6", |
106 | recommended: false | |
106 | recommended: false, | |
107 | url: "https://eslint.org/docs/rules/no-duplicate-imports" | |
107 | 108 | }, |
108 | 109 | |
109 | 110 | schema: [{ |
20 | 20 | docs: { |
21 | 21 | description: "disallow `else` blocks after `return` statements in `if` statements", |
22 | 22 | category: "Best Practices", |
23 | recommended: false | |
23 | recommended: false, | |
24 | url: "https://eslint.org/docs/rules/no-else-return" | |
24 | 25 | }, |
25 | 26 | |
26 | 27 | schema: [{ |
31 | 31 | docs: { |
32 | 32 | description: "disallow empty character classes in regular expressions", |
33 | 33 | category: "Possible Errors", |
34 | recommended: true | |
34 | recommended: true, | |
35 | url: "https://eslint.org/docs/rules/no-empty-character-class" | |
35 | 36 | }, |
36 | 37 | |
37 | 38 | schema: [] |
92 | 92 | docs: { |
93 | 93 | description: "disallow empty functions", |
94 | 94 | category: "Best Practices", |
95 | recommended: false | |
95 | recommended: false, | |
96 | url: "https://eslint.org/docs/rules/no-empty-function" | |
96 | 97 | }, |
97 | 98 | |
98 | 99 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow empty destructuring patterns", |
14 | 14 | category: "Best Practices", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/no-empty-pattern" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
18 | 18 | docs: { |
19 | 19 | description: "disallow empty block statements", |
20 | 20 | category: "Possible Errors", |
21 | recommended: true | |
21 | recommended: true, | |
22 | url: "https://eslint.org/docs/rules/no-empty" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "disallow `null` comparisons without type-checking operators", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-eq-null" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [] |
78 | 78 | docs: { |
79 | 79 | description: "disallow the use of `eval()`", |
80 | 80 | category: "Best Practices", |
81 | recommended: false | |
81 | recommended: false, | |
82 | url: "https://eslint.org/docs/rules/no-eval" | |
82 | 83 | }, |
83 | 84 | |
84 | 85 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "disallow reassigning exceptions in `catch` clauses", |
17 | 17 | category: "Possible Errors", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-ex-assign" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
26 | 26 | docs: { |
27 | 27 | description: "disallow extending native types", |
28 | 28 | category: "Best Practices", |
29 | recommended: false | |
29 | recommended: false, | |
30 | url: "https://eslint.org/docs/rules/no-extend-native" | |
30 | 31 | }, |
31 | 32 | |
32 | 33 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "disallow unnecessary calls to `.bind()`", |
20 | 20 | category: "Best Practices", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/no-extra-bind" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [], |
19 | 19 | docs: { |
20 | 20 | description: "disallow unnecessary boolean casts", |
21 | 21 | category: "Possible Errors", |
22 | recommended: true | |
22 | recommended: true, | |
23 | url: "https://eslint.org/docs/rules/no-extra-boolean-cast" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [], |
19 | 19 | docs: { |
20 | 20 | description: "disallow unnecessary labels", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-extra-label" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [], |
14 | 14 | docs: { |
15 | 15 | description: "disallow unnecessary parentheses", |
16 | 16 | category: "Possible Errors", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-extra-parens" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "code", |
20 | 20 | docs: { |
21 | 21 | description: "disallow unnecessary semicolons", |
22 | 22 | category: "Possible Errors", |
23 | recommended: true | |
23 | recommended: true, | |
24 | url: "https://eslint.org/docs/rules/no-extra-semi" | |
24 | 25 | }, |
25 | 26 | |
26 | 27 | fixable: "code", |
57 | 57 | docs: { |
58 | 58 | description: "disallow fallthrough of `case` statements", |
59 | 59 | category: "Best Practices", |
60 | recommended: true | |
60 | recommended: true, | |
61 | url: "https://eslint.org/docs/rules/no-fallthrough" | |
61 | 62 | }, |
62 | 63 | |
63 | 64 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "disallow leading or trailing decimal points in numeric literals", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-floating-decimal" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [], |
15 | 15 | docs: { |
16 | 16 | description: "disallow reassigning `function` declarations", |
17 | 17 | category: "Possible Errors", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-func-assign" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow assignments to native objects or read-only global variables", |
15 | 15 | category: "Best Practices", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-global-assign" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
155 | 155 | docs: { |
156 | 156 | description: "disallow shorthand type conversions", |
157 | 157 | category: "Best Practices", |
158 | recommended: false | |
158 | recommended: false, | |
159 | url: "https://eslint.org/docs/rules/no-implicit-coercion" | |
159 | 160 | }, |
160 | 161 | |
161 | 162 | fixable: "code", |
13 | 13 | docs: { |
14 | 14 | description: "disallow variable and `function` declarations in the global scope", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-implicit-globals" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow the use of `eval()`-like methods", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-implied-eval" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "disallow inline comments after code", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-inline-comments" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow variable or `function` declarations in nested blocks", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-inner-declarations" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "disallow invalid regular expression strings in `RegExp` constructors", |
20 | 20 | category: "Possible Errors", |
21 | recommended: true | |
21 | recommended: true, | |
22 | url: "https://eslint.org/docs/rules/no-invalid-regexp" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [{ |
19 | 19 | docs: { |
20 | 20 | description: "disallow `this` keywords outside of classes or class-like objects", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-invalid-this" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [] |
29 | 29 | docs: { |
30 | 30 | description: "disallow irregular whitespace outside of strings and comments", |
31 | 31 | category: "Possible Errors", |
32 | recommended: true | |
32 | recommended: true, | |
33 | url: "https://eslint.org/docs/rules/no-irregular-whitespace" | |
33 | 34 | }, |
34 | 35 | |
35 | 36 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "disallow the use of the `__iterator__` property", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-iterator" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "disallow labels that share a name with a variable", |
21 | 21 | category: "Variables", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-label-var" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [] |
18 | 18 | docs: { |
19 | 19 | description: "disallow labeled statements", |
20 | 20 | category: "Best Practices", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/no-labels" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "disallow unnecessary nested blocks", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-lone-blocks" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow `if` statements as the only statement in `else` blocks", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-lonely-if" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [], |
158 | 158 | docs: { |
159 | 159 | description: "disallow `function` declarations and expressions inside loop statements", |
160 | 160 | category: "Best Practices", |
161 | recommended: false | |
161 | recommended: false, | |
162 | url: "https://eslint.org/docs/rules/no-loop-func" | |
162 | 163 | }, |
163 | 164 | |
164 | 165 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow magic numbers", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-magic-numbers" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [{ |
73 | 73 | docs: { |
74 | 74 | description: "disallow mixed binary operators", |
75 | 75 | category: "Stylistic Issues", |
76 | recommended: false | |
76 | recommended: false, | |
77 | url: "https://eslint.org/docs/rules/no-mixed-operators" | |
77 | 78 | }, |
78 | 79 | schema: [ |
79 | 80 | { |
13 | 13 | docs: { |
14 | 14 | description: "disallow `require` calls to be mixed with regular variable declarations", |
15 | 15 | category: "Node.js and CommonJS", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-mixed-requires" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow mixed spaces and tabs for indentation", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/no-mixed-spaces-and-tabs" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "disallow use of chained assignment expressions", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-multi-assign" | |
18 | 19 | }, |
19 | 20 | schema: [] |
20 | 21 | }, |
15 | 15 | docs: { |
16 | 16 | description: "disallow multiple spaces", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-multi-spaces" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | fixable: "whitespace", |
19 | 19 | docs: { |
20 | 20 | description: "disallow multiline strings", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-multi-str" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow multiple empty lines", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-multiple-empty-lines" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | fixable: "whitespace", |
15 | 15 | description: "disallow assignments to native objects or read-only global variables", |
16 | 16 | category: "Best Practices", |
17 | 17 | recommended: false, |
18 | replacedBy: ["no-global-assign"] | |
18 | replacedBy: ["no-global-assign"], | |
19 | url: "https://eslint.org/docs/rules/no-native-reassign" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | deprecated: true, |
12 | 12 | docs: { |
13 | 13 | description: "disallow negated conditions", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-negated-condition" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
15 | 15 | description: "disallow negating the left operand in `in` expressions", |
16 | 16 | category: "Possible Errors", |
17 | 17 | recommended: false, |
18 | replacedBy: ["no-unsafe-negation"] | |
18 | replacedBy: ["no-unsafe-negation"], | |
19 | url: "https://eslint.org/docs/rules/no-negated-in-lhs" | |
19 | 20 | }, |
20 | 21 | deprecated: true, |
21 | 22 |
13 | 13 | docs: { |
14 | 14 | description: "disallow nested ternary expressions", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-nested-ternary" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `new` operators with the `Function` object", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-new-func" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `Object` constructors", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-new-object" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `new` operators with calls to `require`", |
15 | 15 | category: "Node.js and CommonJS", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-new-require" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `new` operators with the `Symbol` object", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-new-symbol" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-new-wrappers" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "disallow `new` operators outside of assignments or comparisons", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-new" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow calling global object properties as functions", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-obj-calls" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow octal escape sequences in string literals", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-octal-escape" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow octal literals", |
15 | 15 | category: "Best Practices", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-octal" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "disallow reassigning `function` parameters", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-param-reassign" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow string concatenation with `__dirname` and `__filename`", |
14 | 14 | category: "Node.js and CommonJS", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-path-concat" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "disallow the unary operators `++` and `--`", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-plusplus" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow the use of `process.env`", |
14 | 14 | category: "Node.js and CommonJS", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-process-env" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow the use of `process.exit()`", |
14 | 14 | category: "Node.js and CommonJS", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-process-exit" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow the use of the `__proto__` property", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-proto" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow calling some `Object.prototype` methods directly on objects", |
14 | 14 | category: "Possible Errors", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-prototype-builtins" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow variable redeclaration", |
15 | 15 | category: "Best Practices", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-redeclare" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "disallow multiple spaces in regular expressions", |
17 | 17 | category: "Possible Errors", |
18 | recommended: true | |
18 | recommended: true, | |
19 | url: "https://eslint.org/docs/rules/no-regex-spaces" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [], |
19 | 19 | docs: { |
20 | 20 | description: "disallow specified global variables", |
21 | 21 | category: "Variables", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-restricted-globals" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: { |
55 | 55 | docs: { |
56 | 56 | description: "disallow specified modules when loaded by `import`", |
57 | 57 | category: "ECMAScript 6", |
58 | recommended: false | |
58 | recommended: false, | |
59 | url: "https://eslint.org/docs/rules/no-restricted-imports" | |
59 | 60 | }, |
60 | 61 | |
61 | 62 | schema: { |
49 | 49 | docs: { |
50 | 50 | description: "disallow specified modules when loaded by `require`", |
51 | 51 | category: "Node.js and CommonJS", |
52 | recommended: false | |
52 | recommended: false, | |
53 | url: "https://eslint.org/docs/rules/no-restricted-modules" | |
53 | 54 | }, |
54 | 55 | |
55 | 56 | schema: { |
15 | 15 | docs: { |
16 | 16 | description: "disallow certain properties on certain objects", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-restricted-properties" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: { |
12 | 12 | docs: { |
13 | 13 | description: "disallow specified syntax", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-restricted-syntax" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: { |
24 | 24 | docs: { |
25 | 25 | description: "disallow assignment operators in `return` statements", |
26 | 26 | category: "Best Practices", |
27 | recommended: false | |
27 | recommended: false, | |
28 | url: "https://eslint.org/docs/rules/no-return-assign" | |
28 | 29 | }, |
29 | 30 | |
30 | 31 | schema: [ |
16 | 16 | docs: { |
17 | 17 | description: "disallow unnecessary `return await`", |
18 | 18 | category: "Best Practices", |
19 | recommended: false // TODO: set to true | |
19 | ||
20 | // TODO: set to true | |
21 | recommended: false, | |
22 | ||
23 | url: "https://eslint.org/docs/rules/no-return-await" | |
20 | 24 | }, |
21 | 25 | fixable: null, |
22 | 26 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "disallow `javascript:` urls", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-script-url" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
165 | 165 | docs: { |
166 | 166 | description: "disallow assignments where both sides are exactly the same", |
167 | 167 | category: "Best Practices", |
168 | recommended: true | |
168 | recommended: true, | |
169 | url: "https://eslint.org/docs/rules/no-self-assign" | |
169 | 170 | }, |
170 | 171 | |
171 | 172 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "disallow comparisons where both sides are exactly the same", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/no-self-compare" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "disallow comma operators", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-sequences" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [] |
12 | 12 | docs: { |
13 | 13 | description: "disallow identifiers from shadowing restricted names", |
14 | 14 | category: "Variables", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-shadow-restricted-names" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "disallow variable declarations from shadowing variables declared in the outer scope", |
21 | 21 | category: "Variables", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/no-shadow" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [ |
15 | 15 | description: "disallow spacing between function identifiers and their applications (deprecated)", |
16 | 16 | category: "Stylistic Issues", |
17 | 17 | recommended: false, |
18 | replacedBy: ["func-call-spacing"] | |
18 | replacedBy: ["func-call-spacing"], | |
19 | url: "https://eslint.org/docs/rules/no-spaced-func" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | deprecated: true, |
12 | 12 | docs: { |
13 | 13 | description: "disallow sparse arrays", |
14 | 14 | category: "Possible Errors", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/no-sparse-arrays" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow synchronous methods", |
17 | 17 | category: "Node.js and CommonJS", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-sync" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "disallow all tabs", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/no-tabs" | |
22 | 23 | }, |
23 | 24 | schema: [] |
24 | 25 | }, |
12 | 12 | docs: { |
13 | 13 | description: "disallow template literal placeholder syntax in regular strings", |
14 | 14 | category: "Possible Errors", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-template-curly-in-string" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow ternary operators", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-ternary" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
38 | 38 | docs: { |
39 | 39 | description: "disallow `this`/`super` before calling `super()` in constructors", |
40 | 40 | category: "ECMAScript 6", |
41 | recommended: true | |
41 | recommended: true, | |
42 | url: "https://eslint.org/docs/rules/no-this-before-super" | |
42 | 43 | }, |
43 | 44 | |
44 | 45 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow throwing literals as exceptions", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-throw-literal" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [] |
18 | 18 | docs: { |
19 | 19 | description: "disallow trailing whitespace at the end of lines", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/no-trailing-spaces" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "whitespace", |
15 | 15 | docs: { |
16 | 16 | description: "disallow initializing variables to `undefined`", |
17 | 17 | category: "Variables", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-undef-init" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [], |
27 | 27 | docs: { |
28 | 28 | description: "disallow the use of undeclared variables unless mentioned in `/*global */` comments", |
29 | 29 | category: "Variables", |
30 | recommended: true | |
30 | recommended: true, | |
31 | url: "https://eslint.org/docs/rules/no-undef" | |
31 | 32 | }, |
32 | 33 | |
33 | 34 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "disallow the use of `undefined` as an identifier", |
14 | 14 | category: "Variables", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-undefined" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow dangling underscores in identifiers", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-underscore-dangle" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "disallow confusing multiline expressions", |
20 | 20 | category: "Possible Errors", |
21 | recommended: true | |
21 | recommended: true, | |
22 | url: "https://eslint.org/docs/rules/no-unexpected-multiline" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [] |
168 | 168 | docs: { |
169 | 169 | description: "disallow unmodified loop conditions", |
170 | 170 | category: "Best Practices", |
171 | recommended: false | |
171 | recommended: false, | |
172 | url: "https://eslint.org/docs/rules/no-unmodified-loop-condition" | |
172 | 173 | }, |
173 | 174 | |
174 | 175 | schema: [] |
26 | 26 | docs: { |
27 | 27 | description: "disallow ternary operators when simpler alternatives exist", |
28 | 28 | category: "Stylistic Issues", |
29 | recommended: false | |
29 | recommended: false, | |
30 | url: "https://eslint.org/docs/rules/no-unneeded-ternary" | |
30 | 31 | }, |
31 | 32 | |
32 | 33 | schema: [ |
103 | 103 | docs: { |
104 | 104 | description: "disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", |
105 | 105 | category: "Possible Errors", |
106 | recommended: true | |
106 | recommended: true, | |
107 | url: "https://eslint.org/docs/rules/no-unreachable" | |
107 | 108 | }, |
108 | 109 | |
109 | 110 | schema: [] |
22 | 22 | docs: { |
23 | 23 | description: "disallow control flow statements in `finally` blocks", |
24 | 24 | category: "Possible Errors", |
25 | recommended: true | |
25 | recommended: true, | |
26 | url: "https://eslint.org/docs/rules/no-unsafe-finally" | |
26 | 27 | }, |
27 | 28 | |
28 | 29 | schema: [] |
43 | 43 | docs: { |
44 | 44 | description: "disallow negating the left operand of relational operators", |
45 | 45 | category: "Possible Errors", |
46 | recommended: true | |
46 | recommended: true, | |
47 | url: "https://eslint.org/docs/rules/no-unsafe-negation" | |
47 | 48 | }, |
48 | 49 | schema: [], |
49 | 50 | fixable: "code" |
12 | 12 | docs: { |
13 | 13 | description: "disallow unused expressions", |
14 | 14 | category: "Best Practices", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-unused-expressions" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "disallow unused labels", |
15 | 15 | category: "Best Practices", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/no-unused-labels" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [], |
20 | 20 | docs: { |
21 | 21 | description: "disallow unused variables", |
22 | 22 | category: "Variables", |
23 | recommended: true | |
23 | recommended: true, | |
24 | url: "https://eslint.org/docs/rules/no-unused-vars" | |
24 | 25 | }, |
25 | 26 | |
26 | 27 | schema: [ |
138 | 138 | docs: { |
139 | 139 | description: "disallow the use of variables before they are defined", |
140 | 140 | category: "Variables", |
141 | recommended: false | |
141 | recommended: false, | |
142 | url: "https://eslint.org/docs/rules/no-use-before-define" | |
142 | 143 | }, |
143 | 144 | |
144 | 145 | schema: [ |
51 | 51 | docs: { |
52 | 52 | description: "disallow unnecessary calls to `.call()` and `.apply()`", |
53 | 53 | category: "Best Practices", |
54 | recommended: false | |
54 | recommended: false, | |
55 | url: "https://eslint.org/docs/rules/no-useless-call" | |
55 | 56 | }, |
56 | 57 | |
57 | 58 | schema: [] |
20 | 20 | docs: { |
21 | 21 | description: "disallow unnecessary computed property keys in object literals", |
22 | 22 | category: "ECMAScript 6", |
23 | recommended: false | |
23 | recommended: false, | |
24 | url: "https://eslint.org/docs/rules/no-useless-computed-key" | |
24 | 25 | }, |
25 | 26 | |
26 | 27 | schema: [], |
68 | 68 | docs: { |
69 | 69 | description: "disallow unnecessary concatenation of literals or template literals", |
70 | 70 | category: "Best Practices", |
71 | recommended: false | |
71 | recommended: false, | |
72 | url: "https://eslint.org/docs/rules/no-useless-concat" | |
72 | 73 | }, |
73 | 74 | |
74 | 75 | schema: [] |
144 | 144 | docs: { |
145 | 145 | description: "disallow unnecessary constructors", |
146 | 146 | category: "ECMAScript 6", |
147 | recommended: false | |
147 | recommended: false, | |
148 | url: "https://eslint.org/docs/rules/no-useless-constructor" | |
148 | 149 | }, |
149 | 150 | |
150 | 151 | schema: [] |
81 | 81 | docs: { |
82 | 82 | description: "disallow unnecessary escape characters", |
83 | 83 | category: "Best Practices", |
84 | recommended: true | |
84 | recommended: true, | |
85 | url: "https://eslint.org/docs/rules/no-useless-escape" | |
85 | 86 | }, |
86 | 87 | |
87 | 88 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "disallow renaming import, export, and destructured assignments to the same name", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-useless-rename" | |
17 | 18 | }, |
18 | 19 | fixable: "code", |
19 | 20 | schema: [ |
75 | 75 | docs: { |
76 | 76 | description: "disallow redundant return statements", |
77 | 77 | category: "Best Practices", |
78 | recommended: false | |
78 | recommended: false, | |
79 | url: "https://eslint.org/docs/rules/no-useless-return" | |
79 | 80 | }, |
80 | 81 | fixable: "code", |
81 | 82 | schema: [] |
182 | 182 | docs: { |
183 | 183 | description: "require `let` or `const` instead of `var`", |
184 | 184 | category: "ECMAScript 6", |
185 | recommended: false | |
185 | recommended: false, | |
186 | url: "https://eslint.org/docs/rules/no-var" | |
186 | 187 | }, |
187 | 188 | |
188 | 189 | schema: [], |
12 | 12 | docs: { |
13 | 13 | description: "disallow `void` operators", |
14 | 14 | category: "Best Practices", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/no-void" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [] |
15 | 15 | docs: { |
16 | 16 | description: "disallow specified warning terms in comments", |
17 | 17 | category: "Best Practices", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/no-warning-comments" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | schema: [ |
18 | 18 | docs: { |
19 | 19 | description: "disallow whitespace before properties", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/no-whitespace-before-property" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "whitespace", |
13 | 13 | docs: { |
14 | 14 | description: "disallow `with` statements", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/no-with" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
14 | 14 | docs: { |
15 | 15 | description: "enforce the location of single-line statements", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/nonblock-statement-body-position" | |
18 | 19 | }, |
19 | 20 | fixable: "whitespace", |
20 | 21 | schema: [ |
96 | 96 | docs: { |
97 | 97 | description: "enforce consistent line breaks inside braces", |
98 | 98 | category: "Stylistic Issues", |
99 | recommended: false | |
99 | recommended: false, | |
100 | url: "https://eslint.org/docs/rules/object-curly-newline" | |
100 | 101 | }, |
101 | 102 | fixable: "whitespace", |
102 | 103 | schema: [ |
14 | 14 | docs: { |
15 | 15 | description: "enforce consistent spacing inside braces", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/object-curly-spacing" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "whitespace", |
13 | 13 | docs: { |
14 | 14 | description: "enforce placing object properties on separate lines", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/object-property-newline" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
26 | 26 | docs: { |
27 | 27 | description: "require or disallow method and property shorthand syntax for object literals", |
28 | 28 | category: "ECMAScript 6", |
29 | recommended: false | |
29 | recommended: false, | |
30 | url: "https://eslint.org/docs/rules/object-shorthand" | |
30 | 31 | }, |
31 | 32 | |
32 | 33 | fixable: "code", |
12 | 12 | docs: { |
13 | 13 | description: "require or disallow newlines around variable declarations", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/one-var-declaration-per-line" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "enforce variables to be declared either together or separately in functions", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/one-var" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
91 | 91 | docs: { |
92 | 92 | description: "require or disallow assignment operator shorthand where possible", |
93 | 93 | category: "Stylistic Issues", |
94 | recommended: false | |
94 | recommended: false, | |
95 | url: "https://eslint.org/docs/rules/operator-assignment" | |
95 | 96 | }, |
96 | 97 | |
97 | 98 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "enforce consistent linebreak style for operators", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/operator-linebreak" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "require or disallow padding within blocks", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/padded-blocks" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | fixable: "whitespace", |
393 | 393 | docs: { |
394 | 394 | description: "require or disallow padding lines between statements", |
395 | 395 | category: "Stylistic Issues", |
396 | recommended: false | |
396 | recommended: false, | |
397 | url: "https://eslint.org/docs/rules/padding-line-between-statements" | |
397 | 398 | }, |
398 | 399 | fixable: "whitespace", |
399 | 400 | schema: { |
133 | 133 | docs: { |
134 | 134 | description: "require using arrow functions for callbacks", |
135 | 135 | category: "ECMAScript 6", |
136 | recommended: false | |
136 | recommended: false, | |
137 | url: "https://eslint.org/docs/rules/prefer-arrow-callback" | |
137 | 138 | }, |
138 | 139 | |
139 | 140 | schema: [ |
232 | 232 | docs: { |
233 | 233 | description: "require `const` declarations for variables that are never reassigned after declared", |
234 | 234 | category: "ECMAScript 6", |
235 | recommended: false | |
235 | recommended: false, | |
236 | url: "https://eslint.org/docs/rules/prefer-const" | |
236 | 237 | }, |
237 | 238 | |
238 | 239 | fixable: "code", |
12 | 12 | docs: { |
13 | 13 | description: "require destructuring from arrays and/or objects", |
14 | 14 | category: "ECMAScript 6", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/prefer-destructuring" | |
16 | 17 | }, |
17 | 18 | schema: [ |
18 | 19 | { |
40 | 40 | docs: { |
41 | 41 | description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", |
42 | 42 | category: "ECMAScript 6", |
43 | recommended: false | |
43 | recommended: false, | |
44 | url: "https://eslint.org/docs/rules/prefer-numeric-literals" | |
44 | 45 | }, |
45 | 46 | |
46 | 47 | schema: [], |
14 | 14 | docs: { |
15 | 15 | description: "require using Error objects as Promise rejection reasons", |
16 | 16 | category: "Best Practices", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/prefer-promise-reject-errors" | |
18 | 19 | }, |
19 | 20 | fixable: null, |
20 | 21 | schema: [ |
14 | 14 | description: "require `Reflect` methods where applicable", |
15 | 15 | category: "ECMAScript 6", |
16 | 16 | recommended: false, |
17 | replacedBy: [] | |
17 | replacedBy: [], | |
18 | url: "https://eslint.org/docs/rules/prefer-reflect" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | deprecated: true, |
64 | 64 | docs: { |
65 | 65 | description: "require rest parameters instead of `arguments`", |
66 | 66 | category: "ECMAScript 6", |
67 | recommended: false | |
67 | recommended: false, | |
68 | url: "https://eslint.org/docs/rules/prefer-rest-params" | |
68 | 69 | }, |
69 | 70 | |
70 | 71 | schema: [] |
51 | 51 | docs: { |
52 | 52 | description: "require spread operators instead of `.apply()`", |
53 | 53 | category: "ECMAScript 6", |
54 | recommended: false | |
54 | recommended: false, | |
55 | url: "https://eslint.org/docs/rules/prefer-spread" | |
55 | 56 | }, |
56 | 57 | |
57 | 58 | schema: [], |
102 | 102 | docs: { |
103 | 103 | description: "require template literals instead of string concatenation", |
104 | 104 | category: "ECMAScript 6", |
105 | recommended: false | |
105 | recommended: false, | |
106 | url: "https://eslint.org/docs/rules/prefer-template" | |
106 | 107 | }, |
107 | 108 | |
108 | 109 | schema: [], |
19 | 19 | docs: { |
20 | 20 | description: "require quotes around object literal property names", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/quote-props" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: { |
78 | 78 | docs: { |
79 | 79 | description: "enforce the consistent use of either backticks, double, or single quotes", |
80 | 80 | category: "Stylistic Issues", |
81 | recommended: false | |
81 | recommended: false, | |
82 | url: "https://eslint.org/docs/rules/quotes" | |
82 | 83 | }, |
83 | 84 | |
84 | 85 | fixable: "code", |
80 | 80 | docs: { |
81 | 81 | description: "enforce the consistent use of the radix argument when using `parseInt()`", |
82 | 82 | category: "Best Practices", |
83 | recommended: false | |
83 | recommended: false, | |
84 | url: "https://eslint.org/docs/rules/radix" | |
84 | 85 | }, |
85 | 86 | |
86 | 87 | schema: [ |
33 | 33 | docs: { |
34 | 34 | description: "disallow async functions which have no `await` expression", |
35 | 35 | category: "Best Practices", |
36 | recommended: false | |
36 | recommended: false, | |
37 | url: "https://eslint.org/docs/rules/require-await" | |
37 | 38 | }, |
38 | 39 | schema: [] |
39 | 40 | }, |
8 | 8 | docs: { |
9 | 9 | description: "require JSDoc comments", |
10 | 10 | category: "Stylistic Issues", |
11 | recommended: false | |
11 | recommended: false, | |
12 | url: "https://eslint.org/docs/rules/require-jsdoc" | |
12 | 13 | }, |
13 | 14 | |
14 | 15 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "require generator functions to contain `yield`", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/require-yield" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
13 | 13 | docs: { |
14 | 14 | description: "enforce spacing between rest and spread operators and their expressions", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/rest-spread-spacing" | |
17 | 18 | }, |
18 | 19 | fixable: "whitespace", |
19 | 20 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "enforce consistent spacing before and after semicolons", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/semi-spacing" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | fixable: "whitespace", |
67 | 67 | docs: { |
68 | 68 | description: "enforce location of semicolons", |
69 | 69 | category: "Stylistic Issues", |
70 | recommended: false | |
70 | recommended: false, | |
71 | url: "https://eslint.org/docs/rules/semi-style" | |
71 | 72 | }, |
72 | 73 | schema: [{ enum: ["last", "first"] }], |
73 | 74 | fixable: "whitespace" |
19 | 19 | docs: { |
20 | 20 | description: "require or disallow semicolons instead of ASI", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/semi" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | fixable: "code", |
13 | 13 | docs: { |
14 | 14 | description: "enforce sorted import declarations within modules", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/sort-imports" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
75 | 75 | docs: { |
76 | 76 | description: "require object keys to be sorted", |
77 | 77 | category: "Stylistic Issues", |
78 | recommended: false | |
78 | recommended: false, | |
79 | url: "https://eslint.org/docs/rules/sort-keys" | |
79 | 80 | }, |
80 | 81 | schema: [ |
81 | 82 | { |
13 | 13 | docs: { |
14 | 14 | description: "require variables within the same declaration block to be sorted", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/sort-vars" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [ |
15 | 15 | docs: { |
16 | 16 | description: "enforce consistent spacing before blocks", |
17 | 17 | category: "Stylistic Issues", |
18 | recommended: false | |
18 | recommended: false, | |
19 | url: "https://eslint.org/docs/rules/space-before-blocks" | |
19 | 20 | }, |
20 | 21 | |
21 | 22 | fixable: "whitespace", |
18 | 18 | docs: { |
19 | 19 | description: "enforce consistent spacing before `function` definition opening parenthesis", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/space-before-function-paren" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "whitespace", |
14 | 14 | docs: { |
15 | 15 | description: "enforce consistent spacing inside parentheses", |
16 | 16 | category: "Stylistic Issues", |
17 | recommended: false | |
17 | recommended: false, | |
18 | url: "https://eslint.org/docs/rules/space-in-parens" | |
18 | 19 | }, |
19 | 20 | |
20 | 21 | fixable: "whitespace", |
12 | 12 | docs: { |
13 | 13 | description: "require spacing around infix operators", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/space-infix-ops" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | fixable: "whitespace", |
18 | 18 | docs: { |
19 | 19 | description: "enforce consistent spacing before or after unary operators", |
20 | 20 | category: "Stylistic Issues", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/space-unary-ops" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | fixable: "whitespace", |
157 | 157 | docs: { |
158 | 158 | description: "enforce consistent spacing after the `//` or `/*` in a comment", |
159 | 159 | category: "Stylistic Issues", |
160 | recommended: false | |
160 | recommended: false, | |
161 | url: "https://eslint.org/docs/rules/spaced-comment" | |
161 | 162 | }, |
162 | 163 | |
163 | 164 | fixable: "whitespace", |
82 | 82 | docs: { |
83 | 83 | description: "require or disallow strict mode directives", |
84 | 84 | category: "Strict Mode", |
85 | recommended: false | |
85 | recommended: false, | |
86 | url: "https://eslint.org/docs/rules/strict" | |
86 | 87 | }, |
87 | 88 | |
88 | 89 | schema: [ |
19 | 19 | docs: { |
20 | 20 | description: "enforce spacing around colons of switch statements", |
21 | 21 | category: "Stylistic Issues", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/switch-colon-spacing" | |
23 | 24 | }, |
24 | 25 | schema: [ |
25 | 26 | { |
20 | 20 | docs: { |
21 | 21 | description: "require symbol descriptions", |
22 | 22 | category: "ECMAScript 6", |
23 | recommended: false | |
23 | recommended: false, | |
24 | url: "https://eslint.org/docs/rules/symbol-description" | |
24 | 25 | }, |
25 | 26 | |
26 | 27 | schema: [] |
26 | 26 | docs: { |
27 | 27 | description: "require or disallow spacing around embedded expressions of template strings", |
28 | 28 | category: "ECMAScript 6", |
29 | recommended: false | |
29 | recommended: false, | |
30 | url: "https://eslint.org/docs/rules/template-curly-spacing" | |
30 | 31 | }, |
31 | 32 | |
32 | 33 | fixable: "whitespace", |
13 | 13 | docs: { |
14 | 14 | description: "require or disallow spacing between template tags and their literals", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/template-tag-spacing" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | fixable: "whitespace", |
12 | 12 | docs: { |
13 | 13 | description: "require or disallow Unicode byte order mark (BOM)", |
14 | 14 | category: "Stylistic Issues", |
15 | recommended: false | |
15 | recommended: false, | |
16 | url: "https://eslint.org/docs/rules/unicode-bom" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | fixable: "whitespace", |
13 | 13 | docs: { |
14 | 14 | description: "require calls to `isNaN()` when checking for `NaN`", |
15 | 15 | category: "Possible Errors", |
16 | recommended: true | |
16 | recommended: true, | |
17 | url: "https://eslint.org/docs/rules/use-isnan" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
18 | 18 | docs: { |
19 | 19 | description: "enforce valid JSDoc comments", |
20 | 20 | category: "Possible Errors", |
21 | recommended: false | |
21 | recommended: false, | |
22 | url: "https://eslint.org/docs/rules/valid-jsdoc" | |
22 | 23 | }, |
23 | 24 | |
24 | 25 | schema: [ |
12 | 12 | docs: { |
13 | 13 | description: "enforce comparing `typeof` expressions against valid strings", |
14 | 14 | category: "Possible Errors", |
15 | recommended: true | |
15 | recommended: true, | |
16 | url: "https://eslint.org/docs/rules/valid-typeof" | |
16 | 17 | }, |
17 | 18 | |
18 | 19 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "require `var` declarations be placed at the top of their containing scope", |
15 | 15 | category: "Best Practices", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/vars-on-top" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [] |
19 | 19 | docs: { |
20 | 20 | description: "require parentheses around immediate `function` invocations", |
21 | 21 | category: "Best Practices", |
22 | recommended: false | |
22 | recommended: false, | |
23 | url: "https://eslint.org/docs/rules/wrap-iife" | |
23 | 24 | }, |
24 | 25 | |
25 | 26 | schema: [ |
13 | 13 | docs: { |
14 | 14 | description: "require parenthesis around regex literals", |
15 | 15 | category: "Stylistic Issues", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/wrap-regex" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | schema: [], |
13 | 13 | docs: { |
14 | 14 | description: "require or disallow spacing around the `*` in `yield*` expressions", |
15 | 15 | category: "ECMAScript 6", |
16 | recommended: false | |
16 | recommended: false, | |
17 | url: "https://eslint.org/docs/rules/yield-star-spacing" | |
17 | 18 | }, |
18 | 19 | |
19 | 20 | fixable: "whitespace", |
154 | 154 | docs: { |
155 | 155 | description: "require or disallow \"Yoda\" conditions", |
156 | 156 | category: "Best Practices", |
157 | recommended: false | |
157 | recommended: false, | |
158 | url: "https://eslint.org/docs/rules/yoda" | |
158 | 159 | }, |
159 | 160 | |
160 | 161 | schema: [ |
0 | /** | |
1 | * @fileoverview Tests for internal-consistent-docs-url rule. | |
2 | * @author Patrick McElhaney | |
3 | */ | |
4 | ||
5 | "use strict"; | |
6 | ||
7 | //------------------------------------------------------------------------------ | |
8 | // Requirements | |
9 | //------------------------------------------------------------------------------ | |
10 | ||
11 | const rule = require("../../../tools/internal-rules/consistent-docs-url"), | |
12 | RuleTester = require("../../../lib/testers/rule-tester"); | |
13 | ||
14 | //------------------------------------------------------------------------------ | |
15 | // Tests | |
16 | //------------------------------------------------------------------------------ | |
17 | ||
18 | const ruleTester = new RuleTester(); | |
19 | ||
20 | ruleTester.run("consistent-docs-url", rule, { | |
21 | valid: [ | |
22 | ||
23 | // wrong exports format: "internal-no-invalid-meta" reports this already | |
24 | [ | |
25 | "module.exports = function(context) {", | |
26 | " return {", | |
27 | " Program: function(node) {}", | |
28 | " };", | |
29 | "};" | |
30 | ].join("\n"), | |
31 | [ | |
32 | "module.exports = {", | |
33 | " meta: {", | |
34 | " docs: {", | |
35 | " url: 'https://eslint.org/docs/rules/<input>'", | |
36 | " }", | |
37 | " },", | |
38 | " create: function(context) {", | |
39 | " return {};", | |
40 | " }", | |
41 | "};" | |
42 | ].join("\n") | |
43 | ], | |
44 | invalid: [ | |
45 | { | |
46 | code: [ | |
47 | "module.exports = {", | |
48 | " meta: {", | |
49 | " docs: {}", | |
50 | " },", | |
51 | ||
52 | " create: function(context) {", | |
53 | " return {};", | |
54 | " }", | |
55 | "};" | |
56 | ].join("\n"), | |
57 | errors: [{ | |
58 | message: "Rule is missing a meta.docs.url property", | |
59 | line: 3, | |
60 | column: 9 | |
61 | }] | |
62 | }, | |
63 | { | |
64 | code: [ | |
65 | "module.exports = {", | |
66 | " meta: {", | |
67 | " docs: {", | |
68 | " url: 'http://example.com/wrong-url'", | |
69 | " }", | |
70 | " },", | |
71 | " create: function(context) {", | |
72 | " return {};", | |
73 | " }", | |
74 | "};" | |
75 | ].join("\n"), | |
76 | errors: [{ | |
77 | message: "Incorrect url. Expected \"https://eslint.org/docs/rules/<input>\" but got \"http://example.com/wrong-url\"", | |
78 | line: 4, | |
79 | column: 18 | |
80 | }] | |
81 | } | |
82 | ] | |
83 | }); |
0 | 0 | rules: |
1 | 1 | rulesdir/no-invalid-meta: "error" |
2 | 2 | rulesdir/consistent-docs-description: "error" |
3 | rulesdir/consistent-docs-url: "error" |
103 | 103 | |
104 | 104 | module.exports = { |
105 | 105 | meta: { |
106 | docs: { | |
106 | docs: {// eslint-disable-line rulesdir/consistent-docs-url | |
107 | 107 | description: "enforce correct conventions of `meta.docs.description` property in core rules", |
108 | 108 | category: "Internal", |
109 | 109 | recommended: false |
0 | /** | |
1 | * @fileoverview Internal rule to enforce meta.docs.url conventions. | |
2 | * @author Patrick McElhaney | |
3 | */ | |
4 | ||
5 | "use strict"; | |
6 | ||
7 | const path = require("path"); | |
8 | ||
9 | //------------------------------------------------------------------------------ | |
10 | // Helpers | |
11 | //------------------------------------------------------------------------------ | |
12 | ||
13 | /** | |
14 | * Gets the property of the Object node passed in that has the name specified. | |
15 | * | |
16 | * @param {string} property Name of the property to return. | |
17 | * @param {ASTNode} node The ObjectExpression node. | |
18 | * @returns {ASTNode} The Property node or null if not found. | |
19 | */ | |
20 | function getPropertyFromObject(property, node) { | |
21 | const properties = node.properties; | |
22 | ||
23 | for (let i = 0; i < properties.length; i++) { | |
24 | if (properties[i].key.name === property) { | |
25 | return properties[i]; | |
26 | } | |
27 | } | |
28 | ||
29 | return null; | |
30 | } | |
31 | ||
32 | /** | |
33 | * Verifies that the meta.docs.url property is present and has the correct value. | |
34 | * | |
35 | * @param {RuleContext} context The ESLint rule context. | |
36 | * @param {ASTNode} exportsNode ObjectExpression node that the rule exports. | |
37 | * @returns {void} | |
38 | */ | |
39 | function checkMetaDocsUrl(context, exportsNode) { | |
40 | if (exportsNode.type !== "ObjectExpression") { | |
41 | ||
42 | // if the exported node is not the correct format, "internal-no-invalid-meta" will already report this. | |
43 | return; | |
44 | } | |
45 | ||
46 | const metaProperty = getPropertyFromObject("meta", exportsNode); | |
47 | const metaDocs = metaProperty && getPropertyFromObject("docs", metaProperty.value); | |
48 | const metaDocsUrl = metaDocs && getPropertyFromObject("url", metaDocs.value); | |
49 | ||
50 | if (!metaDocsUrl) { | |
51 | context.report({ | |
52 | node: metaDocs, | |
53 | message: "Rule is missing a meta.docs.url property" | |
54 | }); | |
55 | return; | |
56 | } | |
57 | ||
58 | const ruleId = path.basename(context.getFilename().replace(/.js$/, "")); | |
59 | const expected = `https://eslint.org/docs/rules/${ruleId}`; | |
60 | const url = metaDocsUrl.value.value; | |
61 | ||
62 | if (url !== expected) { | |
63 | context.report({ | |
64 | node: metaDocsUrl.value, | |
65 | message: `Incorrect url. Expected "${expected}" but got "${url}"` | |
66 | }); | |
67 | } | |
68 | ||
69 | } | |
70 | ||
71 | //------------------------------------------------------------------------------ | |
72 | // Rule Definition | |
73 | //------------------------------------------------------------------------------ | |
74 | ||
75 | module.exports = { | |
76 | meta: { | |
77 | docs: {// eslint-disable-line rulesdir/consistent-docs-url | |
78 | description: "enforce correct conventions of `meta.docs.url` property in core rules", | |
79 | category: "Internal", | |
80 | recommended: false | |
81 | }, | |
82 | ||
83 | schema: [] | |
84 | }, | |
85 | ||
86 | create(context) { | |
87 | return { | |
88 | AssignmentExpression(node) { | |
89 | if (node.left && | |
90 | node.right && | |
91 | node.left.type === "MemberExpression" && | |
92 | node.left.object.name === "module" && | |
93 | node.left.property.name === "exports") { | |
94 | ||
95 | checkMetaDocsUrl(context, node.right); | |
96 | } | |
97 | } | |
98 | }; | |
99 | } | |
100 | }; |