Skip to content

Commit

Permalink
deps: adjust eslint setup
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitZugmeyer committed Apr 8, 2024
1 parent 2a3cc35 commit 98359dd
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 25 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc.js

This file was deleted.

12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
- run: npm run lint
- run: npm run format
- run: node tools/toc.js check
- run: npx markdown-link-check -p README.md
# markdown-link-check disabled until https://github.com/tcort/markdown-link-check/issues/304
# is fixed
# - run: npx markdown-link-check -p README.md

integration:
runs-on: ${{ matrix.os }}
Expand All @@ -48,7 +50,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [16, 18, 20]
node: [18, 20]
eslint: [latest]
include:
# ESLint 4.7 support: lowest version supported
Expand All @@ -66,6 +68,12 @@ jobs:
node: 20
eslint: next

# Node 16 support: use ESLint v8 becacuse they dropped node 16 support in v9. Will be
# dropped in next major.
- os: ubuntu-latest
node: 16
eslint: "8"

# Windows support
- os: windows-latest
node: 20
Expand Down
38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from "@eslint/js"

export default [
js.configs.recommended,
{
rules: {
"no-constant-condition": "off",
"no-unused-vars": [
"error",
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
],
},

languageOptions: {
globals: {
process: "readonly",
console: "readonly",
require: "readonly",
module: "readonly",
Buffer: "readonly",
__dirname: "readonly",
setTimeout: "readonly",
},
},
},

{
files: ["**/__tests__/**/*.js"],
languageOptions: {
globals: {
expect: "readonly",
test: "readonly",
it: "readonly",
describe: "readonly",
},
},
},
]
3 changes: 0 additions & 3 deletions src/__tests__/.eslintrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ function iterateESLintModules(fn) {
let eslintPath, eslintVersion
try {
eslintPath = require.resolve("eslint")
} catch (e) {
} catch {
eslintPath = "(not found)"
}
try {
eslintVersion = require("eslint/package.json").version
} catch (e) {
} catch {
eslintVersion = "n/a"
}

Expand Down
2 changes: 1 addition & 1 deletion src/verifyWithFlatConfigPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const externalHtmlPlugins = [
function tryRequire(name) {
try {
return require(name)
} catch (e) {
} catch {
return undefined
}
}
Expand Down

0 comments on commit 98359dd

Please sign in to comment.