@eclipse-glsp/eslint-config 2.7.0-next.0 → 2.7.0-next.12

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 CHANGED
@@ -10,17 +10,30 @@ yarn add --dev @eclipse-glsp/eslint-config
10
10
 
11
11
  ## Usage
12
12
 
13
- **Create a `.eslintrc.js`**:
13
+ **Create an `eslint.config.mjs`**:
14
14
 
15
15
  ```javascript
16
- /** @type {import('eslint').Linter.Config} */
17
- module.exports = {
18
- extends: '@eclipse-glsp',
19
- parserOptions: {
20
- tsconfigRootDir: __dirname,
21
- project: 'tsconfig.json'
16
+ import glspConfig from '@eclipse-glsp/eslint-config';
17
+
18
+ export default [
19
+ ...glspConfig,
20
+ {
21
+ languageOptions: {
22
+ parserOptions: {
23
+ tsconfigRootDir: import.meta.dirname,
24
+ project: 'tsconfig.json'
25
+ }
26
+ }
22
27
  }
23
- };
28
+ ];
29
+ ```
30
+
31
+ Individual config layers can also be imported separately:
32
+
33
+ ```javascript
34
+ import baseConfig from '@eclipse-glsp/eslint-config/base';
35
+ import warningsConfig from '@eclipse-glsp/eslint-config/warnings';
36
+ import errorsConfig from '@eclipse-glsp/eslint-config/errors';
24
37
  ```
25
38
 
26
39
  ## More information
