Skip to content

Commit

Permalink
feat: support ESLint 8.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0
BREAKING CHANGE: Requires ESLint@^8.0.0
  • Loading branch information
MichaelDeBoey committed Oct 12, 2021
1 parent f9c4c6b commit 0b7b979
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
eslint: [7]
eslint: [8]
node: [16]
include:
# On other platforms
Expand All @@ -26,10 +26,8 @@ jobs:
os: ubuntu-latest
- node: 12
os: ubuntu-latest
- node: 10
os: ubuntu-latest
# On the minimum supported ESLint/Node.js version
- node: 10.12.0
- node: 12.22.0
os: ubuntu-latest

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ npm install --save-dev eslint @mysticatea/eslint-plugin

### Requirements

- Node.js `^10.12.0 || >=12.0.0` or newer versions.
- ESLint `^7.0.0` or newer versions.
- Node.js `^12.22.0 || ^14.17.0 || >=16.0.0` or newer versions.
- ESLint `^8.0.0` or newer versions.

## 📖 Usage

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"version": "13.0.0",
"description": "Additional ESLint rules.",
"engines": {
"node": "^10.12.0 || >=12.0.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"main": "index.js",
"files": [
"lib"
],
"peerDependencies": {
"eslint": "^7.0.0"
"eslint": "^8.0.0"
},
"dependencies": {
"@eslint/eslintrc": "^0.4.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@eslint/eslintrc": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
"@typescript-eslint/parser": "^5.0.0-0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^3.6.1",
"eslint-plugin-eslint-plugin": "^4.0.0-0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.19.1",
Expand All @@ -27,7 +27,7 @@
"devDependencies": {
"@mysticatea/eslint-plugin": "file:.",
"codecov": "^3.6.1",
"eslint": "^7.32.0",
"eslint": "^8.0.0",
"fs-extra": "^8.1.0",
"globals": "^12.1.1",
"mocha": "^6.2.2",
Expand Down
7 changes: 3 additions & 4 deletions scripts/generate-browser-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const fs = require("fs")
const path = require("path")
const { CLIEngine } = require("eslint")
const { ESLint } = require("eslint")
const { browser: originalGlobals } = require("globals")

const targetFile = path.resolve(__dirname, "../lib/configs/_browser-globals.js")
Expand All @@ -33,7 +33,7 @@ for (const key of Object.keys(originalGlobals).sort()) {
}
}

const linter = new CLIEngine({ fix: true })
const linter = new ESLint({ fix: true })
const rawCode = `/**
* DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
*/
Expand All @@ -42,7 +42,6 @@ const rawCode = `/**
module.exports = ${JSON.stringify(globals, null, 4)}
`
const code =
linter.executeOnText(rawCode, "_browser-globals.js").results[0].output ||
rawCode
linter.lintText(rawCode, "_browser-globals.js").results[0].output || rawCode

fs.writeFileSync(targetFile, code)
8 changes: 4 additions & 4 deletions scripts/generate-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const fs = require("fs")
const path = require("path")
const { CLIEngine } = require("eslint")
const { ESLint } = require("eslint")

const targetFile = path.resolve(__dirname, "../lib/configs.js")

Expand All @@ -28,6 +28,6 @@ ${fs
`
)

const linter = new CLIEngine({ fix: true })
const result = linter.executeOnFiles([targetFile])
CLIEngine.outputFixes(result)
const linter = new ESLint({ fix: true })
const result = linter.lintFiles([targetFile])
ESLint.outputFixes(result)
8 changes: 4 additions & 4 deletions scripts/generate-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const fs = require("fs")
const path = require("path")
const { CLIEngine } = require("eslint")
const { ESLint } = require("eslint")

const targetFile = path.resolve(__dirname, "../lib/rules.js")

Expand Down Expand Up @@ -34,6 +34,6 @@ ${fs
`
)

const linter = new CLIEngine({ fix: true })
const result = linter.executeOnFiles([targetFile])
CLIEngine.outputFixes(result)
const linter = new ESLint({ fix: true })
const result = linter.lintFiles([targetFile])
ESLint.outputFixes(result)
6 changes: 3 additions & 3 deletions tests/lib/configs/_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
const { Linter } = require("eslint")
const {
ConfigArrayFactory,
} = require("@eslint/eslintrc/lib/config-array-factory")
const Validator = require("eslint/lib/shared/config-validator")
Legacy: { ConfigValidator },
} = require("@eslint/eslintrc")
const { rules: PluginRulesIndex } = require("@mysticatea/eslint-plugin")
const { rules: removedRules } = require("eslint/conf/replacements.json")

Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = {
* @returns {void}
*/
validateConfig(config, source) {
Validator.validate(config, source, ruleId => allRules.get(ruleId))
ConfigValidator.validate(config, source, ruleId => allRules.get(ruleId))

/* istanbul ignore next */
for (const ruleId of [].concat(
Expand Down

0 comments on commit 0b7b979

Please sign in to comment.