forked from ONEARMY/community-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
116 lines (116 loc) · 4.1 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
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier", "unicorn"],
"extends": [
"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": {
"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": "warn",
"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",
"react/no-unknown-property": "warn",
// as of v17 no longer required
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports"
}
],
"@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
"@typescript-eslint/naming-convention": [
"warn",
{
"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
},
// TODO - most can be renamed although holding off until after #1501 and #1533 merged
"ignore": [
"docusaurus.config.gh-pages.js",
"install-clean.ts",
"SWUpdateNotification.tsx",
"react-app-env.d.ts",
"service-worker.ts",
"AbstractDBClient.ts",
"react-firebase-file-uploader.d.ts",
"reset-staging-site.ts",
"post-cra-build.ts",
"user_pp.mock.tsx",
"user_pp.models.tsx",
"admin-subheader.tsx",
"admin-approvals.tsx",
"admin-howtos.tsx",
"admin-mappins.tsx",
"admin-research-detail.tsx",
"admin-research.tsx",
"admin-tags.tsx",
"admin-user-detail.tsx",
"admin-users.tsx"
]
}
],
"@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",
"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"
}
]
}
]
}
}