Skip to content

Commit 2df66e4

Browse files
MichaelDeBoeymysticatea
authored andcommitted
⚒ update CI and deps
1 parent 50bf912 commit 2df66e4

File tree

5 files changed

+110
-48
lines changed

5 files changed

+110
-48
lines changed

Diff for: .gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*.ts eol=lf
1+
* text=auto eol=lf
22
/test/fixtures/crlf.vue eol=crlf

Diff for: .github/workflows/CI.yml

+44-42
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,57 @@ jobs:
1212
name: Lint
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v1
17-
with:
18-
fetch-depth: 1
19-
- name: Checkout submodules
20-
run: git submodule update --init
21-
- name: Install Node.js
22-
uses: actions/setup-node@v1
23-
with:
24-
node-version: 12
25-
- name: Install Packages
26-
run: npm install
27-
- name: Lint
28-
run: npm run -s lint
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Checkout submodules
18+
run: git submodule update --init
19+
- name: Install Node.js
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: 14
23+
- name: Install Packages
24+
run: npm install
25+
- name: Lint
26+
run: npm run -s lint
2927

3028
test:
3129
name: Test
32-
3330
strategy:
3431
matrix:
35-
eslint: [6, 5]
36-
node: [13, 12, 10, 8, "8.10.0"]
37-
exclude:
38-
# Run ESLint 5 on only the LTS.
39-
- node: 13
40-
eslint: 5
41-
- node: 10
42-
eslint: 5
43-
- node: 8
44-
eslint: 5
45-
- node: "8.10.0"
46-
eslint: 5
32+
eslint: [7]
33+
node: [14]
34+
os: [ubuntu-latest]
35+
include:
36+
# On other platforms
37+
- eslint: 7
38+
node: 14
39+
os: windows-latest
40+
- eslint: 7
41+
node: 14
42+
os: macos-latest
43+
# On old Node.js versions
44+
- eslint: 7
45+
node: 12
46+
os: ubuntu-latest
47+
- eslint: 7
48+
node: 10
49+
os: ubuntu-latest
50+
# On old ESLint versions
51+
- eslint: 6
52+
node: 14
53+
os: ubuntu-latest
54+
- eslint: 5
55+
node: 14
56+
os: ubuntu-latest
57+
# On the minimum supported ESLint/Node.js version
58+
- eslint: 5
59+
node: 8.10.0
60+
os: ubuntu-latest
4761

48-
runs-on: ubuntu-latest
62+
runs-on: ${{ matrix.os }}
4963
steps:
5064
- name: Checkout
51-
uses: actions/checkout@v1
52-
with:
53-
fetch-depth: 1
65+
uses: actions/checkout@v2
5466
- name: Checkout submodules
5567
run: git submodule update --init
5668
- name: Install Node.js v${{ matrix.node }}
@@ -60,17 +72,7 @@ jobs:
6072
- name: Install Packages
6173
run: npm install
6274
- name: Install ESLint v${{ matrix.eslint }}
63-
run: |
64-
if [ ${{ matrix.eslint }} -eq 6 ]; then
65-
cd test/fixtures/eslint
66-
npm install
67-
else
68-
npm install --no-save [email protected]
69-
cd test/fixtures/eslint
70-
git checkout v5.16.0
71-
npm install [email protected]
72-
npm install
73-
fi
75+
run: node scripts/ci-install-eslint ${{ matrix.eslint }}
7476
- name: Build
7577
run: npm run -s build
7678
- name: Test

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"debug": "^4.1.1",
1717
"eslint-scope": "^5.0.0",
1818
"eslint-visitor-keys": "^1.1.0",
19-
"espree": "^6.1.2",
19+
"espree": "^7.0.0",
2020
"esquery": "^1.0.1",
2121
"lodash": "^4.17.15"
2222
},
@@ -27,13 +27,13 @@
2727
"@types/lodash": "^4.14.120",
2828
"@types/mocha": "^5.2.4",
2929
"@types/node": "^10.12.21",
30-
"@typescript-eslint/parser": "^1.2.0",
30+
"@typescript-eslint/parser": "^2.31.0",
3131
"babel-eslint": "^10.0.1",
3232
"chokidar": "^2.0.4",
3333
"codecov": "^3.1.0",
3434
"cross-spawn": "^6.0.5",
3535
"dts-bundle": "^0.7.3",
36-
"eslint": "^6.1.0",
36+
"eslint": "^7.0.0",
3737
"fs-extra": "^7.0.1",
3838
"mocha": "^6.1.4",
3939
"npm-run-all": "^4.1.5",

Diff for: scripts/ci-install-eslint.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"use strict"
2+
3+
const { spawn } = require("child_process")
4+
5+
function cd(path) {
6+
console.log("$ cd %s", path)
7+
process.chdir(path)
8+
}
9+
10+
function sh(command) {
11+
console.log("$ %s", command)
12+
return new Promise((resolve, reject) => {
13+
spawn(command, [], { shell: true, stdio: "inherit" })
14+
.on("error", reject)
15+
.on("exit", exitCode => {
16+
if (exitCode) {
17+
reject(new Error(`Exit with non-zero ${exitCode}`))
18+
} else {
19+
resolve()
20+
}
21+
})
22+
})
23+
}
24+
25+
;(async function main() {
26+
const requestedVersion = process.argv[2]
27+
const requestedVersionSpec = /^\d+\.\d+\.\d+$/u.test(requestedVersion)
28+
? requestedVersion
29+
: `^${requestedVersion}`
30+
31+
// Install ESLint of the requested version
32+
await sh(`npm install eslint@${requestedVersionSpec}`)
33+
34+
// Install ESLint submodule of the requested version
35+
const installedVersion = require("eslint").CLIEngine.version
36+
cd("test/fixtures/eslint")
37+
if (!installedVersion.startsWith("7.")) {
38+
await sh(`git checkout v${installedVersion}`)
39+
}
40+
if (installedVersion.startsWith("5.")) {
41+
await sh("npm install [email protected]")
42+
}
43+
await sh("npm install")
44+
})().catch(error => {
45+
console.error(error)
46+
process.exitCode = 1
47+
})

Diff for: test/core-rules.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ const EXCEPTIONS = new Set([
4444
const originalRun = RuleTester.prototype.run
4545
const processed = new Set()
4646

47+
/**
48+
* Check if the code should be skipped or not.
49+
* The following code should be skipped.
50+
* - includes shebang
51+
* - includes syntax error -- some tests in old ESLint contains syntax error.
52+
* Acorn has fixed to catch the syntax errors in a minor release, so those
53+
* tests go to fail.
54+
* @param {string} code The test code.
55+
*/
56+
function codeShouldBeSkipped(code) {
57+
return code.startsWith("#!") || code.includes("await async")
58+
}
59+
4760
/**
4861
* Wrap the given code with a `<script>` tag.
4962
*
@@ -69,7 +82,7 @@ function wrapCode(code) {
6982
//eslint-disable-next-line complexity
7083
function modifyPattern(ruleId, pattern) {
7184
if (typeof pattern === "string") {
72-
if (pattern.startsWith("#!")) {
85+
if (codeShouldBeSkipped(pattern)) {
7386
return null
7487
}
7588
return {
@@ -84,7 +97,7 @@ function modifyPattern(ruleId, pattern) {
8497
if (
8598
pattern.parser != null ||
8699
pattern.filename != null ||
87-
pattern.code.startsWith("#!")
100+
codeShouldBeSkipped(pattern.code)
88101
) {
89102
return null
90103
}

0 commit comments

Comments
 (0)