-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
118 lines (113 loc) · 3.97 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
// @ts-check
// * @type { import('eslint').Linter.Config }
// https://typescript-eslint.io/docs/linting/
// https://www.npmjs.com/package/eslint-config-airbnb-typescript
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
module.exports = {
root: true,
overrides: [
{
// Config files for Node.js tools like ESLint, Babel, webpack, postcss, stylelint,
// Jest, etc.
files: ['./*.js'],
env: {
// 'eslint-config-airbnb-base' includes 'node: true' as env.
// See https://github.com/airbnb/javascript/issues/1476 and
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/node.js
// for more details.
//
// node: true,
},
extends: [
// https://www.npmjs.com/package/eslint-config-airbnb-base
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/index.js
'airbnb-base',
],
plugins: [
// Inherited from 'eslint-config-airbnb-base' automatically
// 'import',
],
rules: {
'linebreak-style': 'off',
// Override the maximum line length of 100 in 'eslint-config-airbnb-base'
// https://eslint.org/docs/latest/rules/max-len
'max-len': ['error', 90, 2, {
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
'no-multi-spaces': ['error', {
ignoreEOLComments: true,
}],
},
},
{
// Files that run with Node.js
files: ['src/**/*.ts'],
// env: {
// node: true, // 'eslint-config-airbnb' sets 'node: true' automatically
// },
parserOptions: {
project: './tsconfig.json',
// ecmaFeatures: {
// jsx: true,
// },
// ecmaVersion: 'latest',
// sourceType: 'module',
},
plugins: [
// 'react', // eslint-plugin-react
// '@typescript-eslint', // @typescript-eslint/eslint-plugin
],
extends: [
// We can omit the 'eslint-config-' prefix of the package name for the 'extends'
// property.
//
// https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/index.js
'airbnb-base', // eslint-config-airbnb-base
// https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js
'airbnb-typescript/base', // eslint-config-airbnb-typescript
// https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
rules: {
'linebreak-style': 'off',
// Override the maximum line length of 100 in 'eslint-config-airbnb-base'
// https://eslint.org/docs/latest/rules/max-len
'max-len': ['error', 90, 2, {
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
},
},
{
// *.(ts|tsx) files for unit testing with Jest
// Note that this block further overrides the previous block.
files: [
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[tj]s?(x)',
],
plugins: [
// There is no need to specify the 'jest' plugin since the
// 'plugin:jest/recommended' config already includes it.
//
// See https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts
// for more details.
],
extends: [
'plugin:jest/recommended',
],
env: {
// There is no need to specify 'jest: true' since the 'eslint-plugin-jest' plugin
// specifies 'jest/globals: true'
node: true,
},
},
],
};