|
| 1 | +parser: "@typescript-eslint/parser" |
| 2 | + |
| 3 | +parserOptions: |
| 4 | + ecmaFeatures: |
| 5 | + jsx: true |
| 6 | + ecmaVersion: latest |
| 7 | + sourceType: module |
| 8 | + |
| 9 | +globals: |
| 10 | + Deno: readonly |
| 11 | + |
| 12 | +env: |
| 13 | + browser: true |
| 14 | + es6: true |
| 15 | + node: true |
| 16 | + jest: true |
| 17 | + |
| 18 | +plugins: |
| 19 | + - import |
| 20 | + - sonarjs |
| 21 | + |
| 22 | +extends: |
| 23 | + - eslint:recommended |
| 24 | + - plugin:sonarjs/recommended |
| 25 | + - plugin:prettier/recommended |
| 26 | + |
| 27 | +rules: |
| 28 | + # 0 = off, 1 = warn, 2 = error |
| 29 | + "space-before-function-paren": 0 |
| 30 | + "no-useless-constructor": 0 |
| 31 | + "no-undef": 2 |
| 32 | + "no-console": [2, { allow: ["error", "warn", "info", "assert"] }] |
| 33 | + "comma-dangle": ["error", "only-multiline"] |
| 34 | + "no-unused-vars": 0 |
| 35 | + "no-var": 2 |
| 36 | + "one-var-declaration-per-line": 2 |
| 37 | + "prefer-const": 2 |
| 38 | + "no-const-assign": 2 |
| 39 | + "no-duplicate-imports": 2 |
| 40 | + "no-use-before-define": [2, { "functions": false, "classes": false }] |
| 41 | + "eqeqeq": [2, "always", { "null": "ignore" }] |
| 42 | + "no-case-declarations": 0 |
| 43 | + "no-restricted-syntax": |
| 44 | + [ |
| 45 | + 2, |
| 46 | + { |
| 47 | + "selector": "BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]", |
| 48 | + "message": Don't compare for equality against boolean literals, |
| 49 | + }, |
| 50 | + ] |
| 51 | + |
| 52 | + # https://github.com/benmosher/eslint-plugin-import/pull/334 |
| 53 | + "import/no-duplicates": 2 |
| 54 | + "import/first": 2 |
| 55 | + "import/newline-after-import": 2 |
| 56 | + "import/order": |
| 57 | + [ |
| 58 | + 2, |
| 59 | + { |
| 60 | + "newlines-between": "always", |
| 61 | + "alphabetize": { "order": "asc" }, |
| 62 | + "groups": |
| 63 | + ["builtin", "external", "internal", "parent", "sibling", "index"], |
| 64 | + }, |
| 65 | + ] |
| 66 | + |
| 67 | + "sonarjs/cognitive-complexity": 0 |
| 68 | + "sonarjs/no-duplicate-string": 0 |
| 69 | + "sonarjs/no-big-function": 0 |
| 70 | + "sonarjs/no-identical-functions": 0 |
| 71 | + "sonarjs/no-small-switch": 0 |
| 72 | + |
| 73 | +overrides: |
| 74 | + - files: |
| 75 | + - ./**/*.{ts,tsx} |
| 76 | + rules: |
| 77 | + "no-unused-vars": |
| 78 | + [ |
| 79 | + 2, |
| 80 | + { |
| 81 | + varsIgnorePattern: "^_", |
| 82 | + argsIgnorePattern: "^_", |
| 83 | + ignoreRestSiblings: true, |
| 84 | + }, |
| 85 | + ] |
| 86 | + |
| 87 | + - files: |
| 88 | + - ./**/*{.ts,.tsx} |
| 89 | + plugins: |
| 90 | + - "@typescript-eslint" |
| 91 | + parserOptions: |
| 92 | + project: ./tsconfig.json |
| 93 | + rules: |
| 94 | + "no-undef": 0 |
| 95 | + # TypeScript declare merge |
| 96 | + "no-redeclare": 0 |
| 97 | + "no-useless-constructor": 0 |
| 98 | + "no-unused-vars": 0 |
| 99 | + "no-dupe-class-members": 0 |
| 100 | + "no-case-declarations": 0 |
| 101 | + "no-duplicate-imports": 0 |
| 102 | + # TypeScript Interface and Type |
| 103 | + "no-use-before-define": 0 |
| 104 | + |
| 105 | + "@typescript-eslint/adjacent-overload-signatures": 2 |
| 106 | + "@typescript-eslint/await-thenable": 2 |
| 107 | + "@typescript-eslint/consistent-type-assertions": 2 |
| 108 | + "@typescript-eslint/ban-types": |
| 109 | + [ |
| 110 | + "error", |
| 111 | + { |
| 112 | + "types": |
| 113 | + { |
| 114 | + "String": |
| 115 | + { "message": "Use string instead", "fixWith": "string" }, |
| 116 | + "Number": |
| 117 | + { "message": "Use number instead", "fixWith": "number" }, |
| 118 | + "Boolean": |
| 119 | + { "message": "Use boolean instead", "fixWith": "boolean" }, |
| 120 | + "Function": { "message": "Use explicit type instead" }, |
| 121 | + }, |
| 122 | + }, |
| 123 | + ] |
| 124 | + "@typescript-eslint/explicit-member-accessibility": |
| 125 | + [ |
| 126 | + "error", |
| 127 | + { |
| 128 | + accessibility: "explicit", |
| 129 | + overrides: |
| 130 | + { |
| 131 | + accessors: "no-public", |
| 132 | + constructors: "no-public", |
| 133 | + methods: "no-public", |
| 134 | + properties: "no-public", |
| 135 | + parameterProperties: "explicit", |
| 136 | + }, |
| 137 | + }, |
| 138 | + ] |
| 139 | + "@typescript-eslint/method-signature-style": 2 |
| 140 | + "@typescript-eslint/no-floating-promises": 2 |
| 141 | + "@typescript-eslint/no-implied-eval": 2 |
| 142 | + "@typescript-eslint/no-for-in-array": 2 |
| 143 | + "@typescript-eslint/no-inferrable-types": 2 |
| 144 | + "@typescript-eslint/no-invalid-void-type": 2 |
| 145 | + "@typescript-eslint/no-misused-new": 2 |
| 146 | + "@typescript-eslint/no-misused-promises": 2 |
| 147 | + "@typescript-eslint/no-namespace": 2 |
| 148 | + "@typescript-eslint/no-non-null-asserted-optional-chain": 2 |
| 149 | + "@typescript-eslint/no-throw-literal": 2 |
| 150 | + "@typescript-eslint/no-unnecessary-boolean-literal-compare": 2 |
| 151 | + "@typescript-eslint/prefer-for-of": 2 |
| 152 | + "@typescript-eslint/prefer-nullish-coalescing": 2 |
| 153 | + "@typescript-eslint/switch-exhaustiveness-check": 2 |
| 154 | + "@typescript-eslint/prefer-optional-chain": 2 |
| 155 | + "@typescript-eslint/prefer-readonly": 2 |
| 156 | + "@typescript-eslint/prefer-string-starts-ends-with": 0 |
| 157 | + "@typescript-eslint/no-array-constructor": 2 |
| 158 | + "@typescript-eslint/require-await": 2 |
| 159 | + "@typescript-eslint/return-await": 2 |
| 160 | + "@typescript-eslint/ban-ts-comment": |
| 161 | + [ |
| 162 | + 2, |
| 163 | + { |
| 164 | + "ts-expect-error": false, |
| 165 | + "ts-ignore": true, |
| 166 | + "ts-nocheck": true, |
| 167 | + "ts-check": false, |
| 168 | + }, |
| 169 | + ] |
| 170 | + "@typescript-eslint/naming-convention": |
| 171 | + [ |
| 172 | + 2, |
| 173 | + { |
| 174 | + selector: "memberLike", |
| 175 | + format: ["camelCase", "PascalCase"], |
| 176 | + modifiers: ["private"], |
| 177 | + leadingUnderscore: "forbid", |
| 178 | + }, |
| 179 | + ] |
| 180 | + "@typescript-eslint/no-unused-vars": |
| 181 | + [ |
| 182 | + 2, |
| 183 | + { |
| 184 | + varsIgnorePattern: "^_", |
| 185 | + argsIgnorePattern: "^_", |
| 186 | + ignoreRestSiblings: true, |
| 187 | + }, |
| 188 | + ] |
| 189 | + "@typescript-eslint/member-ordering": |
| 190 | + [ |
| 191 | + 2, |
| 192 | + { |
| 193 | + default: |
| 194 | + [ |
| 195 | + "public-static-field", |
| 196 | + "protected-static-field", |
| 197 | + "private-static-field", |
| 198 | + "public-static-method", |
| 199 | + "protected-static-method", |
| 200 | + "private-static-method", |
| 201 | + "public-instance-field", |
| 202 | + "protected-instance-field", |
| 203 | + "private-instance-field", |
| 204 | + "public-constructor", |
| 205 | + "protected-constructor", |
| 206 | + "private-constructor", |
| 207 | + "public-instance-method", |
| 208 | + "protected-instance-method", |
| 209 | + "private-instance-method", |
| 210 | + ], |
| 211 | + }, |
| 212 | + ] |
0 commit comments