Skip to content

Commit 2bd0af5

Browse files
authored
Chore: upgrade eslint to v8 (#340)
1 parent 68987e3 commit 2bd0af5

File tree

7 files changed

+636
-1139
lines changed

7 files changed

+636
-1139
lines changed

.github/workflows/NodeCI.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,25 @@ jobs:
4444
node-version: 12.13.x
4545
- name: Install Target Packages
4646
run: |+
47+
npm ci
4748
npm i -D eslint@6
48-
npx rimraf node_modules
49-
npm install
49+
- name: Test
50+
run: npm test
51+
test-with-eslint7:
52+
runs-on: ubuntu-latest
53+
strategy:
54+
matrix:
55+
node-version: [12.x, 14.x, 16.x]
56+
steps:
57+
- uses: actions/checkout@v2
58+
- name: Use Node.js ${{ matrix.node-version }}
59+
uses: actions/setup-node@v2
60+
with:
61+
node-version: ${{ matrix.node-version }}
62+
- name: Install Target Packages
63+
run: |+
64+
npm ci
65+
npm i -D eslint@7
5066
- name: Test
5167
run: npm test
5268
test-and-coverage:

docs/.vuepress/components/components/EslintPluginEditor.vue

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<script>
1919
import EslintEditor from "vue-eslint-editor"
20+
import { Linter } from "eslint/lib/linter"
2021
import plugin from "../../../.."
2122
2223
export default {
@@ -46,7 +47,6 @@ export default {
4647
4748
data() {
4849
return {
49-
eslint4b: null,
5050
format: {
5151
insertSpaces: true,
5252
tabSize: 2,
@@ -85,7 +85,7 @@ export default {
8585
rules: this.rules,
8686
parserOptions: {
8787
sourceType: "module",
88-
ecmaVersion: 2019,
88+
ecmaVersion: 2022,
8989
},
9090
}
9191
},
@@ -96,11 +96,6 @@ export default {
9696
return "javascript"
9797
},
9898
linter() {
99-
if (!this.eslint4b) {
100-
return null
101-
}
102-
const Linter = this.eslint4b
103-
10499
const linter = new Linter()
105100
106101
for (const k of Object.keys(plugin.rules)) {
@@ -112,11 +107,7 @@ export default {
112107
},
113108
},
114109
115-
async mounted() {
116-
// Load linter asynchronously.
117-
const { default: eslint4b } = await import("eslint4b")
118-
this.eslint4b = eslint4b
119-
110+
mounted() {
120111
const editor = this.$refs.editor
121112
122113
editor.$watch("monaco", () => {

docs/.vuepress/components/rules/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// eslint-disable-next-line eslint-comments/disable-enable-pair -- demo
22
/* eslint-disable node/no-unsupported-features/es-syntax -- demo */
3-
import * as coreRules from "../../../../node_modules/eslint4b/dist/core-rules"
3+
import { Linter } from "eslint/lib/linter"
44
import plugin from "../../../../"
55

6+
const coreRules = Object.fromEntries(new Linter().getRules())
7+
68
const CATEGORY_TITLES = {
79
"Possible Errors": "Possible Errors",
810
"Best Practices": "Best Practices",

docs/.vuepress/config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require("path")
12
const { rules } = require("../../dist/utils/rules")
23

34
function ruleToLink({
@@ -33,9 +34,19 @@ module.exports = {
3334
evergreen: true,
3435
configureWebpack(_config, _isServer) {
3536
return {
37+
externals: {
38+
typescript: "typescript",
39+
},
3640
resolve: {
3741
alias: {
38-
eslint: require.resolve("eslint4b"),
42+
esquery: path.resolve(
43+
__dirname,
44+
"../../node_modules/esquery/dist/esquery.min.js",
45+
),
46+
"@eslint/eslintrc/universal": path.resolve(
47+
__dirname,
48+
"../../node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs",
49+
),
3950
},
4051
},
4152
}

docs/.vuepress/enhanceApp.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,11 @@ export default () =>
1111
if (typeof window.global === "undefined") {
1212
window.global = {}
1313
}
14+
if (typeof window.process === "undefined") {
15+
window.process = {
16+
env: {},
17+
cwd: () => undefined,
18+
}
19+
}
1420
}
1521
}

0 commit comments

Comments
 (0)