Skip to content

Commit 2419888

Browse files
authoredJan 2, 2024
fix: eslint 7.0 support (#156)
1 parent 0ab0f41 commit 2419888

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed
 

‎.github/workflows/CI.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ 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:
37-
# run on node lts(ubuntu-latest)
3837
- os: ubuntu-latest
3938
node: "16.0.x"
4039
eslint: "8.x"
@@ -44,6 +43,9 @@ jobs:
4443
- os: ubuntu-latest
4544
node: "19.x"
4645
eslint: "8.x"
46+
- os: ubuntu-latest
47+
node: "20.x"
48+
eslint: "7.0.x"
4749
runs-on: ${{ matrix.os }}
4850
steps:
4951
- name: Checkout
@@ -57,10 +59,7 @@ jobs:
5759
- name: Install Packages
5860
run: npm install
5961
- 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
6262
run: |
63-
npm install --no-save eslint@${{ matrix.eslint }}
64-
npm install --no-save eslint@${{ matrix.eslint }}
63+
npm install --no-save --force eslint@${{ matrix.eslint }}
6564
- name: Test
6665
run: npm run -s test:ci

‎lib/configs/recommended-module.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const { commonRules } = require("./_commons")
77
module.exports.eslintrc = {
88
env: {
99
node: true,
10-
es2021: true,
1110
},
1211
globals: {
12+
...globals.es2021,
1313
__dirname: "off",
1414
__filename: "off",
1515
exports: "off",
@@ -36,7 +36,6 @@ module.exports.flat = {
3636
sourceType: "module",
3737
globals: {
3838
...globals.node,
39-
...globals.es2021,
4039
...module.exports.eslintrc.globals,
4140
},
4241
},

‎lib/configs/recommended-script.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const { commonRules } = require("./_commons")
77
module.exports.eslintrc = {
88
env: {
99
node: true,
10-
es2021: true,
1110
},
1211
globals: {
12+
...globals.es2021,
1313
__dirname: "readonly",
1414
__filename: "readonly",
1515
exports: "writable",
@@ -33,7 +33,6 @@ module.exports.flat = {
3333
sourceType: "commonjs",
3434
globals: {
3535
...globals.node,
36-
...globals.es2021,
3736
...module.exports.eslintrc.globals,
3837
},
3938
},

‎lib/util/is-typescript.js

+4-1
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)
Please sign in to comment.