forked from nmajorcarebit/eslint-config-react-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
75 lines (73 loc) · 2.16 KB
/
Copy pathindex.js
File metadata and controls
75 lines (73 loc) · 2.16 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
66
67
68
69
70
71
72
73
74
75
/** @type {import("eslint").Linter.Config} */
const config = {
ignorePatterns: ["dist", ".eslintrc.cjs"],
extends: [require.resolve("./recommended")],
rules: {
// TODO: Fix all the errors so we can turn this rule on :)
"no-async-promise-executor": "off",
curly: ["error", "all"],
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["*Generated", "*Generated.ts"],
message:
"Do not import from Generated files directly. Import from the non-Generated wrapper file instead (e.g., PatientResponse instead of PatientResponseGenerated).",
},
],
},
],
"no-restricted-globals": [
"warn",
{
name: "localStorage",
message:
"Please use the shared 'storage.local' utility instead of accessing localStorage directly",
},
],
"prefer-promise-reject-errors": ["warn", { allowEmptyReject: true }],
"no-restricted-syntax": [
"error",
{
selector: "JSXAttribute[name.name=/^(?!aria-|data-)[a-z]+-[a-z]/]",
message:
"SVG attributes in React must use camelCase (e.g., stopColor instead of stop-color). Use camelCase for all SVG attributes. Note: aria-* and data-* attributes are allowed.",
},
],
},
overrides: [
{
files: "**/*.+(ts|tsx)",
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
plugins: ["@typescript-eslint"],
},
{
files: ["**/apiTypes/**/*.ts"],
rules: {
"no-restricted-imports": "off",
},
},
{
files: ["**/*.spec.{js,ts,jsx,tsx}"],
rules: {
"no-restricted-syntax": [
"error",
{
selector:
'NewExpression[callee.name="Date"][arguments.length>1]',
message:
"Please use the string format with new Date() like `new Date('2000-01-01T00:08:30.000')`",
},
],
"@typescript-eslint/no-explicit-any": "off",
},
globals: { vi: "readonly" },
},
],
};
module.exports = config;