diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 592e8e8..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "env": { - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 2022 - }, - "rules": {} -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..bf820c8 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,23 @@ +const js = require("@eslint/js"); +const globals = require("globals"); + +module.exports = [ + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 2022, + globals: { + ...globals.node, + ...globals.es6, + }, + }, + }, + { + files: ["tests/**"], + languageOptions: { + globals: { + ...globals.mocha, + }, + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index 51176c4..ff2c7e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ }, "devDependencies": { "eslint": "^9.1.1", + "globals": "^15.1.0", "is-pdf": "^1.0.0", "metalsmith": "^2.4.0", "mocha": "^10.0.0", @@ -379,6 +380,18 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/eslintrc/node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -2287,9 +2300,9 @@ } }, "node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.1.0.tgz", + "integrity": "sha512-926gJqg+4mkxwYKiFvoomM4J0kWESfk3qfTvRL2/oc/tK/eTDBbrfcKnSa2KtfdxB5onoL7D3A3qIHQFpd4+UA==", "dev": true, "engines": { "node": ">=18" diff --git a/package.json b/package.json index df3cd94..9b7abda 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "npm run lint && mocha --timeout 8000 tests", "coverage": "nyc -x tests mocha --timeout 8000 tests", - "lint": "prettier -c . && ESLINT_USE_FLAT_CONFIG=false eslint ." + "lint": "prettier -c . && eslint ." }, "repository": { "type": "git", @@ -33,6 +33,7 @@ }, "devDependencies": { "eslint": "^9.1.1", + "globals": "^15.1.0", "is-pdf": "^1.0.0", "metalsmith": "^2.4.0", "mocha": "^10.0.0", diff --git a/tests/.eslintrc.json b/tests/.eslintrc.json deleted file mode 100644 index 7eeefc3..0000000 --- a/tests/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "mocha": true - } -}