-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared.js
84 lines (84 loc) · 2.92 KB
/
shared.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
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
generators: false,
objectLiteralDuplicateProperties: false,
},
},
plugins: ['import', '@typescript-eslint', 'typescript-sort-keys'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
},
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts'],
},
typescript: {
alwaysTryTypes: true,
},
},
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/core-modules': [],
'import/ignore': [
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json)$',
],
},
extends: [
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:typescript-sort-keys/recommended',
require.resolve('./rules/bestPractices'),
require.resolve('./rules/errors'),
require.resolve('./rules/node'),
require.resolve('./rules/style'),
require.resolve('./rules/variables'),
require.resolve('./rules/es6'),
require.resolve('./rules/import'),
require.resolve('./rules/strict'),
],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
// The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
// Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
// Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
'constructor-super': 'off',
'getter-return': 'off',
'no-const-assign': 'off',
'no-dupe-args': 'off',
'no-dupe-class-members': 'off',
'no-dupe-keys': 'off',
'no-func-assign': 'off',
'no-import-assign': 'off',
'no-new-symbol': 'off',
'no-obj-calls': 'off',
'no-redeclare': 'off',
'no-setter-return': 'off',
'no-this-before-super': 'off',
'no-undef': 'off',
'no-unreachable': 'off',
'no-unsafe-negation': 'off',
'valid-typeof': 'off',
// The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
// See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
'import/named': 'off',
'import/no-named-as-default-member': 'off',
// Disable `import/no-unresolved`, see README.md for details
'import/no-unresolved': 'off',
},
},
],
};