diff --git a/.eslintrc.js b/.eslintrc.js index fdc5d9f4..564aca77 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,7 @@ /** * @author Toru Nagashima + * @deprecated + * @description the file is no longer used, and will be removed in the future. * See LICENSE file in root directory for full license. */ "use strict" diff --git a/configs/recommended-script.js b/configs/recommended-script.js index bdfa9c49..fcdfa5df 100644 --- a/configs/recommended-script.js +++ b/configs/recommended-script.js @@ -9,6 +9,6 @@ const { configs, rules } = require("../lib/index.js") module.exports = { plugins: { n: { rules } }, - languageOptions: { sourceType: "script" }, + languageOptions: { sourceType: "commonjs" }, rules: configs["recommended-script"].rules, } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..0acb41bc --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,29 @@ +/** + * @author 唯然 + */ +"use strict" + +const js = require('@eslint/js'); +const { FlatCompat } = require('@eslint/eslintrc'); +const globals = require('globals'); +const nodeRecommended = require('eslint-plugin-n/configs/recommended-script') + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, +}); + +module.exports = [ + ...compat.extends( + "eslint:recommended", + "plugin:eslint-plugin/recommended", + "prettier", + ), + nodeRecommended, + { + languageOptions: { + globals: globals.mocha + } + } + +]; diff --git a/package.json b/package.json index 6f4eff81..35e1a3f6 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "eslint": ">=7.0.0" }, "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", "builtins": "^5.0.1", "eslint-plugin-es-x": "^6.1.0", - "@eslint-community/eslint-utils": "^4.4.0", "ignore": "^5.1.1", "is-core-module": "^2.12.0", "minimatch": "^3.1.2", @@ -24,6 +24,8 @@ "semver": "^7.5.0" }, "devDependencies": { + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "^8.38.0", "@typescript-eslint/parser": "^5.59.0", "codecov": "^3.3.0", "esbuild": "^0.17.17",