@@ -0,0 +1,36 @@
1
+ const js = require('@eslint/js');
2
+ const tseslint = require('typescript-eslint');
3
+ const importX = require('eslint-plugin-import-x');
4
+ const header = require('@tony.ganchev/eslint-plugin-header');
5
+ const noNull = require('eslint-plugin-no-null');
6
+ const chaiFriendly = require('eslint-plugin-chai-friendly');
7
+ const stylistic = require('@stylistic/eslint-plugin');
8
+ const globals = require('globals');
9
+
10
+ module.exports = [
11
+ js.configs.recommended,
12
+ ...tseslint.configs.recommended,
13
+ importX.flatConfigs.recommended,
14
+ importX.flatConfigs.typescript,
15
+ {
16
+ name: '@eclipse-glsp/base',
17
+ languageOptions: {
18
+ ecmaVersion: 6,
19
+ sourceType: 'module',
20
+ parserOptions: {
21
+ ecmaFeatures: { jsx: true }
22
+ },
23
+ globals: {
24
+ ...globals.browser,
25
+ ...globals.mocha,
26
+ ...globals.es2015
27
+ }
28
+ },
29
+ plugins: {
30
+ header: header,
31
+ 'no-null': noNull,
32
+ 'chai-friendly': chaiFriendly,
33
+ '@stylistic': stylistic
34
+ }
35
+ }
36
+ ];
@@ -0,0 +1,87 @@
1
+ const year = new Date().getFullYear();
2
+
3
+ module.exports = [
4
+ {
5
+ name: '@eclipse-glsp/errors',
6
+ rules: {
7
+ // https://eslint.org/docs/rules/
8
+ // Possible Errors
9
+ 'no-inner-declarations': 'off',
10
+ // Best Practices
11
+ eqeqeq: ['error', 'smart'],
12
+ 'guard-for-in': 'error',
13
+ 'no-caller': 'error',
14
+ 'no-eval': 'error',
15
+ 'no-restricted-imports': ['error', '..', '../index', '../..', '../../index', 'src'],
16
+ 'no-sequences': 'error',
17
+ 'no-throw-literal': 'error',
18
+ // Variables
19
+ 'no-unused-vars': 'off', // typescript-eslint rule activated instead
20
+ 'no-use-before-define': 'off', // typescript-eslint rule activated instead
21
+ 'no-underscore-dangle': 'off',
22
+ quotes: 'off', // @stylistic rule activated instead
23
+ 'one-var': ['error', 'never'],
24
+ // ECMAScript6
25
+ 'arrow-body-style': ['error', 'as-needed'],
26
+ 'no-var': 'error',
27
+ 'prefer-const': [
28
+ 'error',
29
+ {
30
+ destructuring: 'all'
31
+ }
32
+ ],
33
+ // @typescript-eslint/eslint-plugin
34
+ '@typescript-eslint/naming-convention': 'off',
35
+ '@typescript-eslint/consistent-type-definitions': 'error',
36
+ '@typescript-eslint/no-misused-new': 'error',
37
+ '@typescript-eslint/no-empty-object-type': 'off', // was no-empty-interface
38
+ '@typescript-eslint/no-namespace': 'off',
39
+ '@typescript-eslint/no-use-before-define': 'off',
40
+ '@typescript-eslint/no-unused-vars': [
41
+ 'error',
42
+ {
43
+ args: 'none',
44
+ caughtErrors: 'none'
45
+ }
46
+ ],
47
+ // eslint-plugin-header (via @tony.ganchev/eslint-plugin-header fork)
48
+ 'header/header': [
49
+ 2,
50
+ 'block',
51
+ [
52
+ {
53
+ pattern: '[\n\r]+ \\* Copyright \\([cC]\\) \\d{4}(-\\d{4})? .*[\n\r]+',
54
+ template: `*******************************************************************************
55
+ * Copyright (c) ${year} EclipseSource and others.
56
+ *
57
+ * This program and the accompanying materials are made available under the
58
+ * terms of the Eclipse Public License v. 2.0 which is available at
59
+ * http://www.eclipse.org/legal/epl-2.0.
60
+ *
61
+ * This Source Code may also be made available under the following Secondary
62
+ * Licenses when the conditions for such availability set forth in the Eclipse
63
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
64
+ * with the GNU Classpath Exception which is available at
65
+ * https://www.gnu.org/software/classpath/license.html.
66
+ *
67
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
68
+ *******************************************************************************`
69
+ }
70
+ ]
71
+ ],
72
+ // eslint-plugin-import-x (renamed from import/)
73
+ 'import-x/export': 'off', // we have multiple exports due to namespaces, enums and classes that share the same name
74
+ // eslint-plugin-no-null
75
+ 'no-null/no-null': 'error',
76
+ // chai friendly
77
+ 'no-unused-expressions': 'off',
78
+ 'chai-friendly/no-unused-expressions': [
79
+ 'error',
80
+ {
81
+ allowShortCircuit: true,
82
+ allowTernary: true
83
+ }
84
+ ]
85
+ }
86
+ }
87
+ ];
@@ -0,0 +1,86 @@
1
+ module.exports = [
2
+ {
3
+ name: '@eclipse-glsp/warnings',
4
+ rules: {
5
+ // https://eslint.org/docs/rules/
6
+ curly: 'warn',
7
+ 'no-invalid-this': 'warn',
8
+ 'no-new-wrappers': 'warn',
9
+ 'no-return-await': 'warn',
10
+ 'no-redeclare': 'off',
11
+ 'no-shadow': 'off',
12
+ 'no-void': 'warn',
13
+ 'prefer-const': [
14
+ 'warn',
15
+ {
16
+ destructuring: 'all'
17
+ }
18
+ ],
19
+ 'prefer-object-spread': 'warn',
20
+ radix: 'warn',
21
+ 'spaced-comment': [
22
+ 'warn',
23
+ 'always',
24
+ {
25
+ exceptions: ['*', '+', '-', '/', '!']
26
+ }
27
+ ],
28
+ 'use-isnan': 'warn',
29
+
30
+ // Formatting rules → @stylistic (moved from core ESLint and @typescript-eslint)
31
+ '@stylistic/brace-style': 'off',
32
+ '@stylistic/comma-dangle': 'warn',
33
+ '@stylistic/eol-last': 'warn',
34
+ '@stylistic/no-multiple-empty-lines': [
35
+ 'warn',
36
+ {
37
+ max: 1
38
+ }
39
+ ],
40
+ '@stylistic/no-trailing-spaces': 'warn',
41
+ '@stylistic/space-before-function-paren': [
42
+ 'warn',
43
+ {
44
+ anonymous: 'always',
45
+ named: 'never',
46
+ asyncArrow: 'always'
47
+ }
48
+ ],
49
+ '@stylistic/max-len': [
50
+ 'warn',
51
+ {
52
+ code: 140
53
+ }
54
+ ],
55
+ '@stylistic/arrow-parens': ['warn', 'as-needed'],
56
+ '@stylistic/semi': ['warn', 'always'],
57
+ '@stylistic/quotes': [
58
+ 'warn',
59
+ 'single',
60
+ {
61
+ avoidEscape: true
62
+ }
63
+ ],
64
+ '@stylistic/type-annotation-spacing': 'warn',
65
+
66
+ // @typescript-eslint/eslint-plugin
67
+ '@typescript-eslint/explicit-function-return-type': [
68
+ 'warn',
69
+ {
70
+ allowExpressions: true
71
+ }
72
+ ],
73
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
74
+ '@typescript-eslint/no-non-null-assertion': 'off',
75
+ '@typescript-eslint/no-explicit-any': 'off',
76
+ '@typescript-eslint/no-this-alias': 'off',
77
+ '@typescript-eslint/no-shadow': 'warn',
78
+
79
+ // eslint-plugin-import-x (renamed from import/)
80
+ 'import-x/no-deprecated': 'warn',
81
+
82
+ // Replaces deprecation/deprecation
83
+ '@typescript-eslint/no-deprecated': 'warn'
84
+ }
85
+ }
86
+ ];
package/index.js CHANGED
@@ -1,9 +1,19 @@
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: ['prettier', './configs/base.eslintrc', './configs/warnings.eslintrc', './configs/errors.eslintrc'],
7
- ignorePatterns: ['**/{css,node_modules,lib}'],
8
- root: true
9
- };
1
+ const baseConfig = require('./configs/base');
2
+ const warningsConfig = require('./configs/warnings');
3
+ const errorsConfig = require('./configs/errors');
4
+ const eslintConfigPrettier = require('eslint-config-prettier');
5
+
6
+ module.exports = [
7
+ // Global ignores (replaces ignorePatterns + .eslintignore)
8
+ {
9
+ ignores: ['**/{css,node_modules,lib,dist}', '**/*.d.ts', '**/*.map']
10
+ },
11
+ // Base config (parser, plugins, recommended presets)
12
+ ...baseConfig,
13
+ // Warning-level rules
14
+ ...warningsConfig,
15
+ // Error-level rules
16
+ ...errorsConfig,
17
+ // Prettier (must be last — disables conflicting formatting rules)
18
+ eslintConfigPrettier
19
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/eslint-config",
3
- "version": "2.7.0-next.0+8a89e03",
3
+ "version": "2.7.0-next.12+1dcc061",
4
4
  "description": "Shared ESLint configuration for GLSP projects",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -24,20 +24,28 @@
24
24
  "url": "https://projects.eclipse.org/projects/ecd.glsp"
25
25
  }
