-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
150 lines (149 loc) · 4.49 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
// require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
// project: './tsconfig.json',
// tsconfigRootDir: __dirname,
ecmaFeatures: {
// Allows for the parsing of TSX ???
tsx: true,
},
},
plugins: ['@typescript-eslint', 'import', 'react-hooks', 'prefer-arrow', 'import', 'jsx-a11y', 'prettier'],
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
extends: [
'airbnb',
'eslint:recommended',
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'next',
'next/core-web-vitals',
'plugin:@next/next/recommended',
'prettier',
],
rules: {
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
/* AirBnb rules */
'import/extensions': [0, 'never'],
'no-shadow': ['error', { allow: ['done', 'error', 'theme', 'value'] }],
'react/jsx-filename-extension': [0, { extensions: ['.tsx', '.jsx'] }],
// 'no-unused-vars': 2,
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'no-nested-ternary': 0,
'react/jsx-props-no-spreading': 0,
'jsx-a11y/anchor-is-valid': 1,
'@typescript-eslint/ban-types': 1,
/* START TMP : Need to be set to 0 before going to production */
'react/require-default-props': 1,
'react/prop-types': 1,
'react/no-unused-prop-types': 1,
'react/forbid-prop-types': 1,
'@typescript-eslint/no-empty-function': 1,
'react/default-props-match-prop-types': 1,
'react/display-name': 1,
'react/jsx-key': 1,
'react/no-array-index-key': 1,
'import/no-anonymous-default-export': 0,
/* END TMP : Need to be set to 0 before going to production */
/* React Hooks rules */
// Checks rules of Hooks
'react-hooks/rules-of-hooks': 2,
// Checks effect dependencies
'react-hooks/exhaustive-deps': 2,
/* Functions rules */
'consistent-return': 0,
'import/prefer-default-export': 0,
/* Comments rules */
'no-warning-comments': [1, { terms: ['todo', 'fixme', 'to do', 'fix me'], location: 'start' }],
'no-inline-comments': 2,
/* Console rules */
'no-console': 0,
/* Typescript rules */
'prettier/prettier': 0,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
// "@typescript-eslint/no-var-requires": "off",
/* Special chars rules */
'react/no-unescaped-entities': 0,
/* Disallow imports from src/server/ in src/pages/ except for src/pages/api */
/* (see the "overrides" section for the exception) */
'import/no-restricted-paths': [
'error',
{
zones: [
{
target: './src/pages',
from: './src/server',
},
],
},
],
},
settings: {
react: {
// React version. "detect" automatically picks the version you have installed.
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
paths: ['./'],
},
},
// 'import/parsers': {
// [require.resolve('@typescript-eslint/parser')]: ['.ts', '.tsx', '.d.ts'],
// },
// 'import/resolver': {
// [require.resolve('eslint-import-resolver-node')]: {
// extensions: ['.js', '.jsx', '.ts', '.tsx'],
// },
// [require.resolve('eslint-import-resolver-typescript')]: {
// alwaysTryTypes: true,
// },
// },
},
overrides: [
{
files: ['next.config.js'],
// "rules": {
// "@typescript-eslint/no-var-requires": "off"
// }
},
{
// Allow imports from src/server/ in src/pages/api
files: ['src/pages/api/**/*'],
rules: {
'import/no-restricted-paths': [
'error',
{
zones: [
{
target: './src/pages/api',
from: './src/client/',
},
],
},
],
},
},
],
// ignorePatterns: ['src/client/components/formik-material-ui/*', 'src/client/graphql/generated/', 'next.config.js'],
}