Skip to content

Commit 7649322

Browse files
committed
feat: remove undesirable deprecated rules
`no-return-await` is enabled by `eslint-config-airbnb-base`, but it is no longer necessary nor desirable, as explained in <https://eslint.org/docs/latest/rules/no-return-await>. Remove it. `prefer-reflect` was not enabled and is removed to avoid deprecation warnings from eslint-find-rules. `import/imports-first` was not enabled and is removed to avoid deprecation warnings from eslint-find-rules. Signed-off-by: Kevin Locke <[email protected]>
1 parent 149b448 commit 7649322

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

common-legacy.js

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ const rulesStyle = require("./rules/style.js");
4949
const rulesUnicorn = require("./rules/unicorn.js");
5050
const rulesVariables = require("./rules/variables.js");
5151

52+
const airbnbLegacyRules = rulesToReplacements(
53+
{
54+
// Note: Order from
55+
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/legacy.js
56+
...airbnbBestPractices.rules,
57+
...airbnbErrors.rules,
58+
...airbnbNode.rules,
59+
...airbnbStyle.rules,
60+
...airbnbVariables.rules,
61+
...airbnbLegacy.rules
62+
},
63+
{
64+
"@stylistic/eslint-plugin": "@stylistic",
65+
"eslint-plugin-n": "n"
66+
}
67+
);
68+
// Remove rules for eslint-plugin-n which isn't used by legacy configs
69+
const airbnbRules = rulesRemovePlugin(airbnbLegacyRules, "n");
70+
// remove undesirable deprecated rules
71+
delete airbnbRules["no-return-await"];
72+
delete airbnbRules["prefer-reflect"];
73+
delete airbnbRules["import/imports-first"];
74+
5275
// Customized stylistic default configuration
5376
// https://eslint.style/guide/config-presets#configuration-factory
5477
const stylisticConfig = stylisticCustomize({ "semi": true });
@@ -67,25 +90,7 @@ module.exports = [
6790
{
6891
"name": "eslint-config-airbnb-base/legacy",
6992
// Include just rules to avoid undesirable settings and need for FlatCompat
70-
"rules": rulesRemovePlugin(
71-
rulesToReplacements(
72-
{
73-
// Note: Order from
74-
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/legacy.js
75-
...airbnbBestPractices.rules,
76-
...airbnbErrors.rules,
77-
...airbnbNode.rules,
78-
...airbnbStyle.rules,
79-
...airbnbVariables.rules,
80-
...airbnbLegacy.rules
81-
},
82-
{
83-
"@stylistic/eslint-plugin": "@stylistic",
84-
"eslint-plugin-n": "n"
85-
}
86-
),
87-
"n"
88-
)
93+
"rules": airbnbRules
8994
},
9095

9196
jsdocConfig,

common.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ const rulesStyle = require("./rules/style.js");
6262
const rulesUnicorn = require("./rules/unicorn.js");
6363
const rulesVariables = require("./rules/variables.js");
6464

65+
const airbnbRules = rulesToReplacements(
66+
{
67+
// Note: Order from
68+
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/index.js
69+
...airbnbBestPractices.rules,
70+
...airbnbErrors.rules,
71+
...airbnbNode.rules,
72+
...airbnbStyle.rules,
73+
...airbnbVariables.rules,
74+
...airbnbEs6.rules,
75+
...airbnbImports.rules,
76+
...airbnbStrict.rules
77+
},
78+
{
79+
"@stylistic/eslint-plugin": "@stylistic",
80+
"eslint-plugin-n": "n"
81+
}
82+
);
83+
// remove undesirable deprecated rules
84+
delete airbnbRules["no-return-await"];
85+
delete airbnbRules["prefer-reflect"];
86+
delete airbnbRules["import/imports-first"];
87+
6588
// Customized stylistic default configuration
6689
// https://eslint.style/guide/config-presets#configuration-factory
6790
const stylisticConfig = stylisticCustomize({ "semi": true });
@@ -86,24 +109,7 @@ module.exports = [
86109
{
87110
"name": "eslint-config-airbnb-base",
88111
// Include just rules to avoid undesirable settings and need for FlatCompat
89-
"rules": rulesToReplacements(
90-
{
91-
// Note: Order from
92-
// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/index.js
93-
...airbnbBestPractices.rules,
94-
...airbnbErrors.rules,
95-
...airbnbNode.rules,
96-
...airbnbStyle.rules,
97-
...airbnbVariables.rules,
98-
...airbnbEs6.rules,
99-
...airbnbImports.rules,
100-
...airbnbStrict.rules
101-
},
102-
{
103-
"@stylistic/eslint-plugin": "@stylistic",
104-
"eslint-plugin-n": "n"
105-
}
106-
)
112+
"rules": airbnbRules
107113
},
108114

109115
jsdocConfig,

0 commit comments

Comments
 (0)