forked from CommunitySolidServer/CommunitySolidServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
89 lines (87 loc) · 3.07 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
85
86
87
88
89
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname, // this is the reason this is a .js file
project: ['./tsconfig.json'],
},
plugins: [
'eslint-plugin-tsdoc',
'eslint-plugin-import',
'eslint-plugin-unused-imports'
],
extends: [
'es/node',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript'
],
settings: {
'import/resolver': {
'typescript': {
'alwaysTryTypes': true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/rdf-js`
},
}
},
rules: {
'@typescript-eslint/lines-between-class-members': [ 'error', { exceptAfterSingleLine: true }],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-invalid-void-type': 'off', // breaks with default void in Asynchandler 2nd generic
'@typescript-eslint/no-unnecessary-condition': 'off', // problems with optional parameters
'@typescript-eslint/space-before-function-paren': [ 'error', 'never' ],
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/unified-signatures': 'off',
'class-methods-use-this': 'off', // conflicts with functions from interfaces that sometimes don't require `this`
'comma-dangle': ['error', 'always-multiline'],
'dot-location': ['error', 'property'],
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'max-len': ['error', { code: 120, ignoreUrls: true }],
'new-cap': 'off', // used for RDF constants
'no-param-reassign': 'off', // necessary in constructor overloading
'no-underscore-dangle': 'off', // conflicts with external libraries
'padding-line-between-statements': 'off',
'prefer-named-capture-group': 'off',
'tsdoc/syntax': 'error',
'unicorn/catch-error-name': 'off',
'unicorn/import-index': 'off',
'unicorn/no-fn-reference-in-iterator': 'off', // this prevents some functional programming paradigms
'unicorn/no-object-as-default-parameter': 'off',
// Naming conventions
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: [ 'typeParameter' ],
format: [ 'PascalCase' ],
prefix: [ 'T' ]
}
],
// Import
'sort-imports': 'off', // Disabled in favor of eslint-plugin-import
'import/order': ['error', {
alphabetize: {
order: 'asc',
caseInsensitive: true
}
}],
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': 'error',
'no-duplicate-imports': 'off', // doesn't work with type imports
'unused-imports/no-unused-imports-ts': 'error'
},
};