-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
168 lines (168 loc) · 5.38 KB
/
.eslintrc.json
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
"env": {
"browser": true,
"es2022": true,
"node": true,
"jest": true
},
"extends": [
"plugin:jsdoc/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"next",
"plugin:import/recommended",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["header", "jsdoc", "@typescript-eslint", "check-file", "jest"],
"rules": {
"header/header": [
"warn",
"block",
" This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. ",
2
],
"jsdoc/tag-lines": ["error", "any", { "startLines": 1 }],
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-type": "off",
"jsdoc/require-returns-description": "off",
// Unused vars explicitly marked as such with an understore prefix are allowed:
"no-unused-vars": [
"off",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
// Unused vars that start with an understore are allowed to be unused:
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["**/hooks/*"],
"importNames": ["useGlean", "useGa"],
"message": "Please refrain from using this hook standalone. The preferred way to record telemetry is through `useTelemetry`."
}
],
"paths": [
{
// react-aria's <VisuallyHidden> component adds inline styles to
// visually hide its children, but our Content Security Policy
// disallows inline styles. By adding the equivalent styles to a CSS
// file, which automatically gets added to our Content Security
// Policy, our own <VisuallyHidden> component avoids this
// restriction.
"name": "react-aria",
"importNames": ["VisuallyHidden"],
"message":
"Please use the <VisuallyHidden> component from `/src/app/components/server/VisuallyHidden.tsx` instead of the one from react-aria, since the latter's (inline) styles will be stripped by our Content Security Policy."
}
]
}
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
],
"check-file/filename-naming-convention": [
"error",
{
"**/*.{js,css} !src/db/migrations": "CAMEL_CASE"
},
{
"ignoreMiddleExtensions": true
}
]
},
"overrides": [
{
"files": ["next-env.d.ts"],
"rules": {
"header/header": "off"
}
},
{
"files": ["**/*.test.{ts,tsx,js}"],
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"]
},
{
"files": [
"src/app.js",
"src/utils/redisMock.js",
"src/routes/**/*.js",
"src/views/**/*.js",
"src/middleware/**/*.js",
"src/controllers/**/*.js",
"src/app/(nextjs_migration)/**/*",
"src/app/functions/server/breachResolution.ts"
],
"rules": {
"jsdoc/no-undefined-types": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"import/no-named-as-default-member": "off",
"import/no-unresolved": "off"
}
},
{
// Only enable rules that depend on type checking on TS files,
// except for files that include a lot of copy-pasted pre-TypeScript code
// (i.e. the code inside `(nextjs_migration)`),
// to avoid a barrage of warnings for older code:
"files": ["**/*.{ts,tsx}"],
"excludedFiles": [
"./src/app/(nextjs_migration)/**/*"
],
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
// See https://typescript-eslint.io/linting/typed-linting/#specifying-tsconfigs
// Needed for `plugin:@typescript-eslint/recommended-requiring-type-checking`
// to avoid this error:
// > You have used a rule which requires parserServices to be generated.
// > You must therefore provide a value for the "parserOptions.project"
// > property for @typescript-eslint/parser.
"project": "tsconfig.json"
},
"rules": {
// These rules trigger lots of times; possibly we can enable them later:
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off"
}
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": true,
"node": true
}
}
}