Skip to content

Commit 3640662

Browse files
committed
feat: support ESLint 8.x
1 parent 9225766 commit 3640662

File tree

6 files changed

+43
-12
lines changed

6 files changed

+43
-12
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,21 @@ jobs:
4141
matrix.os }})
4242
strategy:
4343
matrix:
44-
eslint: [7]
44+
eslint: [8]
4545
node: [12.22.0, 12, 14.17.0, 14, 16, 18]
4646
os: [ubuntu-latest]
4747
include:
4848
# On other platforms
4949
- os: windows-latest
50-
eslint: 7
50+
eslint: 8
5151
node: 18
5252
- os: macos-latest
53-
eslint: 7
53+
eslint: 8
5454
node: 18
5555
# On old ESLint versions
56+
- eslint: 7
57+
node: 18
58+
os: ubuntu-latest
5659
- eslint: 6
5760
node: 18
5861
os: ubuntu-latest

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save-dev eslint @eslint-community/eslint-plugin-mysticatea
1717
### Requirements
1818

1919
- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions.
20-
- ESLint `^6.6.0 || ^7.0.0` or newer versions.
20+
- ESLint `^6.6.0 || ^7.0.0 || ^8.0.0` or newer versions.
2121

2222
## 📖 Usage
2323

lib/configs/_base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
"init-declarations": "error",
3939
"linebreak-style": ["error", "unix"],
4040
"lines-between-class-members": "error",
41+
"logical-assignment-operators": "off", // TODO: enable once we drop ESLint v7 support
4142
"max-statements-per-line": ["error", { max: 1 }],
4243
"multiline-comment-style": ["error", "separate-lines"],
4344
"new-cap": "error",
@@ -48,6 +49,7 @@ module.exports = {
4849
"no-case-declarations": "error",
4950
"no-compare-neg-zero": "error",
5051
"no-cond-assign": "error",
52+
"no-constant-binary-expression": "off", // TODO: enable once we drop ESLint v7 support
5153
"no-constant-condition": "error",
5254
"no-constructor-return": "error",
5355
"no-control-regex": "error",
@@ -152,6 +154,7 @@ module.exports = {
152154
"no-unsafe-optional-chaining": "error",
153155
"no-unused-expressions": "error",
154156
"no-unused-labels": "error",
157+
"no-unused-private-class-members": "off", // TODO: enable once we drop ESLint v7 support
155158
"no-unused-vars": [
156159
"error",
157160
{
@@ -185,6 +188,7 @@ module.exports = {
185188
{ blankLine: "always", next: "*", prev: "function" },
186189
],
187190
"prefer-exponentiation-operator": "error",
191+
"prefer-object-has-own": "off", // TODO: enable once we drop ESLint v7 support
188192
"prefer-promise-reject-errors": "error",
189193
"prefer-regex-literals": "error",
190194
quotes: ["error", "double", { avoidEscape: true }],

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
"vue-eslint-parser": "^8.3.0"
5454
},
5555
"devDependencies": {
56-
"@eslint/eslintrc": "^0.4.3",
56+
"@eslint/eslintrc": "^1.3.3",
5757
"@eslint-community/eslint-plugin-mysticatea": "file:.",
58-
"eslint": "~7.32.0",
58+
"eslint": "~8.25.0",
5959
"globals": "^13.17.0",
6060
"mocha": "^9.2.2",
6161
"npm-run-all": "^4.1.5",
@@ -65,7 +65,7 @@
6565
"typescript": "^4.8.4"
6666
},
6767
"peerDependencies": {
68-
"eslint": ">=6.6.0"
68+
"eslint": "^6.6.0 || ^7.0.0 || ^8.0.0"
6969
},
7070
"engines": {
7171
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"

tests/lib/configs/_rules.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
const { Linter } = require("eslint")
88
const {
9-
ConfigArrayFactory,
10-
} = require("@eslint/eslintrc/lib/config-array-factory")
11-
const Validator = require("eslint/lib/shared/config-validator")
12-
const { rules: removedRules } = require("eslint/conf/replacements.json")
9+
Legacy: { ConfigArrayFactory, ConfigValidator },
10+
} = require("@eslint/eslintrc")
1311
const {
1412
rules: PluginRulesIndex,
1513
} = require("@eslint-community/eslint-plugin-mysticatea")
14+
const { rules: removedRules } = require("./eslint-replacements.json")
1615

1716
const coreRules = new Linter().getRules()
1817
const pluginRules = new Map(
@@ -31,6 +30,7 @@ const deprecatedRuleNames = new Set(
3130
const removedRuleNames = new Set(Object.keys(removedRules))
3231

3332
const configFactory = new ConfigArrayFactory()
33+
const configValidator = new ConfigValidator()
3434

3535
module.exports = {
3636
/**
@@ -40,7 +40,9 @@ module.exports = {
4040
* @returns {void}
4141
*/
4242
validateConfig(config, source) {
43-
Validator.validate(config, source, (ruleId) => allRules.get(ruleId))
43+
configValidator.validate(config, source, (ruleId) =>
44+
allRules.get(ruleId)
45+
)
4446

4547
/* istanbul ignore next */
4648
for (const ruleId of [].concat(
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"rules": {
3+
"generator-star": ["generator-star-spacing"],
4+
"global-strict": ["strict"],
5+
"no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"],
6+
"no-comma-dangle": ["comma-dangle"],
7+
"no-empty-class": ["no-empty-character-class"],
8+
"no-empty-label": ["no-labels"],
9+
"no-extra-strict": ["strict"],
10+
"no-reserved-keys": ["quote-props"],
11+
"no-space-before-semi": ["semi-spacing"],
12+
"no-wrap-func": ["no-extra-parens"],
13+
"space-after-function-name": ["space-before-function-paren"],
14+
"space-after-keywords": ["keyword-spacing"],
15+
"space-before-function-parentheses": ["space-before-function-paren"],
16+
"space-before-keywords": ["keyword-spacing"],
17+
"space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"],
18+
"space-return-throw-case": ["keyword-spacing"],
19+
"space-unary-word-ops": ["space-unary-ops"],
20+
"spaced-line-comment": ["spaced-comment"]
21+
}
22+
}

0 commit comments

Comments
 (0)