Skip to content

Commit e5c6f23

Browse files
committed
fix: eslint 7.0 support
1 parent 0ab0f41 commit e5c6f23

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: [ubuntu-latest, windows-latest, macOS-latest]
34-
eslint: [8.x, 7.x]
34+
eslint: ["8.x"]
3535
node: [18.x, 20.x]
3636
include:
3737
# run on node lts(ubuntu-latest)
@@ -44,6 +44,9 @@ jobs:
4444
- os: ubuntu-latest
4545
node: "19.x"
4646
eslint: "8.x"
47+
- os: ubuntu-latest
48+
node: "20.x"
49+
eslint: "7.0.x"
4750
runs-on: ${{ matrix.os }}
4851
steps:
4952
- name: Checkout
@@ -57,10 +60,7 @@ jobs:
5760
- name: Install Packages
5861
run: npm install
5962
- name: Install ESLint ${{ matrix.eslint }}
60-
# We need to execute this command twice because of npm's bug.
61-
# See also: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
6263
run: |
63-
npm install --no-save eslint@${{ matrix.eslint }}
64-
npm install --no-save eslint@${{ matrix.eslint }}
64+
npm install --no-save --force eslint@${{ matrix.eslint }}
6565
- name: Test
6666
run: npm run -s test:ci

lib/configs/recommended-module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports.eslintrc = {
1010
es2021: true,
1111
},
1212
globals: {
13+
...globals.es2021,
1314
__dirname: "off",
1415
__filename: "off",
1516
exports: "off",
@@ -36,7 +37,6 @@ module.exports.flat = {
3637
sourceType: "module",
3738
globals: {
3839
...globals.node,
39-
...globals.es2021,
4040
...module.exports.eslintrc.globals,
4141
},
4242
},

lib/configs/recommended-script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports.eslintrc = {
1010
es2021: true,
1111
},
1212
globals: {
13+
...globals.es2021,
1314
__dirname: "readonly",
1415
__filename: "readonly",
1516
exports: "writable",
@@ -33,7 +34,6 @@ module.exports.flat = {
3334
sourceType: "commonjs",
3435
globals: {
3536
...globals.node,
36-
...globals.es2021,
3737
...module.exports.eslintrc.globals,
3838
},
3939
},

lib/util/is-typescript.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const typescriptExtensions = [".ts", ".tsx", ".cts", ".mts"]
1212
*/
1313
module.exports = function isTypescript(context) {
1414
const sourceFileExt = path.extname(
15-
context.physicalFilename ?? context.getPhysicalFilename()
15+
context.physicalFilename ??
16+
context.getPhysicalFilename?.() ??
17+
context.filename ??
18+
context.getFilename?.()
1619
)
1720
return typescriptExtensions.includes(sourceFileExt)
1821
}

0 commit comments

Comments
 (0)