@eclipse-scout/eslint-config 22.0.39 → 23.1.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-scout/eslint-config",
3
- "version": "22.0.39",
3
+ "version": "23.1.0-beta.4",
4
4
  "description": "ESLint shareable config for the Scout style",
5
5
  "author": "BSI Business Systems Integration AG",
6
6
  "homepage": "https://www.eclipse.org/scout",
@@ -10,9 +10,9 @@
10
10
  },
11
11
  "license": "EPL-1.0",
12
12
  "engines": {
13
- "node": ">=16.13.0",
14
- "npm": ">=8.1.0",
15
- "pnpm": ">=6.22.2"
13
+ "node": ">=18.12.1",
14
+ "npm": ">=9.1.1",
15
+ "pnpm": ">=7.16.0"
16
16
  },
17
17
  "keywords": [
18
18
  "scout",
@@ -40,13 +40,15 @@
40
40
  ],
41
41
  "devDependencies": {
42
42
  "@eclipse-scout/releng": "^22.0.0",
43
- "eslint": "8.10.0"
43
+ "eslint": "8.27.0"
44
44
  },
45
45
  "dependencies": {
46
- "eslint-config-google": "0.14.0"
46
+ "typescript": "4.9.3",
47
+ "@typescript-eslint/parser": "5.43.0",
48
+ "@typescript-eslint/eslint-plugin": "5.43.0"
47
49
  },
48
50
  "peerDependencies": {
49
- "eslint": ">=8.10.0"
51
+ "eslint": ">=8.27.0"
50
52
  },