26
26
  ],
27
+ "exports": {
28
+ ".": "./index.js",
29
+ "./base": "./configs/base.js",
30
+ "./warnings": "./configs/warnings.js",
31
+ "./errors": "./configs/errors.js"
32
+ },
27
33
  "main": "index.js",
28
34
  "peerDependencies": {
29
- "@typescript-eslint/eslint-plugin": "^6.7.5",
30
- "@typescript-eslint/parser": "^6.7.5",
31
- "eslint": "^8.51.0",
32
- "eslint-config-prettier": "^9.0.0",
33
- "eslint-plugin-chai-friendly": "^0.7.2",
34
- "eslint-plugin-deprecation": "^2.0.0",
35
- "eslint-plugin-header": "^3.1.1",
36
- "eslint-plugin-import": "^2.28.1",
37
- "eslint-plugin-no-null": "^1.0.2"
35
+ "@eslint/js": "^9.0.0",
36
+ "@stylistic/eslint-plugin": "^2.0.0",
37
+ "@tony.ganchev/eslint-plugin-header": "^3.1.1",
38
+ "eslint": "^9.0.0",
39
+ "eslint-config-prettier": "^10.0.0",
40
+ "eslint-import-resolver-typescript": "^4.0.0",
41
+ "eslint-plugin-chai-friendly": "^1.0.0",
42
+ "eslint-plugin-import-x": "^4.0.0",
43
+ "eslint-plugin-no-null": "^1.0.2",
44
+ "globals": "^15.0.0",
45
+ "typescript-eslint": "^8.0.0"
38
46
  },
39
47
  "publishConfig": {
40
48
  "access": "public"
41
49
  },
