|
| 1 | +import globals from "globals"; |
| 2 | +import path from "node:path"; |
| 3 | +import { fileURLToPath } from "node:url"; |
| 4 | +import js from "@eslint/js"; |
| 5 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 6 | + |
| 7 | +const __filename = fileURLToPath(import.meta.url); |
| 8 | +const __dirname = path.dirname(__filename); |
| 9 | +const compat = new FlatCompat({ |
| 10 | + baseDirectory: __dirname, |
| 11 | + recommendedConfig: js.configs.recommended, |
| 12 | + allConfig: js.configs.all |
| 13 | +}); |
| 14 | + |
| 15 | +export default [...compat.extends("eslint:recommended"), { |
| 16 | + languageOptions: { |
| 17 | + globals: { |
| 18 | + ...globals.node, |
| 19 | + it: false, |
| 20 | + describe: false, |
| 21 | + }, |
| 22 | + |
| 23 | + ecmaVersion: 2020, |
| 24 | + sourceType: "module", |
| 25 | + |
| 26 | + parserOptions: { |
| 27 | + ecmaFeatures: { |
| 28 | + impliedStrict: true, |
| 29 | + }, |
| 30 | + |
| 31 | + allowImportExportEverywhere: true, |
| 32 | + }, |
| 33 | + }, |
| 34 | + |
| 35 | + rules: { |
| 36 | + "no-eval": "error", |
| 37 | + "no-implied-eval": "error", |
| 38 | + "dot-notation": "error", |
| 39 | + eqeqeq: ["error", "smart"], |
| 40 | + "no-caller": "error", |
| 41 | + "no-extra-bind": "error", |
| 42 | + "no-unused-expressions": "error", |
| 43 | + "no-useless-call": "error", |
| 44 | + "no-useless-return": "error", |
| 45 | + radix: "warn", |
| 46 | + |
| 47 | + "no-unused-vars": ["error", { |
| 48 | + args: "none", |
| 49 | + vars: "all", |
| 50 | + }], |
| 51 | + |
| 52 | + "no-empty": ["error", { |
| 53 | + allowEmptyCatch: true, |
| 54 | + }], |
| 55 | + |
| 56 | + "no-control-regex": "off", |
| 57 | + "require-atomic-updates": "off", |
| 58 | + "no-async-promise-executor": "off", |
| 59 | + "brace-style": ["error", "1tbs"], |
| 60 | + "block-spacing": "error", |
| 61 | + "array-bracket-spacing": "error", |
| 62 | + "comma-spacing": "error", |
| 63 | + "comma-style": "error", |
| 64 | + "computed-property-spacing": "error", |
| 65 | + "no-trailing-spaces": "warn", |
| 66 | + "eol-last": "error", |
| 67 | + "func-call-spacing": "error", |
| 68 | + |
| 69 | + "key-spacing": ["warn", { |
| 70 | + mode: "minimum", |
| 71 | + }], |
| 72 | + |
| 73 | + indent: ["error", 4, { |
| 74 | + ignoreComments: true, |
| 75 | + ArrayExpression: "first", |
| 76 | + SwitchCase: 1, |
| 77 | + }], |
| 78 | + |
| 79 | + "linebreak-style": ["error", "unix"], |
| 80 | + |
| 81 | + quotes: ["error", "double", { |
| 82 | + avoidEscape: true, |
| 83 | + }], |
| 84 | + |
| 85 | + camelcase: ["error", { |
| 86 | + properties: "always", |
| 87 | + }], |
| 88 | + |
| 89 | + semi: ["error", "always"], |
| 90 | + "unicode-bom": "error", |
| 91 | + |
| 92 | + "keyword-spacing": ["error", { |
| 93 | + before: true, |
| 94 | + after: true, |
| 95 | + }], |
| 96 | + |
| 97 | + "no-multiple-empty-lines": ["warn", { |
| 98 | + max: 2, |
| 99 | + maxEOF: 1, |
| 100 | + maxBOF: 0, |
| 101 | + }], |
| 102 | + |
| 103 | + "no-whitespace-before-property": "error", |
| 104 | + "operator-linebreak": ["error", "after"], |
| 105 | + "space-in-parens": "error", |
| 106 | + "no-var": "error", |
| 107 | + "prefer-const": "error", |
| 108 | + }, |
| 109 | +}, { |
| 110 | + files: ["test/**/*"], |
| 111 | + |
| 112 | + rules: { |
| 113 | + "no-unused-expressions": "off", |
| 114 | + "no-console": "off", |
| 115 | + }, |
| 116 | +}]; |
0 commit comments