|
| 1 | +import { defineConfig } from "eslint/config"; |
| 2 | +import globals from "globals"; |
| 3 | +import js from "@eslint/js"; |
| 4 | +import n from "eslint-plugin-n"; |
| 5 | +import unicorn from "eslint-plugin-unicorn"; |
| 6 | +import tseslint from "typescript-eslint"; |
| 7 | +import eslintConfigPrettier from "eslint-config-prettier"; |
| 8 | + |
| 9 | +export default defineConfig([ |
| 10 | + js.configs.recommended, |
| 11 | + n.configs["flat/recommended"], |
| 12 | + unicorn.configs.recommended, |
| 13 | + tseslint.configs.recommended, |
| 14 | + eslintConfigPrettier, |
| 15 | + { |
| 16 | + languageOptions: { |
| 17 | + globals: { |
| 18 | + ...globals.node, |
| 19 | + }, |
| 20 | + }, |
| 21 | + |
| 22 | + rules: { |
| 23 | + eqeqeq: [2, "smart"], |
| 24 | + "no-caller": 2, |
| 25 | + "dot-notation": 2, |
| 26 | + "no-var": 2, |
| 27 | + "prefer-const": 2, |
| 28 | + |
| 29 | + "prefer-arrow-callback": [ |
| 30 | + 2, |
| 31 | + { |
| 32 | + allowNamedFunctions: true, |
| 33 | + }, |
| 34 | + ], |
| 35 | + |
| 36 | + "arrow-body-style": [2, "as-needed"], |
| 37 | + "object-shorthand": 2, |
| 38 | + "prefer-template": 2, |
| 39 | + "one-var": [2, "never"], |
| 40 | + |
| 41 | + "prefer-destructuring": [ |
| 42 | + 2, |
| 43 | + { |
| 44 | + object: true, |
| 45 | + }, |
| 46 | + ], |
| 47 | + |
| 48 | + "capitalized-comments": 2, |
| 49 | + "multiline-comment-style": [2, "starred-block"], |
| 50 | + "spaced-comment": 2, |
| 51 | + yoda: [2, "never"], |
| 52 | + curly: [2, "multi-line"], |
| 53 | + "no-else-return": 2, |
| 54 | + "n/no-unpublished-import": 0, |
| 55 | + |
| 56 | + "unicorn/filename-case": [ |
| 57 | + 2, |
| 58 | + { |
| 59 | + cases: { |
| 60 | + camelCase: true, |
| 61 | + pascalCase: true, |
| 62 | + }, |
| 63 | + }, |
| 64 | + ], |
| 65 | + |
| 66 | + "unicorn/no-null": 0, |
| 67 | + "unicorn/prefer-code-point": 0, |
| 68 | + "unicorn/prefer-string-slice": 0, |
| 69 | + "unicorn/prefer-add-event-listener": 0, |
| 70 | + "unicorn/prefer-at": 0, |
| 71 | + "unicorn/prefer-string-replace-all": 0, |
| 72 | + }, |
| 73 | + }, |
| 74 | + { |
| 75 | + files: ["**/*.ts"], |
| 76 | + |
| 77 | + languageOptions: { |
| 78 | + sourceType: "module", |
| 79 | + parser: tseslint.parser, |
| 80 | + |
| 81 | + parserOptions: { |
| 82 | + project: "./tsconfig.json", |
| 83 | + }, |
| 84 | + }, |
| 85 | + |
| 86 | + rules: { |
| 87 | + curly: [2, "multi-line"], |
| 88 | + "@typescript-eslint/prefer-for-of": 0, |
| 89 | + "@typescript-eslint/member-ordering": 0, |
| 90 | + "@typescript-eslint/explicit-function-return-type": 0, |
| 91 | + "@typescript-eslint/no-unused-vars": 0, |
| 92 | + |
| 93 | + "@typescript-eslint/no-use-before-define": [ |
| 94 | + 2, |
| 95 | + { |
| 96 | + functions: false, |
| 97 | + }, |
| 98 | + ], |
| 99 | + |
| 100 | + "@typescript-eslint/consistent-type-definitions": [2, "interface"], |
| 101 | + "@typescript-eslint/prefer-function-type": 2, |
| 102 | + "@typescript-eslint/no-unnecessary-type-arguments": 2, |
| 103 | + "@typescript-eslint/prefer-string-starts-ends-with": 2, |
| 104 | + "@typescript-eslint/prefer-readonly": 2, |
| 105 | + "@typescript-eslint/prefer-includes": 2, |
| 106 | + "@typescript-eslint/no-unnecessary-condition": 2, |
| 107 | + "@typescript-eslint/switch-exhaustiveness-check": 2, |
| 108 | + "@typescript-eslint/prefer-nullish-coalescing": 2, |
| 109 | + |
| 110 | + "@typescript-eslint/consistent-type-imports": [ |
| 111 | + 2, |
| 112 | + { |
| 113 | + fixStyle: "inline-type-imports", |
| 114 | + }, |
| 115 | + ], |
| 116 | + |
| 117 | + "@typescript-eslint/consistent-type-exports": 2, |
| 118 | + "n/no-missing-import": 0, |
| 119 | + "n/no-unsupported-features/es-syntax": 0, |
| 120 | + }, |
| 121 | + }, |
| 122 | + { |
| 123 | + files: ["**/*.spec.ts"], |
| 124 | + |
| 125 | + rules: { |
| 126 | + "n/no-unsupported-features/node-builtins": 0, |
| 127 | + }, |
| 128 | + }, |
| 129 | +]); |
0 commit comments