forked from ONEARMY/community-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
128 lines (127 loc) · 4.28 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
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier",
"unicorn",
"sort-class-members",
"jest"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:import/recommended",
"plugin:import/typescript",
"prettier" // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"no-alert": "error",
"sort-class-members/sort-class-members": [
"error",
{
"order": [
"[static-properties]",
"[static-methods]",
"[properties]",
"[conventional-private-properties]",
"constructor",
"[methods]",
"[conventional-private-methods]"
],
"accessorPairPositioning": "getThenSet"
}
],
"import/no-duplicates": "error",
"import/no-unresolved": "off",
"import/no-named-as-default": "off",
"max-classes-per-file": "error",
"no-useless-escape": "off",
"react/display-name": "error",
"react/jsx-no-target-blank": "warn",
// https://github.com/standard/eslint-config-standard-with-typescript/issues/248
"react/no-deprecated": "warn",
"react/no-unescaped-entities": "off",
// as of v17 no longer required
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"React.FC": "`React.FC/React.FunctionComponent is deprecated and should be avoided. Consider using a function declaration instead`"
}
}
],
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
}
],
"jest/no-focused-tests": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
// NOTE - typings throughout the platform are fairly inconsistent, hence the wide range of rules
// 2023-02-17 - Disable as lint check now blocking build (warnings treated as error)
"@typescript-eslint/naming-convention": [
"off"
// {
// "selector": "default",
// "format": ["camelCase", "UPPER_CASE", "PascalCase", "snake_case"],
// "leadingUnderscore": "allow"
// },
// {
// "selector": "classMethod",
// "format": ["camelCase"],
// "leadingUnderscore": "allow"
// }
],
// Filenames - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
"unicorn/filename-case": [
"error",
{
"cases": {
"camelCase": true,
"pascalCase": true
},
"ignore": ["react-app-env.d.ts", "service-worker.ts"]
}
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": ["error"],
"no-restricted-imports": [
"error",
{
"paths": [
// Prevent import of theme-ui link (prefer react-router link as prevents page reload nav)
{
"name": "theme-ui",
"importNames": ["Link"],
"message": "Please import 'ExternalLink' from 'oa-components' or 'Link' from 'react-router-dom' instead"
},
// Prevent importing components from workspace absolute path (prefer workspace name)
{
"name": "packages/components/dist",
"message": "Please import from 'oa-components' instead"
}
]
}
]
}
}