-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.js
106 lines (101 loc) · 2.98 KB
/
base.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
const restrictedGlobals = require('eslint-restricted-globals')
const OFF = 0
const WARNING = 1
const ERROR = 2
const JS = ['.js', '.jsx']
const TS = ['.ts', '.tsx', '.d.ts']
module.exports = {
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:jest/recommended',
'plugin:promise/recommended',
'prettier',
],
parser: 'babel-eslint',
env: {
jest: true,
browser: true,
es6: true,
node: true,
},
plugins: [
'babel',
'jest',
'prettier',
'import',
'simple-import-sort',
],
parserOptions: {
sourceType: 'module',
},
rules: {
'babel/new-cap': WARNING,
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
'class-methods-use-this': OFF,
'curly': [ERROR, 'all'],
'spaced-comment': [ERROR, 'always'],
'no-use-before-define': OFF,
'no-unused-vars': ERROR,
'one-var': [ERROR, { 'uninitialized': 'always', 'initialized': 'never' }],
'object-curly-newline': OFF,
'operator-linebreak': OFF,
'one-var-declaration-per-line': OFF,
'prefer-destructuring': [OFF, { 'object': true, 'array': false }],
'padding-line-between-statements': [
ERROR,
{ 'blankLine': 'always', 'prev': '*', 'next': 'return' },
{ 'blankLine': 'always', 'prev': '*', 'next': 'function' },
{ 'blankLine': 'always', 'prev': 'import', 'next': '*' },
{ 'blankLine': 'any', 'prev': 'import', 'next': 'import' }
],
'no-console': ERROR,
'promise/prefer-await-to-then': WARNING,
'import/extensions': OFF,
'import/no-dynamic-require': OFF,
'import/no-unresolved': ERROR,
'import/prefer-default-export': OFF,
'import/no-extraneous-dependencies': OFF,
'simple-import-sort/sort': [
'warn',
{
groups: [
// Node.js builtins. You could also generate this regex if you use a `.js` config.
[`^(${require('module').builtinModules.join('|')})(/|$)`],
// Packages. `react` related packages come first.
['^react', '^@?\\w'],
// Root imports with babel-plugin-root-import (~/).
// Parent imports. Put `..` last.
// Other relative imports. Put same-folder imports and `.` last.
['^~/', '^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Side effect imports.
['^\\u0000'],
],
},
],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
settings: {
'import/extensions': [...JS, ...TS],
'import/parsers': {
'@typescript-eslint/parser': TS,
},
'import/resolver': {
node: {
extensions: [...JS, ...TS],
},
},
},
rules: {
'@typescript-eslint/no-unused-vars': ERROR,
'@typescript-eslint/prefer-optional-chain': ERROR,
'no-dupe-class-members': OFF,
'no-unused-vars': OFF,
},
},
],
};