-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
109 lines (105 loc) · 3.7 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
// @ts-check
/**
* @typedef { import('eslint').Linter.Config } EslintConfig
* @type { EslintConfig }
*/
const config = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
},
extends: [
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
rules: {
// NOTE(harunou): general rules
'no-console': 'error',
'no-unused-expressions': 'error',
'no-duplicate-imports': 'error',
'prefer-template': 'error',
'default-case': 'error',
'default-case-last': 'error',
'eslint-comments/require-description': 'error',
// NOTE(harunou): style rules, that Prettier does not support
'spaced-comment': ['error', 'always', { exceptions: ['////'] }],
// NOTE(harunou): typescript specific rules
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'static-field',
'public-static-method',
'public-instance-field',
'protected-instance-field',
'private-instance-field',
'public-constructor',
'public-instance-method',
'protected-instance-method',
'private-instance-method',
],
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['class', 'interface', 'typeAlias', 'enum', 'typeParameter'],
format: ['PascalCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{ selector: 'enumMember', format: ['PascalCase', 'UPPER_CASE'] },
{
selector: 'classProperty',
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'classProperty',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{
selector: 'classProperty',
modifiers: ['protected'],
format: ['camelCase'],
leadingUnderscore: 'allow',
},
],
},
overrides: [
{
env: {
jest: true,
},
plugins: ['jest', 'jest-dom', 'testing-library'],
files: ['**/*.{test,spec}.{ts,tsx}'],
extends: [
'plugin:jest/recommended',
'plugin:jest-dom/recommended',
'plugin:testing-library/react',
],
},
],
};
module.exports = config;