-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
153 lines (150 loc) · 4.1 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
const fs = require('fs');
const path = require('path');
const prettierOptions = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '.prettierrc'), 'utf8'),
);
module.exports = {
env: {
es6: true,
node: true,
jest: true,
},
extends: [
'airbnb',
'plugin:react/recommended',
'prettier',
'@react-native-community',
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:prettier/recommended"
],
plugins: ['prettier', 'import', 'jsx-a11y'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'react',
'@typescript-eslint',
'eslint-plugin-prettier',
'eslint-plugin-react',
'prettier'
],
rules: {
'prettier/prettier': ['error', prettierOptions],
'semi': [2, 'always'],
'import/no-default-export': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'import/prefer-default-export': 'off',
'no-nested-ternary': 'error',
'max-params': ['error', 3],
'prefer-arrow-callback': ['error', { allowUnboundThis: false }],
'func-style': ['error', 'expression', { allowArrowFunctions: true }],
'react/jsx-tag-spacing': ['error', { beforeSelfClosing: 'always' }],
'space-before-function-paren': ['error', 'always'],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{ blankLine: 'always', prev: ['function'], next: '*' },
],
eqeqeq: 'error',
'no-param-reassign': 'error',
'newline-per-chained-call': 'error',
'no-console': 'warn',
'no-use-before-define': 'error',
camelcase: [
'error',
{
ignoreDestructuring: true,
allow: ['_id$', '_token$', '_key$', 'cred_card', 'pending_payment'],
properties: 'never',
},
],
'react/jsx-closing-tag-location': 'error',
'react/jsx-props-no-spreading': 'off',
'no-duplicate-imports': 'error',
'no-restricted-exports': 'off',
'no-useless-escape': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
ts: 'never',
tsx: 'never',
},
],
'react/jsx-filename-extension': [
2,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
'no-use-before-define': 'off',
'react/function-component-definition': [
2,
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'no-alert': 'off',
'react/require-default-props': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'typeParameter',
format: ['PascalCase'],
prefix: ['T'],
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
],
'react/jsx-curly-newline': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/no-cycle': 'off',
'import/no-extraneous-dependencies': [
'error',
{ 'devDependencies': true }
],
'consistent-return': ['error', { "treatUndefinedAsUnspecified": false } ],
'no-underscore-dangle': ['error', { 'allow': ['_id'] }],
'no-new': 'off',
'no-plusplus': 'off',
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/forbid-prop-types': 'off',
'react/jsx-wrap-multilines': 'off',
'radix': 'off',
'@typescript-eslint/naming-convention': 'off'
},
overrides: [
{
files: ['**/*.ts?(x)', '**/*.tsx?(x)'],
rules: { 'prettier/prettier': ['warn', prettierOptions] },
},
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {},
},
},
};