Skip to content

Commit 418717f

Browse files
feat: introduce new deprecated types for rules (#19238)
* feat: introduce new deprecated types * feat: rules use new deprecated format * feat: support new deprecated format in usedDeprecatedRules * docs: document new deprecated format * fix: Use formatting rules instead of stylistic rules are being removed * fix: Clarify the replacement is from ESLint Stylistic * docs: automatically add deprecated rules notice * docs: handle missing replacement rule for rule deprecations * docs: stop checking for manually added rule deprecation notices * docs: apply suggestions * docs: fix lint errors * docs: Clarify null for availableUntil is not the same as frozen Co-authored-by: Milos Djermanovic <[email protected]> * fix: rule deprecation messages for node and various suggestions * fix: internal links * fix: sync deprecated node rules messages and descriptions * fix: add rule deprecation type tests * fix: re-add .md file extension for rules from eslint-plugin-n * fix: add periods to sentence ends * fix: showing rule replacements for deprecated and removed rules in rule overview * fix: add urls for replacement of deprecated rules in favor of padding-line-between-statements * fix: always provide a rule meta.deprecated.url * fix: alias func-call-spacing as the replacement rule is renamed to keep internal link * fix: convert callback-return and indent-legacy to new deprecated format * fix: normalize deprecated rule messages * chore: fix single quotes in eslint tests * fix: use external links to rule replacements in the rule reference * fix: remove shadowing of rule in makefile * fix: add external plugin reference for deprecated rules in the rule reference * fix: remove manual deprecation notice of no-new-object * fix: cleanup rule-list macro * fix: update rule-list documentation * fix: use DeprecatedInfo type from @eslint/core * fix: use shorthand plugin names for usedDeprecatedRules * fix: restore check for deprecated JSDoc tags for rule files * fix: adjust JSDoc description and error message as README no longer checked * fix: use correct name in deprecation info for arrow-spacing Co-authored-by: Milos Djermanovic <[email protected]> * fix: use correct name in deprecation info for multiline-comment-style Co-authored-by: Milos Djermanovic <[email protected]> * fix: correct package source of eslint-plugin-n in replacement infos * fix: rule docs site uses relative pages for internal rule replacements * fix: deprecation rule for no-buffer-constructor Co-authored-by: Milos Djermanovic <[email protected]> * fix: deprecation rule for no-restricted-modules Co-authored-by: Milos Djermanovic <[email protected]> * docs: Add dot at the end of a core rule replacement. Co-authored-by: Milos Djermanovic <[email protected]> * fix: use relative links for replacement rules in the rule reference * fix: rule-type-list data for removed rules use new replacement format * fix: no rendering of replacement rule lists if there are no replacements * fix: run pretteir on rule-type-list.json * docs: change description of `url` for deprecation meta Co-authored-by: Milos Djermanovic <[email protected]> * fix: deprecation version of no-spaced-fnc Co-authored-by: Milos Djermanovic <[email protected]> * fix: replacement rule of no-new-symbol Co-authored-by: Milos Djermanovic <[email protected]> --------- Co-authored-by: Milos Djermanovic <[email protected]>
1 parent 3401b85 commit 418717f

File tree

205 files changed

+5258
-887
lines changed

Some content is hidden

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

205 files changed

+5258
-887
lines changed

Makefile.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function generateRuleIndexPage() {
199199
if (rule.meta.deprecated) {
200200
ruleTypesData.deprecated.push({
201201
name: basename,
202-
replacedBy: rule.meta.replacedBy || [],
202+
replacedBy: rule.meta.deprecated.replacedBy ?? [],
203203
fixable: !!rule.meta.fixable,
204204
hasSuggestions: !!rule.meta.hasSuggestions
205205
});
@@ -745,15 +745,14 @@ target.checkRuleFiles = function() {
745745
}
746746

747747
/**
748-
* Check if deprecated information is in rule code and README.md.
748+
* Check if deprecated information is in rule code.
749749
* @returns {boolean} true if present
750750
* @private
751751
*/
752752
function hasDeprecatedInfo() {
753753
const deprecatedTagRegExp = /@deprecated in ESLint/u;
754-
const deprecatedInfoRegExp = /This rule was .+deprecated.+in ESLint/u;
755754

756-
return deprecatedTagRegExp.test(ruleCode) && deprecatedInfoRegExp.test(docText);
755+
return deprecatedTagRegExp.test(ruleCode);
757756
}
758757

759758
/**
@@ -797,7 +796,7 @@ target.checkRuleFiles = function() {
797796

798797
// check deprecated
799798
if (ruleDef.meta.deprecated && !hasDeprecatedInfo()) {
800-
console.error(`Missing deprecated information in ${basename} rule code or README.md. Please write @deprecated tag in code and「This rule was deprecated in ESLint ...」 in README.md.`);
799+
console.error(`Missing deprecated information in ${basename} rule code. Please write @deprecated tag in code.`);
801800
errors++;
802801
}
803802

conf/rule-type-list.json

+82-18
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,88 @@
66
},
77
"deprecated": [],
88
"removed": [
9-
{ "removed": "generator-star", "replacedBy": ["generator-star-spacing"] },
10-
{ "removed": "global-strict", "replacedBy": ["strict"] },
11-
{ "removed": "no-arrow-condition", "replacedBy": ["no-confusing-arrow", "no-constant-condition"] },
12-
{ "removed": "no-comma-dangle", "replacedBy": ["comma-dangle"] },
13-
{ "removed": "no-empty-class", "replacedBy": ["no-empty-character-class"] },
14-
{ "removed": "no-empty-label", "replacedBy": ["no-labels"] },
15-
{ "removed": "no-extra-strict", "replacedBy": ["strict"] },
16-
{ "removed": "no-reserved-keys", "replacedBy": ["quote-props"] },
17-
{ "removed": "no-space-before-semi", "replacedBy": ["semi-spacing"] },
18-
{ "removed": "no-wrap-func", "replacedBy": ["no-extra-parens"] },
19-
{ "removed": "space-after-function-name", "replacedBy": ["space-before-function-paren"] },
20-
{ "removed": "space-after-keywords", "replacedBy": ["keyword-spacing"] },
21-
{ "removed": "space-before-function-parentheses", "replacedBy": ["space-before-function-paren"] },
22-
{ "removed": "space-before-keywords", "replacedBy": ["keyword-spacing"] },
23-
{ "removed": "space-in-brackets", "replacedBy": ["object-curly-spacing", "array-bracket-spacing"] },
24-
{ "removed": "space-return-throw-case", "replacedBy": ["keyword-spacing"] },
25-
{ "removed": "space-unary-word-ops", "replacedBy": ["space-unary-ops"] },
26-
{ "removed": "spaced-line-comment", "replacedBy": ["spaced-comment"] },
9+
{
10+
"removed": "generator-star",
11+
"replacedBy": [{ "rule": { "name": "generator-star-spacing" } }]
12+
},
13+
{
14+
"removed": "global-strict",
15+
"replacedBy": [{ "rule": { "name": "strict" } }]
16+
},
17+
{
18+
"removed": "no-arrow-condition",
19+
"replacedBy": [
20+
{ "rule": { "name": "no-confusing-arrow" } },
21+
{ "rule": { "name": "no-constant-condition" } }
22+
]
23+
},
24+
{
25+
"removed": "no-comma-dangle",
26+
"replacedBy": [{ "rule": { "name": "comma-dangle" } }]
27+
},
28+
{
29+
"removed": "no-empty-class",
30+
"replacedBy": [{ "rule": { "name": "no-empty-character-class" } }]
31+
},
32+
{
33+
"removed": "no-empty-label",
34+
"replacedBy": [{ "rule": { "name": "no-labels" } }]
35+
},
36+
{
37+
"removed": "no-extra-strict",
38+
"replacedBy": [{ "rule": { "name": "strict" } }]
39+
},
40+
{
41+
"removed": "no-reserved-keys",
42+
"replacedBy": [{ "rule": { "name": "quote-props" } }]
43+
},
44+
{
45+
"removed": "no-space-before-semi",
46+
"replacedBy": [{ "rule": { "name": "semi-spacing" } }]
47+
},
48+
{
49+
"removed": "no-wrap-func",
50+
"replacedBy": [{ "rule": { "name": "no-extra-parens" } }]
51+
},
52+
{
53+
"removed": "space-after-function-name",
54+
"replacedBy": [
55+
{ "rule": { "name": "space-before-function-paren" } }
56+
]
57+
},
58+
{
59+
"removed": "space-after-keywords",
60+
"replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
61+
},
62+
{
63+
"removed": "space-before-function-parentheses",
64+
"replacedBy": [
65+
{ "rule": { "name": "space-before-function-paren" } }
66+
]
67+
},
68+
{
69+
"removed": "space-before-keywords",
70+
"replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
71+
},
72+
{
73+
"removed": "space-in-brackets",
74+
"replacedBy": [
75+
{ "rule": { "name": "object-curly-spacing" } },
76+
{ "rule": { "name": "array-bracket-spacing" } }
77+
]
78+
},
79+
{
80+
"removed": "space-return-throw-case",
81+
"replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
82+
},
83+
{
84+
"removed": "space-unary-word-ops",
85+
"replacedBy": [{ "rule": { "name": "space-unary-ops" } }]
86+
},
87+
{
88+
"removed": "spaced-line-comment",
89+
"replacedBy": [{ "rule": { "name": "spaced-comment" } }]
90+
},
2791
{ "removed": "valid-jsdoc", "replacedBy": [] },
2892
{ "removed": "require-jsdoc", "replacedBy": [] }
2993
]

0 commit comments

Comments
 (0)