-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
84 lines (83 loc) · 3 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
// Temp fix for import.
// https://github.com/benmosher/eslint-plugin-import/issues/1285#issuecomment-466212438
const jsExtensions = ['.js'];
const tsExtensions = ['.ts'];
const allExtensions = jsExtensions.concat(tsExtensions);
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint', 'prettier'],
extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended', 'prettier'],
settings: {
'import/extensions': allExtensions,
'import/parsers': {
'@typescript-eslint/parser': tsExtensions,
},
'import/resolver': {
node: {
extensions: allExtensions,
},
},
},
// Este rules.
rules: {
// I believe type is enforced by callers.
'@typescript-eslint/explicit-function-return-type': 'off',
// Temp fix for import.
// https://github.com/benmosher/eslint-plugin-import/issues/1285#issuecomment-466212438
'import/named': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
// Enforce arrow functions only is afaik not possible. But this helps.
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
// I believe shadowing is a nice language feature.
'no-shadow': 'off',
'import/order': 'off',
// Does not work with TypeScript export type.
'import/prefer-default-export': 'off',
// They are fine sometimes.
'no-nested-ternary': 'off',
// This is fine.
'class-methods-use-this': 'off',
'lines-between-class-members': 'off',
// We use it for immer. It should be checked by readonly anyway.
'no-param-reassign': 'off',
// Irrelevant.
'no-plusplus': 'off',
'no-return-assign': 'off',
'consistent-return': 'off',
'max-classes-per-file': 'off',
'no-console': 'warn',
// TSC checks it.
'@typescript-eslint/no-unused-vars': 'off',
'no-undef': 'off',
'no-useless-constructor': 'off',
'no-empty-function': ['error', { allow: ['constructors'] }],
// Reconsider, maybe enable later:
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-cycle': 'off',
'prettier/prettier': 'error',
'prefer-destructuring': ['error', { object: false, array: false }],
'@typescript-eslint/no-non-null-assertion': 'off',
'import/no-unresolved': 'off',
'no-lonely-if': 'off',
},
};