-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
112 lines (104 loc) · 2.72 KB
/
.eslintrc.js
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
module.exports = {
extends: [
'eslint:recommended',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'prettier',
],
plugins: ['unicorn'],
rules: {
// Base
'no-shadow': 'error',
'no-warning-comments': 'off',
'no-console': 'warn', // doesn't seem to be enabled in any preset
'no-restricted-imports': [
'error',
{
name: '@supabase/auth-helpers-react',
importNames: ['useSupabaseClient'],
message: 'Please import from `~/hooks/useSupabaseClient` instead.',
},
{
name: 'next/link',
message: 'Please import from `~/components/RouteLink` instead.',
},
],
// React
'react/jsx-no-undef': 'off',
'react/self-closing-comp': 'error',
'react/react-in-jsx-scope': 'off',
'react/jsx-boolean-value': 'error',
'react/no-unknown-property': 'off', // started to report many weird errors recently
// Import
'import/newline-after-import': 'error',
'import/order': [
'error',
{
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
},
],
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
// Unicorn
'unicorn/no-for-loop': 'error',
'unicorn/no-array-for-each': 'error',
'unicorn/no-array-reduce': 'error',
},
overrides: [
// TypeScript
{
files: ['**/*.ts?(x)'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
/*
* Linting with Type Information only for TS files:
* https://typescript-eslint.io/docs/linting/typed-linting/#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided
*/
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
],
rules: {
'@typescript-eslint/array-type': [
'warn',
{
default: 'generic',
},
],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: {
arguments: false,
attributes: false,
},
},
],
// Disabling because of index errors on interfaces,
// which works fine in type aliases:
// https://bobbyhadz.com/blog/typescript-index-signature-for-type-is-missing-in-type
'@typescript-eslint/consistent-type-definitions': 'off',
// Disabling because it's too strict:
// we are interested in using || operator multiple times to avoid empty strings.
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
},
],
}