|
| 1 | +import eslint from "@eslint/js"; |
| 2 | +import eslintConfigPrettier from "eslint-config-prettier/flat"; |
| 3 | +import importPlugin from "eslint-plugin-import"; |
| 4 | +import mochaPlugin from "eslint-plugin-mocha"; |
| 5 | +import pluginPromise from "eslint-plugin-promise"; |
| 6 | +// eslint-disable-next-line import/no-unresolved |
| 7 | +import { defineConfig, globalIgnores } from "eslint/config"; |
| 8 | +import globals from "globals"; |
| 9 | + |
| 10 | +export default defineConfig([ |
| 11 | + globalIgnores(["docs/**", "dist/**", "bin/**"]), |
| 12 | + eslint.configs.recommended, |
| 13 | + mochaPlugin.configs.flat.recommended, |
| 14 | + importPlugin.flatConfigs.recommended, |
| 15 | + pluginPromise.configs["flat/recommended"], |
| 16 | + { |
| 17 | + files: ["**/*.{cjs,mjs,js}"], |
| 18 | + languageOptions: { |
| 19 | + ecmaVersion: 2020, |
| 20 | + sourceType: "module", |
| 21 | + globals: { |
| 22 | + ...globals.node, |
| 23 | + }, |
| 24 | + }, |
| 25 | + rules: { |
| 26 | + "no-undef": "error", |
| 27 | + "no-unreachable": 1, |
| 28 | + "no-empty": "error", |
| 29 | + "array-callback-return": "error", |
| 30 | + "no-var": "error", |
| 31 | + "prefer-const": "error", |
| 32 | + "no-template-curly-in-string": "error", |
| 33 | + "consistent-return": "error", |
| 34 | + "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0 }], |
| 35 | + "arrow-body-style": ["error", "as-needed"], |
| 36 | + "prefer-arrow-callback": ["error", { allowNamedFunctions: true }], |
| 37 | + "prefer-destructuring": ["error", { object: true, array: false }], |
| 38 | + "prefer-spread": "error", |
| 39 | + "prefer-rest-params": "error", |
| 40 | + "import/no-unresolved": "error", |
| 41 | + "import/named": "off", //temp |
| 42 | + "import/default": "error", |
| 43 | + "import/namespace": "error", |
| 44 | + "no-unused-vars": "off", |
| 45 | + "no-debugger": "error", |
| 46 | + strict: "error", |
| 47 | + }, |
| 48 | + }, |
| 49 | + { |
| 50 | + files: ["**/*.spec.js"], |
| 51 | + languageOptions: { |
| 52 | + globals: { |
| 53 | + ...globals.mocha, |
| 54 | + }, |
| 55 | + }, |
| 56 | + rules: { |
| 57 | + "prefer-arrow-callback": "off", |
| 58 | + "mocha/no-setup-in-describe": "off", |
| 59 | + "promise/no-callback-in-promise": "off", |
| 60 | + "promise/catch-or-return": "off", |
| 61 | + "promise/always-return": "off", |
| 62 | + "mocha/no-mocha-arrows": "off", |
| 63 | + }, |
| 64 | + extends: [], |
| 65 | + }, |
| 66 | + eslintConfigPrettier, // goes last |
| 67 | +]); |
0 commit comments