forked from SAP/ui5-webcomponents-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.yml
138 lines (128 loc) · 4.22 KB
/
.eslintrc.yml
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
---
root: true
parser: '@typescript-eslint/parser'
parserOptions:
sourceType: module
ecmaFeatures:
jsx: true
env:
browser: true
es2022: true
extends:
- plugin:react/recommended
- plugin:react/jsx-runtime
- plugin:react-hooks/recommended
- plugin:import/recommended
- plugin:prettier/recommended
plugins:
- prefer-arrow
settings:
react:
version: detect
rules:
camelcase:
- 'error'
- allow:
- sap_fiori_3
- sap_fiori_3_dark
- sap_fiori_3_hcb
- sap_fiori_3_hcw
- sap_belize
- sap_belize_hcb
- sap_belize_hcw
- sap_horizon
- sap_horizon_dark
- sap_horizon_hcb
- sap_horizon_hcw
import/order:
- 'error'
- newlines-between: never
alphabetize:
order: asc
caseInsensitive: true
import/no-duplicates: 'error'
import/no-unresolved: 'off'
overrides:
# add config for all TypeScript files
- files:
- '*.ts'
- '*.tsx'
parserOptions:
EXPERIMENTAL_useProjectService:
# TODO https://github.com/typescript-eslint/typescript-eslint/issues/9450
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000
plugins:
- '@typescript-eslint'
extends:
- 'plugin:@typescript-eslint/recommended'
- 'plugin:@typescript-eslint/recommended-requiring-type-checking'
- 'plugin:import/typescript'
settings:
import/resolver:
typescript: true
rules:
# disabled some rules from the recommended preset
'@typescript-eslint/no-empty-function': 'off'
'@typescript-eslint/no-unsafe-member-access': 'off'
'@typescript-eslint/no-unsafe-argument': 'off'
'@typescript-eslint/no-unsafe-return': 'off'
'@typescript-eslint/no-unsafe-assignment': 'off'
'@typescript-eslint/no-unsafe-call': 'off'
'@typescript-eslint/restrict-plus-operands': 'off'
'@typescript-eslint/restrict-template-expressions': 'off'
'@typescript-eslint/no-explicit-any': 'warn'
# consistent type exports/imports
'@typescript-eslint/consistent-type-exports':
- 'error'
- fixMixedExportsWithInlineTypeSpecifier: false
'@typescript-eslint/consistent-type-imports':
- 'error'
- prefer: 'type-imports'
fixStyle: 'separate-type-imports'
# lots of UI5 Web Components API are promised based but 'fire and forget' is sufficient for us
'@typescript-eslint/no-floating-promises': 'warn'
'@typescript-eslint/no-unused-vars':
- 'error'
- varsIgnorePattern: '^_'
# Performance Improvements: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting#eslint-plugin-import
'import/named': 'off'
'import/namespace': 'off'
'import/default': 'off'
'import/no-named-as-default-member': 'off'
# Generated Web Component Wrappers might contain empty interfaces
- files:
- 'packages/main/src/webComponents/*/index.tsx'
rules:
'@typescript-eslint/no-empty-interface': 'off'
# disable prop types check for Analytical Table Defaults (TODO might change for react-table v8)
- files:
- 'packages/main/src/components/AnalyticalTable/defaults/**/*.tsx'
- 'packages/main/src/components/AnalyticalTable/hooks/*.ts'
- 'packages/main/src/components/AnalyticalTable/hooks/*.tsx'
- 'packages/main/src/components/AnalyticalTable/TableBody/VirtualTableBodyContainer.tsx'
rules:
'react/prop-types': 'off'
- files:
- 'cypress/**/*'
rules:
'@typescript-eslint/no-namespace': 'off'
- files:
- '*.cy.ts'
- '*.cy.tsx'
plugins:
- no-only-tests
rules:
'@typescript-eslint/no-empty-function': 'off'
'import/order': 'warn'
'react/no-unescaped-entities': 'off'
'@typescript-eslint/unbound-method': 'warn'
'react/display-name': 'off'
no-only-tests/no-only-tests: 'error'
- files:
- '*.stories.tsx'
extends:
- 'plugin:storybook/recommended'
rules:
'react/prop-types': 'off' # inline custom components within stories don't need prop types
'@typescript-eslint/no-unused-vars': 'warn' # some samples can include unused vars to show the API / signature
'react/no-unescaped-entities': 'off'