-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
65 lines (59 loc) · 3.28 KB
/
Copy patheslint.config.js
File metadata and controls
65 lines (59 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @type {import('eslint').Linter.Config<import('eslint/rules/index').ESLintRules>}
*/
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import pluginUnusedImports from "eslint-plugin-unused-imports";
import prettierConfig from "eslint-plugin-prettier/recommended";
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
export default defineConfig([
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
...nextCoreWebVitals, // react, react-hooks
prettierConfig,
{
ignores: ["supabase/generated-types.ts"],
},
{
plugins: {
"unused-imports": pluginUnusedImports,
},
rules: {
"prettier/prettier": "warn",
"@typescript-eslint/no-unused-vars": "off", // handled by "unused-imports" plugin
"unused-imports/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"unused-imports/no-unused-imports": "warn",
"react-hooks/exhaustive-deps": "off", // the amount of extra dependencies is excessive
"react-hooks/use-memo": "off", // doesn't allow using existing functions instead of arrow expressions
"@next/next/no-img-element": "off", // not a concern at the moment
"prefer-const": "warn", // prefer const when variable is not reassigned
"array-callback-return": "warn", // enforce return on Array.map() and etc.
"no-constant-binary-expression": "warn", // `a + b ?? c` is actually `(a + b) ?? c`
"@typescript-eslint/no-non-null-assertion": "off", // these are a bit much
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off", // I like || before non-returning functions, like notFound()
"@typescript-eslint/no-unnecessary-condition": "off", // types aren't always accurate, so ?. sometimes fixes stuff
"@typescript-eslint/consistent-type-definitions": "off", // sometimes type is more readable
"@typescript-eslint/prefer-optional-chain": "off", // if (!data || data.name != name)
"@typescript-eslint/unified-signatures": "off", // separate ones are more maintainable
"@typescript-eslint/no-unnecessary-type-parameters": "off", // doesn't allow enforcing a function's return type without an "as"
"@typescript-eslint/consistent-indexed-object-style": "off", // it's nice to have named parameters for indexers
"@typescript-eslint/no-empty-function": "off", // annoying when writing new code
"@typescript-eslint/method-signature-style": ["warn", "property"],
"@typescript-eslint/array-type": "warn", // prefer T[] over Array<T>
"@typescript-eslint/no-empty-object-type": ["warn", { allowInterfaces: "with-single-extends" }],
// interfaces allow to reduce huge mapped types to just an interface name in IDE tooltips
"@typescript-eslint/no-unused-expressions": ["warn", { allowShortCircuit: true, allowTernary: true }],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-namespace": ["warn", { allowDeclarations: true }],
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
},
},
},
]);