-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
97 lines (95 loc) · 3.02 KB
/
.eslintrc.js
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
module.exports = {
root: true,
settings: {
react: {
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
},
overrides: [
// Standard typescript rules
{
files: ['**/*.ts', '**/*.tsx'],
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier',
'prettier/@typescript-eslint',
],
rules: {
'no-unused-expressions': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
// Not all react components use display names
'react/display-name': 'off',
// For convenience:
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true, allowTypedFunctionExpressions: true },
],
// To allow placeholder vars:
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
// To allow e.g. `interface Props extends RouteComponentProps {}`:
'@typescript-eslint/no-empty-interface': [
'error',
{
allowSingleExtends: true,
},
],
// Typescript will do this:
'react/prop-types': 'off',
// Allow newspaper code structure:
'@typescript-eslint/no-use-before-define': 'off',
// We are using a REST API defined by Aries RFCs which
// explicitely uses snake case fields. I originally implemented
// conversion routines to internal format of camel case.
// However the issue with that is displays of data don't
// reflect on the wire format and can be confusing. It is
// also prone to error and difficulty in maintaining type
// safety.
'@typescript-eslint/camelcase': 'off',
},
},
// Additional rules for TS unit test files
{
files: [
'src/setupTests.ts',
'src/test/**/*.{ts,tsx}',
'e2e/**/*.ts',
'**/*.spec.{ts,tsx}',
'**/__mocks__/**/*.{ts,tsx}',
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
// The OpenAPI generated code for di-cloud-agent-sdk
// uses camelcase as otherwise it wont match up with
// the actual http response bodies from ACA-py
'@typescript-eslint/camelcase': 'off',
},
},
// JS configuration files in the root dir
{
files: ['*.js'],
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 2018,
},
env: {
node: true,
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
};