|
| 1 | +// @ts-check |
| 2 | +import eslint from "@eslint/js"; |
| 3 | +import tseslint from "typescript-eslint"; |
| 4 | +import globals from "globals"; |
| 5 | + |
| 6 | +export default tseslint.config( |
| 7 | + { |
| 8 | + ignores: ["**/thrift/bindings/**", "dist/**"], |
| 9 | + }, |
| 10 | + { |
| 11 | + extends: [ |
| 12 | + eslint.configs.recommended, |
| 13 | + ...tseslint.configs.recommended, |
| 14 | + ], |
| 15 | + files: ["**/*.ts"], |
| 16 | + languageOptions: { |
| 17 | + globals: globals.node, |
| 18 | + parserOptions: { |
| 19 | + project: ["./tsconfig.json"], |
| 20 | + }, |
| 21 | + }, |
| 22 | + rules: { |
| 23 | + "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], // Same as in tsconfig. Allow such vars if they start with an underscore. |
| 24 | + "require-await": "error", // Helps catch missing awaits |
| 25 | + "strict": "error", // Disallows use of e.g. reserved keywords |
| 26 | + "prefer-promise-reject-errors": "error", // Throwing real Errors helps traceability |
| 27 | + "@typescript-eslint/no-namespace": "off", |
| 28 | + "@typescript-eslint/prefer-readonly": "error", |
| 29 | + "@typescript-eslint/consistent-type-definitions": "error", // Prefer 'interface' over 'type' |
| 30 | + "@typescript-eslint/no-non-null-assertion": "warn", |
| 31 | + "no-empty": "off", // Empty catch blocks can be useful |
| 32 | + "no-inner-declarations": "off", // Seems to break when using TS namespaces |
| 33 | + "eqeqeq": "error", // == can be obscure/unintuitive, so use === |
| 34 | + "@typescript-eslint/no-deprecated": "warn", |
| 35 | + // CODE FORMATTING ================= |
| 36 | + "semi": "warn", |
| 37 | + "camelcase": "warn", |
| 38 | + "indent": ["warn", 4], |
| 39 | + "space-before-blocks": "warn", |
| 40 | + "keyword-spacing": "warn", |
| 41 | + "space-before-function-paren": ["warn", "never"], |
| 42 | + "dot-location": "warn", |
| 43 | + "quotes": ["warn", "double", { "allowTemplateLiterals": true }], // Disallows single quote strings |
| 44 | + "comma-spacing": "warn", |
| 45 | + "brace-style": "warn", |
| 46 | + "no-trailing-spaces": "warn", |
| 47 | + }, |
| 48 | + }, |
| 49 | +); |
0 commit comments