forked from devdeun/investmetic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
129 lines (129 loc) · 3.46 KB
/
.eslintrc.js
File metadata and controls
129 lines (129 loc) · 3.46 KB
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
module.exports = {
root: true,
env: { browser: true, es2021: true, node: true },
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
'next/core-web-vitals',
'next/typescript',
'plugin:storybook/recommended',
],
plugins: ['@typescript-eslint', 'react', 'jsx-a11y', 'import', 'prettier', 'filenames'],
rules: {
'prettier/prettier': 'error',
'filenames/match-regex': ['error', '^[a-z-]+.[a-z]+$'],
'react/jsx-pascal-case': 'error',
camelcase: ['error', { properties: 'never' }],
'react/jsx-handler-names': [
'error',
{
eventHandlerPrefix: 'handle',
eventHandlerPropPrefix: 'on',
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'has', 'should'],
},
{
selector: 'variable',
types: ['function'],
format: ['camelCase'],
suffix: ['Ref'],
filter: {
regex: 'Ref$',
match: true,
},
},
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '(Props|Model)$',
match: true,
},
},
{
selector: 'typeAlias',
format: ['PascalCase'],
suffix: ['Type'],
},
],
'react/destructuring-assignment': ['error', 'always'],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'react/function-component-definition': [
2,
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
'jsx-a11y/alt-text': [
'error',
{
elements: ['img', 'object', 'area', 'input[type="image"]'],
img: ['Image'],
object: [],
area: [],
'input[type="image"]': [],
},
],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'import/no-default-export': 'off',
'import/prefer-default-export': 'off',
'import/no-unresolved': 'off',
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: 'error',
'prefer-destructuring': [
'error',
{
array: false,
object: true,
},
],
'no-useless-rename': 'error',
'object-shorthand': 'error',
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
paths: ['src', '.'],
},
},
},
ignorePatterns: ['dist', '.eslintrc.js', 'public/mockServiceWorker.js'],
}