diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index c4f65cd0..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "env": { - "node": true, - "es2021": true, - "jest": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/no-var-requires": "off", - "no-case-declarations": "off", - "linebreak-style": [ - "error", - "windows" - ], - "quotes": [ - "error", - "single", - { - "avoidEscape": true - } - ], - "semi": [ - "error", - "never" - ] - } -} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..f65b8c77 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,47 @@ +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [ + ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"), + { + plugins: { + "@typescript-eslint": typescriptEslint, + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + + parser: tsParser, + ecmaVersion: "latest", + sourceType: "module", + }, + + rules: { + "@typescript-eslint/no-var-requires": "off", + "no-case-declarations": "off", + "linebreak-style": ["error", "windows"], + + quotes: ["error", "single", { + avoidEscape: true, + }], + + semi: ["error", "never"], + }, + }, +]; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e3c34e6a..757079f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "license": "UNLICENSED", "dependencies": { "@alex_neo/jest-expect-message": "^1.0.5", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.17.0", "@freearhey/core": "^0.3.1", "@freearhey/search-js": "^0.1.1", "@ntlab/sfetch": "^1.0.0", @@ -40,6 +42,7 @@ "form-data": "^4.0.0", "fs-extra": "^10.0.1", "glob": "^7.2.0", + "globals": "^15.14.0", "iconv-lite": "^0.4.24", "inquirer": "^8.2.6", "jest": "^29.7.0", @@ -641,6 +644,14 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/types": { "version": "7.23.3", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.3.tgz", @@ -4857,11 +4868,14 @@ } }, "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "version": "15.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", + "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/got": { @@ -9529,6 +9543,13 @@ "@babel/types": "^7.23.3", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + } } }, "@babel/types": { @@ -12496,9 +12517,9 @@ } }, "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + "version": "15.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", + "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==" }, "got": { "version": "11.8.5", diff --git a/package.json b/package.json index 36e3bc4d..a7ad91b9 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,8 @@ }, "dependencies": { "@alex_neo/jest-expect-message": "^1.0.5", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.17.0", "@freearhey/core": "^0.3.1", "@freearhey/search-js": "^0.1.1", "@ntlab/sfetch": "^1.0.0", @@ -60,6 +62,7 @@ "form-data": "^4.0.0", "fs-extra": "^10.0.1", "glob": "^7.2.0", + "globals": "^15.14.0", "iconv-lite": "^0.4.24", "inquirer": "^8.2.6", "jest": "^29.7.0", diff --git a/yarn.lock b/yarn.lock index 67c180ea..58a6adce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -379,7 +379,7 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.17.0": +"@eslint/js@^9.17.0", "@eslint/js@9.17.0": version "9.17.0" resolved "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz" integrity sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w== @@ -2736,6 +2736,11 @@ globals@^14.0.0: resolved "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz" integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== +globals@^15.14.0: + version "15.14.0" + resolved "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz" + integrity sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig== + got@^11.8.2: version "11.8.5" resolved "https://registry.npmjs.org/got/-/got-11.8.5.tgz"