-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
83 lines (77 loc) · 2.44 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
'use strict'
const typescriptPlugin = require('@typescript-eslint/eslint-plugin')
const prettierConfig = require('eslint-config-prettier')
const jestPlugin = require('eslint-plugin-jest')
module.exports = {
plugins: ['import', 'prettier', 'promise', 'unicorn'],
env: { node: true },
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:unicorn/recommended',
'plugin:prettier/recommended',
],
rules: {
'no-console': ['error', { allow: ['error', 'info', 'warn'] }],
'no-param-reassign': ['error', { props: true }],
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
['internal', 'parent', 'sibling', 'index', 'unknown'],
],
'newlines-between': 'always',
},
],
'unicorn/prefer-module': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/prevent-abbreviations': 'off',
// TODO: Enable the following rules
'unicorn/import-style': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/prefer-spread': 'off',
'prettier/prettier': 'error',
},
overrides: [
{
files: ['*.ts'],
parser: typescriptPlugin.configs.base.parser,
parserOptions: { project: 'tsconfig.?(jest|node).json' },
plugins: typescriptPlugin.configs.base.plugins,
rules: {
...typescriptPlugin.configs.recommended.rules,
...typescriptPlugin.configs['eslint-recommended'].overrides[0].rules,
...typescriptPlugin.configs['recommended-requiring-type-checking']
.rules,
'@typescript-eslint/explicit-function-return-type': 'off',
'import/named': 'off',
// TODO: Enable the following rules
'@typescript-eslint/explicit-module-boundary-types': 'off',
...prettierConfig.rules,
},
},
{
files: [
'config/jest/**/*.?(js|ts)',
'src/**/__mocks__/**/*.?(js|ts)',
'src/**/?(*.)test.?(js|ts)',
],
globals: jestPlugin.environments.globals.globals,
plugins: jestPlugin.configs.recommended.plugins,
rules: jestPlugin.configs.recommended.rules,
},
],
settings: {
'import/extensions': ['.d.ts', '.js', '.ts'],
'import/parsers': { '@typescript-eslint/parser': ['.d.ts', '.ts'] },
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.?(jest|node).json',
},
},
},
}