forked from betagouv/mon-entreprise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
136 lines (131 loc) · 3.38 KB
/
.eslintrc.cjs
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
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
globals: {
process: false,
},
extends: ['eslint:recommended', 'prettier'],
rules: {
'no-console': 'warn',
'no-restricted-globals': ['error', 'length'],
'no-restricted-syntax': [
'error',
{
message:
'Utilisez le composant <Emoji /> plutôt que la function emoji directement importée de react-easy-emoji',
selector: "CallExpression[callee.name='emoji']",
},
],
},
settings: {
react: {
version: 'detect',
},
},
overrides: [
{
files: ['**/*.{js,jsx}'],
env: { node: true },
},
{
files: ['**/*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
// eslint-disable-next-line no-undef
tsconfigRootDir: __dirname,
project: [
'./site/tsconfig.json',
'./modele-social/tsconfig.json',
'./exoneration-covid/tsconfig.json',
],
},
extends: [
'eslint:recommended',
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'prettier',
],
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
rules: {
'no-void': 'off',
'ban-ts-comment': 'off',
'no-use-before-define': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-no-target-blank': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/member-delimiter-style': [
'error',
{ multiline: { delimiter: 'none' } },
],
// Auto fixable lint error
'prefer-const': 'error',
'padding-line-between-statements': [
'error',
// Require padding line before return statement
{ blankLine: 'always', prev: '*', next: 'return' },
//Require padding line after import
{ blankLine: 'always', prev: ['import', 'cjs-import'], next: '*' },
{
blankLine: 'any',
prev: ['import', 'cjs-import'],
next: ['import', 'cjs-import'],
},
//Require padding line before export
{ blankLine: 'always', prev: '*', next: ['export', 'cjs-export'] },
{
blankLine: 'any',
prev: ['export', 'cjs-export'],
next: ['export', 'cjs-export'],
},
],
},
},
{
files: ['**/*.test.{js,ts}', 'site/cypress/**/*.js'],
env: {
mocha: true,
},
extends: [
'eslint:recommended',
'plugin:cypress/recommended',
'plugin:mocha/recommended',
'prettier',
],
plugins: ['cypress', 'mocha'],
rules: {
'cypress/no-unnecessary-waiting': 'warn',
'mocha/no-exclusive-tests': 'error',
'mocha/no-skipped-tests': 'warn',
'mocha/no-mocha-arrows': 'warn',
'mocha/no-setup-in-describe': 'warn',
'mocha/max-top-level-suites': 'warn',
'mocha/no-global-tests': 'warn',
'mocha/no-exports': 'warn',
},
},
],
}