-
Notifications
You must be signed in to change notification settings - Fork 9
/
.eslintrc.cjs
94 lines (90 loc) · 3.01 KB
/
.eslintrc.cjs
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
module.exports = {
env: { es6: true, node: true },
ignorePatterns: ['dist'],
overrides: [
{
extends: [
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-json',
'plugin:jsonc/prettier',
'plugin:prettier/recommended'
],
files: ['*.json'],
parser: 'jsonc-eslint-parser',
plugins: ['jsonc']
},
{
extends: [
'eslint:recommended',
'preact',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:jest/recommended',
'plugin:node/recommended',
'plugin:regexp/recommended',
'plugin:promise/recommended',
'plugin:eslint-comments/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:unicorn/recommended',
'plugin:prettier/recommended'
],
files: ['*.ts', '*.tsx', '*.cjs'],
overrides: [{ files: ['*.cjs'], rules: { '@typescript-eslint/no-var-requires': 'off' } }],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { impliedStrict: true, jsx: true, modules: true },
ecmaVersion: 'latest',
project: './tsconfig.json',
sourceType: 'module'
},
rules: {
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_' }],
'eslint-comments/disable-enable-pair': 'off',
'eslint-comments/no-unused-disable': 'error',
'import/exports-last': 'error',
'import/group-exports': 'error',
'import/order': [
'error',
{ alphabetize: { caseInsensitive: true, order: 'asc' }, 'newlines-between': 'always' }
],
'no-process-exit': 'off', // unicorn already covers this
'node/no-missing-import': 'off',
'node/shebang': 'off',
'sort-exports/sort-exports': [
'error',
{ ignoreCase: true, sortDir: 'asc', sortExportKindFirst: 'type' }
],
'sort-keys': ['error', 'asc', { caseSensitive: false, natural: true }],
'sort-vars': ['error', { ignoreCase: true }],
'unicorn/consistent-function-scoping': 'off',
'unicorn/filename-case': 'off',
'unicorn/new-for-builtins': 'off',
'unicorn/prefer-top-level-await': 'off', // as, and until, we're still targeting node14...
'unicorn/prevent-abbreviations': 'off'
}
}
],
plugins: [
'@typescript-eslint/eslint-plugin',
'unicorn',
'eslint-comments',
'import',
'jest',
'node',
'prettier',
'promise',
'regexp',
'sort-exports'
],
root: true,
settings: {
'import/core-modules': ['homebridge'],
'import/extensions': ['.ts', '.tsx'],
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
'import/resolver': { node: { extensions: ['.ts', '.tsx'] }, typescript: {} }
}
}