forked from bigcommerce/bigcommerce-api-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
131 lines (130 loc) · 3.74 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
module.exports = {
env: {
node: true,
es6: true,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
modules: true,
},
ecmaVersion: 6,
sourceType: 'module',
},
plugins: ['prettier'],
ignorePatterns: ['node_modules', 'dist', 'src/generate/generated'],
rules: {
'array-callback-return': 'error',
'arrow-parens': ['error', 'as-needed'],
'dot-notation': 'error',
'guard-for-in': 'error',
'import/no-absolute-path': 'error',
'import/order': [
'warn',
{
alphabetize: { caseInsensitive: true, order: 'asc' },
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'max-classes-per-file': ['error', 1],
'newline-before-return': 'error',
'no-console': 'warn',
'no-multi-assign': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }],
'prettier/prettier': ['warn'],
'sort-imports': ['error', { ignoreCase: true, ignoreDeclarationSort: true }],
// The following rules are off mostly due to incompatibilities with their
// @typescript-eslint version
'no-duplicate-imports': 'off',
'no-shadow': 'off',
'no-unused-expressions': 'off',
'no-unused-var': 'off',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parserOptions: {
project: ['./tsconfig.json'],
},
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
format: ['camelCase', 'PascalCase'],
selector: 'default',
},
{
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
selector: ['variable', 'classProperty'],
},
{
format: ['camelCase', 'UPPER_CASE'],
selector: 'variable',
types: ['boolean', 'string', 'number', 'array'],
},
{
format: ['camelCase', 'snake_case', 'PascalCase'],
selector: 'property',
},
{
format: ['camelCase'],
selector: 'parameterProperty',
},
{
format: ['PascalCase'],
selector: 'typeLike',
},
{
format: ['PascalCase', 'UPPER_CASE'],
selector: 'enumMember',
},
{
format: ['camelCase'],
selector: 'parameter',
},
{
format: ['camelCase'],
leadingUnderscore: 'allow',
modifiers: ['unused'],
selector: 'parameter',
},
],
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-shadow': ['error', { hoist: 'all' }],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-duplicate-imports': 'error',
},
},
{
files: ['*.spec.ts'],
plugins: ['jest'],
rules: {
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
},
],
};