51
53
  "scripts": {
52
54
  "cleanup:snapshots": "releng-scripts cleanup:snapshots",
package/src/common.js ADDED
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * https://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors:
9
+ * BSI Business Systems Integration AG - initial API and implementation
10
+ */
11
+ module.exports = {
12
+ rules: {
13
+ 'indent': ['warn', 2, {'SwitchCase': 1}],
14
+ 'no-extra-parens': ['off'],
15
+ 'accessor-pairs': 'warn',
16
+ 'array-callback-return': 'error',
17
+ 'guard-for-in': 'off',
18
+ 'no-alert': 'warn',
19
+ 'no-eval': 'error',
20
+ 'no-extra-bind': 'error',
21
+ 'no-extra-label': 'error',
22
+ 'no-implicit-coercion': 'off',
23
+ 'no-implied-eval': 'error',
24
+ 'no-invalid-this': 'off',
25
+ 'no-iterator': 'error',
26
+ 'no-caller': 'warn',
27
+ 'no-console': 'off',
28
+ 'no-labels': 'error',
29
+ 'no-undef': 'off',
30
+ 'no-throw-literal': 'off',
31
+ 'camelcase': ['error', {allow: ['^\\$', '_']}],
32
+ 'no-lone-blocks': 'error',
33
+ 'no-loop-func': 'error',
34
+ 'no-multi-spaces': 'warn',
35
+ 'no-proto': 'error',
36
+ 'no-prototype-builtins': 'off',
37
+ 'no-return-assign': 'error',
38
+ 'eslint func-call-spacing': 'off',
39
+ 'no-return-await': 'error',
40
+ 'no-self-compare': 'error',
41
+ 'no-label-var': 'error',
42
+ 'no-shadow': 'off',
43
+ 'no-var': 'warn',
44
+ 'eol-last': ['warn', 'always'],
45
+ 'comma-spacing': ['error', {'before': false, 'after': true}],
46
+ 'array-bracket-spacing': ['warn', 'never'],
47
+ 'brace-style': ['error', '1tbs'],
48
+ 'require-unicode-regexp': 'off',
49
+ 'no-sequences': 'error',
50
+ 'no-unmodified-loop-condition': 'error',
51
+ 'computed-property-spacing': ['warn', 'never'],
52
+ 'no-useless-return': 'error',
53
+ 'no-else-return': 'error',
54
+ 'max-len': ['warn', 240, 2, {ignoreUrls: true, ignorePattern: '^import .*'}],
55
+ 'semi': ['error', 'always'],
56
+ 'quotes': ['error', 'single'],
57
+ 'comma-dangle': ['error', 'never'],
58
+ 'object-curly-spacing': ['error', 'never'],
59
+ 'operator-linebreak': 'off',
60
+ 'arrow-parens': ['error', 'as-needed'],
61
+ 'arrow-spacing': 'warn',
62
+ 'no-duplicate-imports': 'error',
63
+ 'one-var': 'off',
64
+ 'padded-blocks': 'off',
65
+ 'prefer-arrow-callback': 'warn',
66
+ 'prefer-template': 'off',
67
+ 'template-curly-spacing': ['error', 'never'],
68
+ 'linebreak-style': ['error', 'unix'],
69
+ 'newline-per-chained-call': 'off',
70
+ 'no-lonely-if': 'off',
71
+ 'new-cap': ['error', {'capIsNewExceptions': ['Deferred', '$.Event'], 'capIsNewExceptionPattern': 'Model$'}],
72
+ 'no-multi-assign': 'error',
73
+ 'no-unused-vars': 'off',
74
+ 'require-jsdoc': 'off',
75
+ 'no-plusplus': 'off',
76
+ 'no-trailing-spaces': 'warn',
77
+ 'space-before-function-paren': ['warn', {
78
+ 'anonymous': 'never',
79
+ 'named': 'never',
80
+ 'asyncArrow': 'always'
81
+ }],
82
+ 'curly': ['error', 'all'],
83
+ 'eqeqeq': ['error', 'always', {'null': 'ignore'}],
84
+ 'spaced-comment': ['warn', 'always', {'exceptions': ['*']}],
85
+ 'valid-jsdoc': 'off',
86
+ 'prefer-const': 'off',
87
+ 'prefer-rest-params': 'warn',
88
+ 'prefer-spread': 'warn',
89
+ 'max-classes-per-file': 'off'
90
+ }
91
+ };
package/src/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
6
- * http://www.eclipse.org/legal/epl-v10.html
6
+ * https://www.eclipse.org/legal/epl-v10.html
7
7
  *
8
8
  * Contributors:
9
9
  * BSI Business Systems Integration AG - initial API and implementation
@@ -17,88 +17,33 @@ module.exports = {
17
17
  jquery: true,
18
18
  jasmine: true
19
19
  },
20
- extends: ['eslint:recommended', 'google'],
20
+ extends: ['eslint:recommended', './common'],
21
+ // Use typescript parser for js files as well so babel parser is not necessary
22
+ parser: '@typescript-eslint/parser',
21
23
  parserOptions: {
22
24
  ecmaVersion: 6,
23
25
  sourceType: 'module'
24
26
  },
25
- rules: {
26
- 'indent': ['error', 2, {'SwitchCase': 1}],
27
- 'no-extra-parens': ['off'],
28
- 'accessor-pairs': 'warn',
29
- 'array-callback-return': 'error',
30
- 'guard-for-in': 'off',
31
- 'max-classes-per-file': ['error', 1],
32
- 'no-alert': 'warn',
33
- 'no-eval': 'error',
34
- 'no-extra-bind': 'error',
35
- 'no-extra-label': 'error',
36
- 'no-implicit-coercion': 'off',
37
- 'no-implied-eval': 'error',
38
- 'no-invalid-this': 'off',
39
- 'no-iterator': 'error',
40
- 'no-caller': 'warn',
41
- 'no-console': 'off',
42
- 'no-labels': 'error',
43
- 'no-undef': 'off',
44
- 'no-throw-literal': 'off',
45
- 'camelcase': ['error', {allow: ['^\\$', '_']}],
46
- 'no-lone-blocks': 'error',
47
- 'no-loop-func': 'error',
48
- 'no-multi-spaces': 'error',
49
- 'no-proto': 'error',
50
- 'no-prototype-builtins': 'off',
51
- 'no-return-assign': 'error',
52
- 'eslint func-call-spacing': 'off',
53
- 'no-return-await': 'error',
54
- 'no-self-compare': 'error',
55
- 'no-label-var': 'error',
56
- 'no-shadow': 'off',
57
- 'no-var': 'warn',
58
- 'eol-last': ['error', 'always'],
59
- 'comma-spacing': ['error', {'before': false, 'after': true}],
60
- 'array-bracket-spacing': ['error', 'never'],
61
- 'brace-style': ['error', '1tbs'],
62
- 'require-unicode-regexp': 'off',
63
- 'no-sequences': 'error',
64
- 'no-unmodified-loop-condition': 'error',
65
- 'computed-property-spacing': ['error', 'never'],
66
- 'no-useless-return': 'error',
67
- 'no-else-return': 'error',
68
- 'max-len': ['error', 240, 2, {ignoreUrls: true, ignorePattern: '^import .*'}],
69
- 'semi': ['error', 'always'],
70
- 'quotes': ['error', 'single'],
71
- 'comma-dangle': ['error', 'never'],
72
- 'object-curly-spacing': ['error', 'never'],
73
- 'operator-linebreak': 'off',
74
- 'arrow-parens': ['error', 'as-needed'],
75
- 'arrow-spacing': 'error',
76
- 'no-duplicate-imports': 'error',
77
- 'one-var': 'off',
78
- 'padded-blocks': 'off',
79
- 'prefer-arrow-callback': 'warn',
80
- 'prefer-const': 'off',
81
- 'prefer-rest-params': 'warn',
82
- 'prefer-spread': 'warn',
83
- 'prefer-template': 'off',
84
- 'template-curly-spacing': ['error', 'never'],
85
- 'linebreak-style': ['error', 'unix'],
86
- 'newline-per-chained-call': 'off',
87
- 'no-lonely-if': 'off',
88
- 'new-cap': ['error', {'capIsNewExceptions': ['Deferred']}],
89
- 'no-multi-assign': 'error',
90
- 'no-unused-vars': 'off',
91
- 'require-jsdoc': 'off',
92
- 'no-plusplus': 'off',
93
- 'no-trailing-spaces': 'error',
94
- 'space-before-function-paren': ['error', {
95
- 'anonymous': 'never',
96
- 'named': 'never',
97
- 'asyncArrow': 'always'
98
- }],
99
- 'curly': ['error', 'all'],
100
- 'eqeqeq': ['error', 'always', {'null': 'ignore'}],
101
- 'spaced-comment': ['error', 'always', {'exceptions': ['*']}],
102
- 'valid-jsdoc': 'off'
103
- }
27
+ overrides: [{
28
+ extends: ['plugin:@typescript-eslint/recommended', './common'],
29
+ plugins: ['@typescript-eslint'],
30
+ files: ['*.ts', '*.tsx'],
31
+ rules: {
32
+ '@typescript-eslint/ban-types': 'warn', // Change from error to warn
33
+ '@typescript-eslint/no-inferrable-types': 'warn', // Change from error to warn
34
+ '@typescript-eslint/ban-ts-comment': 'off', // Allow ts-ignore
35
+ '@typescript-eslint/no-unused-vars': 'off', // Allow unused parameters
36
+ 'spaced-comment': ['error', 'always', {'exceptions': ['*'], 'markers': ['/']}], // Allow triple slash directives
37
+ 'semi': 'off', // Disable because it will be replaced by typescript rule below to avoid conflicting rules with semicolon in interfaces
38
+ '@typescript-eslint/semi': ['error'],
39
+ '@typescript-eslint/no-explicit-any': 'off',
40
+ '@typescript-eslint/member-delimiter-style': 'warn', // Enforce semicolon for interface members for consistency,
41
+ '@typescript-eslint/no-this-alias': 'off', // Allow assigment of this to a variable, e.g. for better readability. 'That' and 'self' are not used often anymore.
42
+ 'indent': 'off', // Disable because it will be replaced by the following ts rule
43
+ '@typescript-eslint/indent': ['error', 2, {'SwitchCase': 1, 'ignoredNodes': ['PropertyDefinition[decorators]']}], // Workarounds bug https://github.com/typescript-eslint/typescript-eslint/issues/1824. See also https://github.com/eslint/eslint/issues/15299#issuecomment-967762181
44
+ 'linebreak-style': 'off',
45
+ '@typescript-eslint/prefer-ts-expect-error': 'warn',
46
+ '@typescript-eslint/no-empty-function': 'off'
47
+ }
48
+ }]
104
49
  };