@eclipse-glsp/eslint-config 0.9.0-next.890ff998 → 0.9.0-next.a9855b44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -22
- package/configs/base.eslintrc.js +12 -13
- package/configs/errors.eslintrc.js +2 -42
- package/configs/warnings.eslintrc.js +72 -43
- package/index.js +7 -1
- package/package.json +1 -1
- package/no-prettier.js +0 -12
package/README.md
CHANGED
|
@@ -15,30 +15,11 @@ $ yarn add --dev @eclipse-glsp/eslint-config
|
|
|
15
15
|
```javascript
|
|
16
16
|
/** @type {import('eslint').Linter.Config} */
|
|
17
17
|
module.exports = {
|
|
18
|
-
extends:
|
|
18
|
+
extends: '@eclipse-glsp',
|
|
19
19
|
parserOptions: {
|
|
20
20
|
tsconfigRootDir: __dirname,
|
|
21
|
-
project:
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage without prettier
|
|
27
|
-
|
|
28
|
-
The default shared ESLint configuration is expected to be used in combination with [Prettier](https://prettier.io/).
|
|
29
|
-
As a consequence all stylistic rules that might conflict with Prettier haven been disabled.
|
|
30
|
-
We provide an additional `no-prettier` configuration that can be used for projects that don't use Prettier.
|
|
31
|
-
|
|
32
|
-
**Create a `.eslintrc.js`**:
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
/** @type {import('eslint').Linter.Config} */
|
|
36
|
-
module.exports = {
|
|
37
|
-
extends: "@eclipse-glsp/eslint-config/no-prettier",
|
|
38
|
-
parserOptions: {
|
|
39
|
-
tsconfigRootDir: __dirname,
|
|
40
|
-
project: "tsconfig.json",
|
|
41
|
-
},
|
|
21
|
+
project: 'tsconfig.json'
|
|
22
|
+
}
|
|
42
23
|
};
|
|
43
24
|
```
|
|
44
25
|
|
package/configs/base.eslintrc.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
parser:
|
|
2
|
+
parser: '@typescript-eslint/parser',
|
|
3
3
|
parserOptions: {
|
|
4
|
-
sourceType:
|
|
4
|
+
sourceType: 'module',
|
|
5
5
|
ecmaVersion: 6,
|
|
6
6
|
ecmaFeatures: {
|
|
7
|
-
jsx: true
|
|
8
|
-
}
|
|
7
|
+
jsx: true
|
|
8
|
+
}
|
|
9
9
|
},
|
|
10
|
-
plugins: [
|
|
10
|
+
plugins: ['@typescript-eslint', 'header', 'import', 'no-null'],
|
|
11
11
|
extends: [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"plugin:import/typescript",
|
|
12
|
+
'eslint:recommended',
|
|
13
|
+
'plugin:@typescript-eslint/recommended',
|
|
14
|
+
'plugin:import/errors',
|
|
15
|
+
'plugin:import/warnings',
|
|
16
|
+
'plugin:import/typescript'
|
|
18
17
|
],
|
|
19
18
|
env: {
|
|
20
19
|
browser: true,
|
|
21
20
|
mocha: true,
|
|
22
|
-
es6: true
|
|
21
|
+
es6: true
|
|
23
22
|
},
|
|
24
|
-
ignorePatterns: [
|
|
23
|
+
ignorePatterns: ['node_modules', '*.d.ts']
|
|
25
24
|
};
|
|
@@ -5,19 +5,11 @@ module.exports = {
|
|
|
5
5
|
// Possible Errors
|
|
6
6
|
'no-inner-declarations': 'off',
|
|
7
7
|
// Best Practices
|
|
8
|
-
curly: 'error',
|
|
9
|
-
'eol-last': 'error',
|
|
10
8
|
eqeqeq: ['error', 'smart'],
|
|
11
9
|
'guard-for-in': 'error',
|
|
12
10
|
'no-caller': 'error',
|
|
13
11
|
'no-eval': 'error',
|
|
14
|
-
'no-
|
|
15
|
-
'error',
|
|
16
|
-
{
|
|
17
|
-
builtinGlobals: false
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
'no-restricted-imports': ['error', '..', '../index', '../..', '../../index'],
|
|
12
|
+
'no-restricted-imports': ['error', '..', '../index', '../..', '../../index', 'src'],
|
|
21
13
|
'no-sequences': 'error',
|
|
22
14
|
'no-throw-literal': 'error',
|
|
23
15
|
'no-unused-expressions': [
|
|
@@ -30,33 +22,11 @@ module.exports = {
|
|
|
30
22
|
// Variables
|
|
31
23
|
'no-unused-vars': 'off', // typescript-eslint rule activated instead
|
|
32
24
|
'no-use-before-define': 'off', // typescript-eslint rule activated instead
|
|
33
|
-
// Stylistic Issues
|
|
34
|
-
'max-len': [
|
|
35
|
-
'error',
|
|
36
|
-
{
|
|
37
|
-
code: 180
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
'no-multiple-empty-lines': [
|
|
41
|
-
'error',
|
|
42
|
-
{
|
|
43
|
-
max: 1
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
25
|
'no-underscore-dangle': 'off',
|
|
47
26
|
quotes: 'off', // typescript-eslint rule activated instead
|
|
48
|
-
'space-before-function-paren': [
|
|
49
|
-
'error',
|
|
50
|
-
{
|
|
51
|
-
anonymous: 'always',
|
|
52
|
-
named: 'never',
|
|
53
|
-
asyncArrow: 'always'
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
27
|
'one-var': ['error', 'never'],
|
|
57
28
|
// ECMAScript6
|
|
58
29
|
'arrow-body-style': ['error', 'as-needed'],
|
|
59
|
-
'arrow-parens': ['error', 'as-needed'],
|
|
60
30
|
'no-var': 'error',
|
|
61
31
|
'prefer-const': [
|
|
62
32
|
'error',
|
|
@@ -65,12 +35,10 @@ module.exports = {
|
|
|
65
35
|
}
|
|
66
36
|
],
|
|
67
37
|
// @typescript-eslint/eslint-plugin
|
|
68
|
-
'@typescript-eslint/
|
|
38
|
+
'@typescript-eslint/naming-convention': 'off',
|
|
69
39
|
'@typescript-eslint/consistent-type-definitions': 'error',
|
|
70
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
71
40
|
'@typescript-eslint/no-misused-new': 'error',
|
|
72
41
|
'@typescript-eslint/no-empty-interface': 'off',
|
|
73
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
74
42
|
'@typescript-eslint/no-namespace': 'off',
|
|
75
43
|
'@typescript-eslint/no-use-before-define': 'off',
|
|
76
44
|
'@typescript-eslint/no-unused-vars': [
|
|
@@ -79,14 +47,6 @@ module.exports = {
|
|
|
79
47
|
args: 'none'
|
|
80
48
|
}
|
|
81
49
|
],
|
|
82
|
-
'@typescript-eslint/quotes': [
|
|
83
|
-
'error',
|
|
84
|
-
'single',
|
|
85
|
-
{
|
|
86
|
-
avoidEscape: true
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
'@typescript-eslint/semi': ['error', 'always'],
|
|
90
50
|
// eslint-plugin-header
|
|
91
51
|
'header/header': [
|
|
92
52
|
2,
|
|
@@ -1,50 +1,79 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
rules: {
|
|
3
3
|
// https://eslint.org/docs/rules/
|
|
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
|
-
|
|
4
|
+
'brace-style': ['warn', '1tbs'],
|
|
5
|
+
'comma-dangle': 'warn',
|
|
6
|
+
curly: 'warn',
|
|
7
|
+
'eol-last': 'warn',
|
|
8
|
+
'no-invalid-this': 'warn',
|
|
9
|
+
'no-new-wrappers': 'warn',
|
|
10
|
+
'no-return-await': 'warn',
|
|
11
|
+
'no-redeclare': 'off',
|
|
12
|
+
'no-shadow': [
|
|
13
|
+
'warn',
|
|
14
|
+
{
|
|
15
|
+
hoist: 'all'
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
'no-multiple-empty-lines': [
|
|
19
|
+
'warn',
|
|
20
|
+
{
|
|
21
|
+
max: 1
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
'no-trailing-spaces': 'warn',
|
|
25
|
+
'no-void': 'warn',
|
|
26
|
+
'prefer-const': [
|
|
27
|
+
'warn',
|
|
28
|
+
{
|
|
29
|
+
destructuring: 'all'
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
'prefer-object-spread': 'warn',
|
|
33
|
+
radix: 'warn',
|
|
34
|
+
'spaced-comment': [
|
|
35
|
+
'warn',
|
|
36
|
+
'always',
|
|
37
|
+
{
|
|
38
|
+
exceptions: ['*', '+', '-', '/', '!']
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
'space-before-function-paren': [
|
|
42
|
+
'warn',
|
|
43
|
+
{
|
|
44
|
+
anonymous: 'always',
|
|
45
|
+
named: 'never',
|
|
46
|
+
asyncArrow: 'always'
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
// Stylistic Issues
|
|
50
|
+
'max-len': [
|
|
51
|
+
'warn',
|
|
52
|
+
{
|
|
53
|
+
code: 140
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
'use-isnan': 'warn',
|
|
57
|
+
'arrow-parens': ['warn', 'as-needed'],
|
|
58
|
+
|
|
40
59
|
// @typescript-eslint/eslint-plugin
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
'@typescript-eslint/semi': ['warn', 'always'],
|
|
61
|
+
'@typescript-eslint/quotes': [
|
|
62
|
+
'warn',
|
|
63
|
+
'single',
|
|
64
|
+
{
|
|
65
|
+
avoidEscape: true
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
69
|
+
'warn',
|
|
43
70
|
{
|
|
44
|
-
allowExpressions: true
|
|
45
|
-
}
|
|
71
|
+
allowExpressions: true
|
|
72
|
+
}
|
|
46
73
|
],
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
74
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
75
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
76
|
+
'@typescript-eslint/type-annotation-spacing': 'warn',
|
|
77
|
+
'@typescript-eslint/no-explicit-any': 'off'
|
|
78
|
+
}
|
|
50
79
|
};
|
package/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
module.exports = require('./configs/base.eslintrc');
|
|
2
|
+
module.exports = require('./configs/errors.eslintrc');
|
|
3
|
+
module.exports = require('./configs/warnings.eslintrc');
|
|
4
|
+
/** @type {import('eslint').Linter.Config} */
|
|
1
5
|
module.exports = {
|
|
2
|
-
extends: [
|
|
6
|
+
extends: ['prettier', './configs/base.eslintrc', './configs/warnings.eslintrc', './configs/errors.eslintrc'],
|
|
7
|
+
ignorePatterns: ['**/{css,node_modules,lib}'],
|
|
8
|
+
root: true
|
|
3
9
|
};
|
package/package.json
CHANGED
package/no-prettier.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module.exports = require("./configs/base.eslintrc");
|
|
2
|
-
module.exports = require("./configs/errors.eslintrc");
|
|
3
|
-
module.exports = require("./configs/warnings.eslintrc");
|
|
4
|
-
/** @type {import('eslint').Linter.Config} */
|
|
5
|
-
module.exports = {
|
|
6
|
-
extends: [
|
|
7
|
-
"./configs/base.eslintrc",
|
|
8
|
-
"./configs/warnings.eslintrc",
|
|
9
|
-
"./configs/errors.eslintrc",
|
|
10
|
-
],
|
|
11
|
-
ignorePatterns: ["**/{css,node_modules,lib}"],
|
|
12
|
-
};
|