Skip to content

Commit 2586806

Browse files
authored
Drop support for node <v12.22.0, v13, >=v14<v14.17.0, v15 and eslint v5 (#129)
* Drop support for node <12.22.0, 13, >=14 <14.17.0,15 and eslint v5 * update ci
1 parent b5a5af9 commit 2586806

28 files changed

+1032
-912
lines changed

Diff for: .eslintrc.yml

+855-10
Large diffs are not rendered by default.

Diff for: .github/workflows/CI.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,13 @@ jobs:
4444
- eslint: 7
4545
node: 12
4646
os: ubuntu-latest
47-
- eslint: 7
48-
node: 10
49-
os: ubuntu-latest
5047
# On old ESLint versions
5148
- eslint: 6
5249
node: 14
5350
os: ubuntu-latest
54-
- eslint: 5
55-
node: 14
56-
os: ubuntu-latest
5751
# On the minimum supported ESLint/Node.js version
58-
- eslint: 5
59-
node: 8.10.0
52+
- eslint: 6
53+
node: 12
6054
os: ubuntu-latest
6155

6256
runs-on: ${{ matrix.os }}
@@ -69,11 +63,8 @@ jobs:
6963
uses: actions/setup-node@v1
7064
with:
7165
node-version: ${{ matrix.node }}
72-
- name: Install @typescript-eslint/parser@3
73-
run: npm install -D @typescript-eslint/parser@3
74-
if: matrix.node == '8.10.0'
7566
- name: Install Packages
76-
run: npm install
67+
run: npm install --legacy-peer-deps
7768
- name: Install ESLint v${{ matrix.eslint }}
7869
run: node scripts/ci-install-eslint ${{ matrix.eslint }}
7970
- name: Build

Diff for: README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ This parser allows us to lint the `<template>` of `.vue` files. We can make mist
1515
## 💿 Installation
1616

1717
```bash
18-
$ npm install --save-dev eslint vue-eslint-parser
18+
npm install --save-dev eslint vue-eslint-parser
1919
```
2020

21-
- Requires Node.js 6.5.0 or later.
22-
- Requires ESLint 5.0.0 or later.
23-
- Requires `babel-eslint` 8.1.1 or later if you want it. (optional)
24-
- Requires `@typescript-eslint/parser` 1.0.0 or later if you want it. (optional)
21+
- Requires Node.js ^12.22.0, ^14.17.0, 16.0.0 or later.
22+
- Requires ESLint 6.0.0 or later.
2523

2624
## 📖 Usage
2725

@@ -71,9 +69,8 @@ For example:
7169
{
7270
"parser": "vue-eslint-parser",
7371
"parserOptions": {
74-
"parser": "babel-eslint",
75-
"sourceType": "module",
76-
"allowImportExportEverywhere": false
72+
"parser": "@babel/eslint-parser",
73+
"sourceType": "module"
7774
}
7875
}
7976
```
@@ -82,7 +79,8 @@ For example:
8279
{
8380
"parser": "vue-eslint-parser",
8481
"parserOptions": {
85-
"parser": "@typescript-eslint/parser"
82+
"parser": "@typescript-eslint/parser",
83+
"sourceType": "module"
8684
}
8785
}
8886
```

Diff for: package.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,49 @@
33
"version": "7.11.0",
44
"description": "The ESLint custom parser for `.vue` files.",
55
"engines": {
6-
"node": ">=8.10"
6+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
77
},
88
"main": "index.js",
99
"files": [
1010
"index.*"
1111
],
1212
"peerDependencies": {
13-
"eslint": ">=5.0.0"
13+
"eslint": ">=6.0.0"
1414
},
1515
"dependencies": {
16-
"debug": "^4.1.1",
17-
"eslint-scope": "^5.1.1",
18-
"eslint-visitor-keys": "^1.1.0",
19-
"espree": "^6.2.1",
16+
"debug": "^4.3.2",
17+
"eslint-scope": "^6.0.0",
18+
"eslint-visitor-keys": "^3.0.0",
19+
"espree": "^9.0.0",
2020
"esquery": "^1.4.0",
2121
"lodash": "^4.17.21",
22-
"semver": "^6.3.0"
22+
"semver": "^7.3.5"
2323
},
2424
"devDependencies": {
2525
"@babel/core": "^7.15.0",
2626
"@babel/eslint-parser": "^7.15.0",
2727
"@babel/plugin-syntax-decorators": "^7.14.5",
2828
"@babel/plugin-syntax-pipeline-operator": "^7.15.0",
2929
"@babel/plugin-syntax-typescript": "^7.14.5",
30-
"@mysticatea/eslint-plugin": "^13.0.0",
3130
"@types/debug": "0.0.30",
3231
"@types/eslint": "^7.2.6",
3332
"@types/estree": "0.0.45",
3433
"@types/lodash": "^4.14.120",
3534
"@types/mocha": "^5.2.4",
3635
"@types/node": "^10.12.21",
3736
"@types/semver": "^7.3.6",
38-
"@typescript-eslint/eslint-plugin": "^4.9.1",
39-
"@typescript-eslint/parser": "^4.14.0",
40-
"babel-eslint": "^10.0.1",
37+
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
38+
"@typescript-eslint/parser": "^5.0.0-0",
4139
"chokidar": "^2.0.4",
4240
"codecov": "^3.1.0",
4341
"cross-spawn": "^6.0.5",
4442
"dts-bundle": "^0.7.3",
45-
"eslint": "^7.0.0",
43+
"eslint": "^8.0.0-0",
44+
"eslint-plugin-eslint-comments": "^3.2.0",
4645
"eslint-plugin-jsonc": "^1.4.0",
46+
"eslint-plugin-node": "^11.1.0",
4747
"eslint-plugin-node-dependencies": "^0.5.0",
48+
"eslint-plugin-prettier": "^4.0.0",
4849
"fs-extra": "^7.0.1",
4950
"jsonc-eslint-parser": "^0.6.0",
5051
"mocha": "^6.1.4",

Diff for: src/ast/traverse.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See LICENSE file in root directory for full license.
55
*/
66
import type { VisitorKeys } from "eslint-visitor-keys"
7-
import Evk from "eslint-visitor-keys"
7+
import * as Evk from "eslint-visitor-keys"
88
import type { Node } from "./nodes"
99

1010
//------------------------------------------------------------------------------

Diff for: src/common/create-require.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const createRequire: (filename: string) => (modname: string) => any =
44
// Added in v12.2.0
55
(Module as any).createRequire ||
66
// Added in v10.12.0, but deprecated in v12.2.0.
7-
// eslint-disable-next-line @mysticatea/node/no-deprecated-api
7+
// eslint-disable-next-line node/no-deprecated-api
88
Module.createRequireFromPath ||
99
// Polyfill - This is not executed on the tests on node@>=10.
1010
/* istanbul ignore next */

Diff for: src/common/eslint-scope.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import escope from "eslint-scope"
1+
import * as escope from "eslint-scope"
22
import { getLinterRequire } from "./linter-require"
33
import { lte } from "semver"
44

Diff for: src/html/parser.ts

-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ export class Parser {
215215
/**
216216
* The current flag of expression enabled.
217217
*/
218-
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
219-
// @ts-ignore
220218
private get expressionEnabled(): boolean {
221219
return this.tokenizer.expressionEnabled
222220
}

Diff for: src/parser-services.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ export function define(
175175
generator,
176176
)
177177
} finally {
178-
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
179-
// @ts-ignore
178+
// @ts-expect-error -- ignore
180179
scriptVisitor[templateBodyTriggerSelector] =
181180
programExitHandler
182181
templateBodyEmitters.delete(templateBodyTriggerSelector)
@@ -232,8 +231,6 @@ export function define(
232231
})
233232
traverseNodes(document, generator)
234233
} finally {
235-
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
236-
// @ts-ignore
237234
scriptVisitor[documentTriggerSelector] =
238235
programExitHandler
239236
documentEmitters.delete(documentTriggerSelector)
@@ -337,8 +334,7 @@ export function define(
337334
const ctx = {
338335
...customBlockContext,
339336
}
340-
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
341-
// @ts-ignore -- custom context
337+
// @ts-expect-error -- custom context
342338
ctx.__proto__ = factory.context
343339

344340
const visitor = factory.create(
@@ -370,8 +366,6 @@ export function define(
370366
})
371367
}
372368
} finally {
373-
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
374-
// @ts-ignore
375369
scriptVisitor["Program:exit"] = programExitHandler
376370
customBlocksEmitters.delete(key)
377371
}

Diff for: src/script/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ export interface ExpressionParseResult<T extends Node> {
527527

528528
function loadParser(parser: string) {
529529
if (parser !== "espree") {
530-
// eslint-disable-next-line @mysticatea/ts/no-require-imports
530+
// eslint-disable-next-line @typescript-eslint/no-require-imports
531531
return require(parser)
532532
}
533533
return getEspreeFromUser()

Diff for: src/sfc/custom-block/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ export function parseCustomBlockElement(
112112
parserOptions,
113113
)
114114
} catch (e) {
115+
if (!(e instanceof Error)) {
116+
throw e
117+
}
115118
return {
116119
error: e,
117120
ast: {
@@ -221,7 +224,7 @@ export function createCustomBlockSharedContext({
221224
getAncestors: () => getAncestors(currentNode),
222225

223226
getDeclaredVariables: (...args: any[]) =>
224-
// @ts-expect-error
227+
// @ts-expect-error -- ignore
225228
getScopeManager().getDeclaredVariables(...args),
226229
getScope: () => getScope(getScopeManager(), currentNode),
227230
markVariableAsUsed: (name: string) =>
@@ -256,7 +259,7 @@ export function createCustomBlockSharedContext({
256259
function getSourceCode() {
257260
return (
258261
sourceCode ||
259-
// eslint-disable-next-line @mysticatea/ts/no-require-imports
262+
// eslint-disable-next-line @typescript-eslint/no-require-imports
260263
(sourceCode = new (require("eslint").SourceCode)({
261264
text,
262265
ast: parsedResult.ast,
@@ -365,7 +368,7 @@ function markVariableAsUsed(
365368
)
366369

367370
if (variable) {
368-
// @ts-expect-error
371+
// @ts-expect-error -- ignore
369372
variable.eslintUsed = true
370373
return true
371374
}

Diff for: test/ast.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ function getTree(source, parserOptions) {
8888
type: node.type,
8989
text: source.slice(node.range[0], node.range[1]),
9090
children: [],
91-
})
91+
}),
9292
)
9393
},
9494
"*:exit"() {
9595
current = stack.pop()
9696
},
97-
})
97+
}),
9898
)
9999
linter.verify(
100100
source,
@@ -104,7 +104,7 @@ function getTree(source, parserOptions) {
104104
rules: { maketree: "error" },
105105
},
106106
undefined,
107-
true
107+
true,
108108
)
109109

110110
return root.children
@@ -140,19 +140,19 @@ function validateParent(source, parserOptions) {
140140
node.parent === parent,
141141
`The parent of ${nodeToString(
142142
node,
143-
source
143+
source,
144144
)} should be ${nodeToString(
145145
parent,
146-
source
147-
)}, but got ${nodeToString(node.parent, source)}`
146+
source,
147+
)}, but got ${nodeToString(node.parent, source)}`,
148148
)
149149
}
150150
stack.push(node)
151151
},
152152
"*:exit"() {
153153
stack.pop()
154154
},
155-
})
155+
}),
156156
)
157157
linter.verify(
158158
source,
@@ -162,7 +162,7 @@ function validateParent(source, parserOptions) {
162162
rules: { validateparent: "error" },
163163
},
164164
undefined,
165-
true
165+
true,
166166
)
167167
}
168168

@@ -189,7 +189,7 @@ describe("Template AST", () => {
189189
const options = Object.assign(
190190
{ filePath: sourcePath },
191191
PARSER_OPTIONS,
192-
parserOptions
192+
parserOptions,
193193
)
194194

195195
if (
@@ -213,15 +213,15 @@ describe("Template AST", () => {
213213

214214
assert.strictEqual(
215215
JSON.stringify(actual.ast, replacer, 4),
216-
expected
216+
expected,
217217
)
218218
})
219219

220220
it("should have correct range.", () => {
221221
const resultPath = path.join(ROOT, `${name}/token-ranges.json`)
222222
const expectedText = fs.readFileSync(resultPath, "utf8")
223223
const tokens = getAllTokens(actual.ast).map((t) =>
224-
source.slice(t.range[0], t.range[1])
224+
source.slice(t.range[0], t.range[1]),
225225
)
226226
const actualText = JSON.stringify(tokens, null, 4)
227227

@@ -232,15 +232,15 @@ describe("Template AST", () => {
232232
const sourceForWin = source.replace(/\r?\n/gu, "\r\n")
233233
const actualForWin = parser.parseForESLint(
234234
sourceForWin,
235-
options
235+
options,
236236
)
237237

238238
const resultPath = path.join(ROOT, `${name}/token-ranges.json`)
239239
const expectedText = fs.readFileSync(resultPath, "utf8")
240240
const tokens = getAllTokens(actualForWin.ast).map((t) =>
241241
sourceForWin
242242
.slice(t.range[0], t.range[1])
243-
.replace(/\r?\n/gu, "\n")
243+
.replace(/\r?\n/gu, "\n"),
244244
)
245245
const actualText = JSON.stringify(tokens, null, 4)
246246

@@ -257,7 +257,7 @@ describe("Template AST", () => {
257257
const column1 = token.loc.end.column
258258
const expected = source.slice(
259259
token.range[0],
260-
token.range[1]
260+
token.range[1],
261261
)
262262

263263
let text = ""
@@ -277,10 +277,10 @@ describe("Template AST", () => {
277277
`${JSON.stringify(
278278
token,
279279
null,
280-
4
280+
4,
281281
)} expected ${JSON.stringify(
282-
expected
283-
)}, but got ${JSON.stringify(text)}`
282+
expected,
283+
)}, but got ${JSON.stringify(text)}`,
284284
)
285285
}
286286
})
@@ -302,7 +302,7 @@ describe("Template AST", () => {
302302
it("should have correct services.", () => {
303303
assert.deepStrictEqual(
304304
Object.keys(actual.services).sort(),
305-
services
305+
services,
306306
)
307307
})
308308
}

Diff for: test/core-rules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function modifyPattern(ruleId, pattern) {
166166
error.data &&
167167
Object.hasOwnProperty.call(
168168
error.data,
169-
"shadowedLine"
169+
"shadowedLine",
170170
) &&
171171
typeof error.data.shadowedLine === "number"
172172
) {

0 commit comments

Comments
 (0)