42
- "gitHead": "8a89e0377173c9c5ead2567adfb41609d13ffe2b"
50
+ "gitHead": "1dcc061aad51e8aa6b2c1d8657e0a23bcd3c5a61"
43
51
  }
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- sourceType: 'module',
5
- ecmaVersion: 6,
6
- ecmaFeatures: {
7
- jsx: true
8
- }
9
- },
10
- plugins: ['@typescript-eslint', 'header', 'import', 'no-null', 'chai-friendly', 'deprecation'],
11
- extends: [
12
- 'eslint:recommended',
13
- 'plugin:@typescript-eslint/recommended',
14
- 'plugin:import/errors',
15
- 'plugin:import/warnings',
16
- 'plugin:import/typescript'
17
- ],
18
- env: {
19
- browser: true,
20
- mocha: true,
21
- es6: true
22
- },
23
- ignorePatterns: ['node_modules', '*.d.ts']
24
- };
@@ -1,82 +0,0 @@
1
- const year = new Date().getFullYear();
2
- module.exports = {
3
- rules: {
4
- // https://eslint.org/docs/rules/
5
- // Possible Errors
6
- 'no-inner-declarations': 'off',
7
- // Best Practices
8
- eqeqeq: ['error', 'smart'],
9
- 'guard-for-in': 'error',
10
- 'no-caller': 'error',
11
- 'no-eval': 'error',
12
- 'no-restricted-imports': ['error', '..', '../index', '../..', '../../index', 'src'],
13
- 'no-sequences': 'error',
14
- 'no-throw-literal': 'error',
15
- // Variables
16
- 'no-unused-vars': 'off', // typescript-eslint rule activated instead
17
- 'no-use-before-define': 'off', // typescript-eslint rule activated instead
18
- 'no-underscore-dangle': 'off',
19
- quotes: 'off', // typescript-eslint rule activated instead
20
- 'one-var': ['error', 'never'],
21
- // ECMAScript6
22
- 'arrow-body-style': ['error', 'as-needed'],
23
- 'no-var': 'error',
24
- 'prefer-const': [
25
- 'error',
26
- {
27
- destructuring: 'all'
28
- }
29
- ],
30
- // @typescript-eslint/eslint-plugin
31
- '@typescript-eslint/naming-convention': 'off',
32
- '@typescript-eslint/consistent-type-definitions': 'error',
33
- '@typescript-eslint/no-misused-new': 'error',
34
- '@typescript-eslint/no-empty-interface': 'off',
35
- '@typescript-eslint/no-namespace': 'off',
36
- '@typescript-eslint/no-use-before-define': 'off',
37
- '@typescript-eslint/no-unused-vars': [
38
- 'error',
39
- {
40
- args: 'none'
41
- }
42
- ],
43
- // eslint-plugin-header
44
- 'header/header': [
45
- 2,
46
- 'block',
47
- [
48
- {
49
- pattern: '[\n\r]+ \\* Copyright \\([cC]\\) \\d{4}(-\\d{4})? .*[\n\r]+',
50
- template: `*******************************************************************************
51
- * Copyright (c) ${year} EclipseSource and others.
52
- *
53
- * This program and the accompanying materials are made available under the
54
- * terms of the Eclipse Public License v. 2.0 which is available at
55
- * http://www.eclipse.org/legal/epl-2.0.
56
- *
57
- * This Source Code may also be made available under the following Secondary
58
- * Licenses when the conditions for such availability set forth in the Eclipse
59
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
60
- * with the GNU Classpath Exception which is available at
61
- * https://www.gnu.org/software/classpath/license.html.
62
- *
63
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
64
- *******************************************************************************`
65
- }
66
- ]
67
- ],
68
- // eslint-plugin-import
69
- 'import/export': 'off', // we have multiple exports due to namespaces, enums and classes that share the same name
70
- // eslint-plugin-no-null
71
- 'no-null/no-null': 'error',
72
- // chai friendly
73
- 'no-unused-expressions': 'off',
74
- 'chai-friendly/no-unused-expressions': [
75
- 'error',
76
- {
77
- allowShortCircuit: true,
78
- allowTernary: true
79
- }
80
- ]
81
- }
82
- };
@@ -1,79 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- // https://eslint.org/docs/rules/
4
- 'brace-style': 'off',
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': 'off',
13
- 'no-multiple-empty-lines': [
14
- 'warn',
15
- {
16
- max: 1
17
- }
18
- ],
19
- 'no-trailing-spaces': 'warn',
20
- 'no-void': 'warn',
21
- 'prefer-const': [
22
- 'warn',
23
- {
24
- destructuring: 'all'
25
- }
26
- ],
27
- 'prefer-object-spread': 'warn',
28
- radix: 'warn',
29
- 'spaced-comment': [
30
- 'warn',
31
- 'always',
32
- {
33
- exceptions: ['*', '+', '-', '/', '!']
34
- }
35
- ],
36
- 'space-before-function-paren': [
37
- 'warn',
38
- {
39
- anonymous: 'always',
40
- named: 'never',
41
- asyncArrow: 'always'
42
- }
43
- ],
44
- // Stylistic Issues
45
- 'max-len': [
46
- 'warn',
47
- {
48
- code: 140
49
- }
50
- ],
51
- 'use-isnan': 'warn',
52
- 'arrow-parens': ['warn', 'as-needed'],
53
-
54
- // @typescript-eslint/eslint-plugin
55
- '@typescript-eslint/semi': ['warn', 'always'],
56
- '@typescript-eslint/quotes': [
57
- 'warn',
58
- 'single',
59
- {
60
- avoidEscape: true
61
- }
62
- ],
63
- '@typescript-eslint/explicit-function-return-type': [
64
- 'warn',
65
- {
66
- allowExpressions: true
67
- }
68
- ],
69
- '@typescript-eslint/explicit-module-boundary-types': 'off',
70
- '@typescript-eslint/no-non-null-assertion': 'off',
71
- '@typescript-eslint/type-annotation-spacing': 'warn',
72
- '@typescript-eslint/no-explicit-any': 'off',
73
- '@typescript-eslint/no-this-alias': 'off',
74
- '@typescript-eslint/no-shadow': 'warn',
75
- /// eslint-plugin-deprecation plugin
76
- 'import/no-deprecated': 'warn',
77
- 'deprecation/deprecation': 'warn'
78
- }
79
- };