|
| 1 | +const globals = require("globals"); |
| 2 | +const js = require("@eslint/js"); |
| 3 | +const ts = require("typescript-eslint"); |
| 4 | +const jest = require("eslint-plugin-jest"); |
| 5 | + |
| 6 | +module.exports = ts.config( |
| 7 | + js.configs.recommended, |
| 8 | + ts.configs.recommended, |
| 9 | + ts.configs.strict, |
| 10 | + jest.configs["flat/recommended"], |
| 11 | + { |
| 12 | + languageOptions: { |
| 13 | + globals: { |
| 14 | + ...globals.node, |
| 15 | + }, |
| 16 | + }, |
| 17 | + |
| 18 | + rules: { |
| 19 | + "no-console": 0, |
| 20 | + |
| 21 | + "accessor-pairs": [ |
| 22 | + 2, |
| 23 | + { |
| 24 | + getWithoutSet: true, |
| 25 | + }, |
| 26 | + ], |
| 27 | + |
| 28 | + "default-case": 2, |
| 29 | + |
| 30 | + "dot-notation": [ |
| 31 | + 2, |
| 32 | + { |
| 33 | + allowKeywords: true, |
| 34 | + allowPattern: "^[a-z]+(_[a-z]+)+$", |
| 35 | + }, |
| 36 | + ], |
| 37 | + |
| 38 | + eqeqeq: [ |
| 39 | + "error", |
| 40 | + "always", |
| 41 | + { |
| 42 | + null: "ignore", |
| 43 | + }, |
| 44 | + ], |
| 45 | + |
| 46 | + "guard-for-in": 2, |
| 47 | + "no-alert": 2, |
| 48 | + "no-caller": 2, |
| 49 | + "no-div-regex": 2, |
| 50 | + "no-eval": 2, |
| 51 | + "no-extra-bind": 2, |
| 52 | + |
| 53 | + "no-implicit-coercion": [ |
| 54 | + 2, |
| 55 | + { |
| 56 | + boolean: true, |
| 57 | + number: true, |
| 58 | + string: true, |
| 59 | + }, |
| 60 | + ], |
| 61 | + |
| 62 | + "no-implied-eval": 2, |
| 63 | + "no-invalid-this": 2, |
| 64 | + "no-iterator": 2, |
| 65 | + "no-lone-blocks": 2, |
| 66 | + "no-loop-func": 2, |
| 67 | + "no-multi-str": 2, |
| 68 | + |
| 69 | + "no-native-reassign": [ |
| 70 | + 2, |
| 71 | + { |
| 72 | + exceptions: [], |
| 73 | + }, |
| 74 | + ], |
| 75 | + |
| 76 | + "no-new-func": 2, |
| 77 | + "no-new-wrappers": 2, |
| 78 | + "no-new": 2, |
| 79 | + "no-octal-escape": 2, |
| 80 | + "no-proto": 2, |
| 81 | + "no-return-assign": [2, "except-parens"], |
| 82 | + "no-script-url": 2, |
| 83 | + "no-self-compare": 2, |
| 84 | + "no-sequences": 2, |
| 85 | + "no-throw-literal": 2, |
| 86 | + |
| 87 | + "no-unused-expressions": [ |
| 88 | + 2, |
| 89 | + { |
| 90 | + allowShortCircuit: true, |
| 91 | + allowTernary: true, |
| 92 | + }, |
| 93 | + ], |
| 94 | + |
| 95 | + "no-useless-call": 2, |
| 96 | + "no-useless-concat": 2, |
| 97 | + "no-void": 2, |
| 98 | + |
| 99 | + "no-warning-comments": [ |
| 100 | + 2, |
| 101 | + { |
| 102 | + terms: ["todo", "fixme", "xxx"], |
| 103 | + location: "anywhere", |
| 104 | + }, |
| 105 | + ], |
| 106 | + |
| 107 | + radix: [2, "always"], |
| 108 | + |
| 109 | + yoda: [ |
| 110 | + 2, |
| 111 | + "never", |
| 112 | + { |
| 113 | + exceptRange: false, |
| 114 | + onlyEquality: false, |
| 115 | + }, |
| 116 | + ], |
| 117 | + |
| 118 | + "init-declarations": [2, "always"], |
| 119 | + "no-catch-shadow": 2, |
| 120 | + "no-label-var": 2, |
| 121 | + "no-shadow": 2, |
| 122 | + "no-shadow-restricted-names": 2, |
| 123 | + "no-undef-init": 2, |
| 124 | + "callback-return": [2, ["callback", "cb", "next"]], |
| 125 | + "global-require": 2, |
| 126 | + "handle-callback-err": [2, "^(err|error)$"], |
| 127 | + "no-new-require": 2, |
| 128 | + "no-path-concat": 2, |
| 129 | + "no-process-exit": 2, |
| 130 | + "no-sync": 2, |
| 131 | + "consistent-this": [2, "that"], |
| 132 | + |
| 133 | + "func-style": [ |
| 134 | + 2, |
| 135 | + "declaration", |
| 136 | + { |
| 137 | + allowArrowFunctions: false, |
| 138 | + }, |
| 139 | + ], |
| 140 | + |
| 141 | + "max-nested-callbacks": [2, 5], |
| 142 | + "no-array-constructor": 2, |
| 143 | + "no-lonely-if": 2, |
| 144 | + "no-negated-condition": 2, |
| 145 | + "no-nested-ternary": 2, |
| 146 | + "no-new-object": 2, |
| 147 | + |
| 148 | + "no-underscore-dangle": [ |
| 149 | + 2, |
| 150 | + { |
| 151 | + allow: [], |
| 152 | + }, |
| 153 | + ], |
| 154 | + |
| 155 | + "no-unneeded-ternary": 2, |
| 156 | + "operator-assignment": [2, "always"], |
| 157 | + "spaced-comment": [2, "always"], |
| 158 | + "arrow-body-style": [2, "as-needed"], |
| 159 | + "object-shorthand": [2, "properties"], |
| 160 | + "prefer-arrow-callback": 2, |
| 161 | + "prefer-const": 2, |
| 162 | + "prefer-spread": 2, |
| 163 | + "prefer-template": 2, |
| 164 | + "consistent-return": "error", |
| 165 | + }, |
| 166 | + }, |
| 167 | +); |
0 commit comments