-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
.eslintrc.yaml
151 lines (126 loc) · 3.61 KB
/
.eslintrc.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
env:
browser: true
extends:
- eslint:recommended
- plugin:prettier/recommended
- plugin:@typescript-eslint/recommended
- plugin:react/recommended
- plugin:react-hooks/recommended
- plugin:@tanstack/eslint-plugin-query/recommended
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
- simple-import-sort
- import
- jsx-a11y
- unicorn
- vitest
ignorePatterns:
- generated.d.ts
- ziggy.d.ts
settings:
# allows for tsconfig path aliases
import/resolver:
typescript: {} # this loads tsconfig.json to eslint
react:
version: detect
globals:
Atomics: readonly
SharedArrayBuffer: readonly
# very basic javascript
parserOptions:
ecmaVersion: 6
sourceType: module
rules:
# some javascript functions are used within html attributes rendered within php
no-unused-vars: off
max-len: off
# eslint doesn't like itself
prefer-destructuring: off
# yeah, we're polluting the global namespace with jquery...
no-undef: off
# ouch. refactor affected code...
no-eval: off
# let's at least have console output. at least no alerts, right? right!?
no-console: off
# ++ in for loop
no-plusplus: off
# ecmaVersion 5...
comma-dangle: off
no-alert: off # still using confirm() dialog
no-restricted-globals: off # still using confirm() dialog
no-loop-func: off
no-shadow: off # typescript-eslint is not happy about injecting Alpine and/or utils into `window`
no-param-reassign: off
no-var: off
object-shorthand: off
prefer-arrow-callback: off
prefer-rest-params: off
prefer-template: off
func-names: off
no-useless-escape: off # not so sure about regex there it seems
no-use-before-define: off
vars-on-top: off
# sort and organize imports/exports
simple-import-sort/imports: error
simple-import-sort/exports: error
import/first: error
import/newline-after-import: error
import/no-duplicates: error
# typescript niceties
'@typescript-eslint/consistent-type-imports': error
# tailwind.config.js
global-require: off
# set up prettier as an eslint plugin
prettier/prettier:
- error
- {
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"tailwindAttributes":
[
"anchorClassName",
"containerClassName",
"gameTitleClassName",
"wrapperClassName",
],
"plugins": ["prettier-plugin-tailwindcss"]
}
# some react recommended rules are fine to avoid in typescript projects
react/display-name: off
react/no-unescaped-entities: off
react/prop-types: off
react/react-in-jsx-scope: off
react/jsx-no-target-blank: off # we don't support the old browsers this rule tries to protect
react/jsx-no-literals: error # enforce i18n
# disable some of the more aggressive unicorn rules
unicorn/filename-case: off
unicorn/no-array-callback-reference: off
unicorn/no-array-for-each: warn
unicorn/no-null: off
unicorn/prefer-module: off
unicorn/prefer-node-protocol: off
unicorn/prefer-switch: off
# similar to pint, force a newline before return statements
newline-before-return: error
# prevent accidental imports from libraries that build the Base* components
no-restricted-imports:
- error
- patterns:
- '@testing-library/react'
- '@radix-ui/*'
- 'sonner'
- 'vaul'
# don't enforce explicit-any rule in test files
overrides:
- files:
- "*.test.ts"
- "*.test.tsx"
extends:
- plugin:testing-library/react
rules:
"@typescript-eslint/no-explicit-any": off
testing-library/no-dom-import: off
testing-library/no-render-in-lifecycle: off
react/jsx-no-literals: off