Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eslint 7.0 support #156

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/CI.yml
Expand Up @@ -31,10 +31,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
eslint: [8.x, 7.x]
eslint: [8.x]
node: [18.x, 20.x]
include:
# run on node lts(ubuntu-latest)
- os: ubuntu-latest
node: "16.0.x"
eslint: "8.x"
Expand All @@ -44,6 +43,9 @@ jobs:
- os: ubuntu-latest
node: "19.x"
eslint: "8.x"
- os: ubuntu-latest
node: "20.x"
eslint: "7.0.x"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -57,10 +59,7 @@ jobs:
- name: Install Packages
run: npm install
- name: Install ESLint ${{ matrix.eslint }}
# We need to execute this command twice because of npm's bug.
# See also: https://npm.community/t/error-node-modules-staging-eslint-e7cf6846-node-modules-eslint
run: |
npm install --no-save eslint@${{ matrix.eslint }}
npm install --no-save eslint@${{ matrix.eslint }}
npm install --no-save --force eslint@${{ matrix.eslint }}
- name: Test
run: npm run -s test:ci
3 changes: 1 addition & 2 deletions lib/configs/recommended-module.js
Expand Up @@ -7,9 +7,9 @@ const { commonRules } = require("./_commons")
module.exports.eslintrc = {
env: {
node: true,
es2021: true,
},
globals: {
...globals.es2021,
__dirname: "off",
__filename: "off",
exports: "off",
Expand All @@ -36,7 +36,6 @@ module.exports.flat = {
sourceType: "module",
globals: {
...globals.node,
...globals.es2021,
...module.exports.eslintrc.globals,
},
},
Expand Down
3 changes: 1 addition & 2 deletions lib/configs/recommended-script.js
Expand Up @@ -7,9 +7,9 @@ const { commonRules } = require("./_commons")
module.exports.eslintrc = {
env: {
node: true,
es2021: true,
},
globals: {
...globals.es2021,
__dirname: "readonly",
__filename: "readonly",
exports: "writable",
Expand All @@ -33,7 +33,6 @@ module.exports.flat = {
sourceType: "commonjs",
globals: {
...globals.node,
...globals.es2021,
...module.exports.eslintrc.globals,
},
},
Expand Down
5 changes: 4 additions & 1 deletion lib/util/is-typescript.js
Expand Up @@ -12,7 +12,10 @@ const typescriptExtensions = [".ts", ".tsx", ".cts", ".mts"]
*/
module.exports = function isTypescript(context) {
const sourceFileExt = path.extname(
context.physicalFilename ?? context.getPhysicalFilename()
context.physicalFilename ??
context.getPhysicalFilename?.() ??
context.filename ??
context.getFilename?.()
)
return typescriptExtensions.includes(sourceFileExt)
}