@open-xchange/linter-presets 0.5.1 → 0.7.0
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/CHANGELOG.md +77 -69
- package/dist/eslint/config/base.d.ts +1 -1
- package/dist/eslint/config/base.js +4 -3
- package/dist/eslint/config/directives.js +6 -4
- package/dist/eslint/config/js.js +2 -2
- package/dist/eslint/config/jsdoc.js +7 -2
- package/dist/eslint/config/json.js +4 -1
- package/dist/eslint/config/license.js +2 -1
- package/dist/eslint/config/markdown.d.ts +11 -0
- package/dist/eslint/config/markdown.js +14 -0
- package/dist/eslint/config/stylistic.js +2 -0
- package/dist/eslint/config/ts.js +4 -3
- package/dist/eslint/config/yaml.js +4 -1
- package/dist/eslint/env/react.d.ts +1 -1
- package/dist/eslint/env/react.js +2 -1
- package/dist/eslint/index.js +3 -0
- package/dist/eslint/shared/env-utils.d.ts +39 -0
- package/dist/eslint/shared/env-utils.js +41 -0
- package/doc/eslint/README.md +1 -0
- package/package.json +98 -98
- package/.vscode/settings.json +0 -3
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,152 +1,160 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## `0.7.0` – 2024-Aug-27
|
|
4
|
+
|
|
5
|
+
- added: (ESLint) rule `@typescript-eslint/no-deprecated`
|
|
6
|
+
|
|
7
|
+
## `0.6.0` – 2024-Aug-26
|
|
8
|
+
|
|
9
|
+
- added: (ESLint) plugin `@eslint/markdown`
|
|
10
|
+
|
|
11
|
+
## `0.5.1` – 2024-Aug-22
|
|
4
12
|
|
|
5
13
|
- chore: bump dependencies
|
|
6
14
|
|
|
7
|
-
##
|
|
15
|
+
## `0.5.0` – 2024-Aug-15
|
|
8
16
|
|
|
9
|
-
- added:
|
|
10
|
-
- added:
|
|
11
|
-
- added:
|
|
17
|
+
- added: (ESLint) option `testingLib` for environment `env.vitest`
|
|
18
|
+
- added: (ESLint) plugins `testing-library`, `jest-dom`, and option `testingLib` for environment `env.jest`
|
|
19
|
+
- added: (ESLint) option `jestDom` for environments `env.jest` and `env.vitest`
|
|
12
20
|
- chore: bump dependencies
|
|
13
21
|
|
|
14
|
-
##
|
|
22
|
+
## `0.4.3` – 2024-Aug-08
|
|
15
23
|
|
|
16
24
|
- chore: bump dependencies
|
|
17
25
|
|
|
18
|
-
##
|
|
26
|
+
## `0.4.2` – 2024-Aug-06
|
|
19
27
|
|
|
20
|
-
- added:
|
|
28
|
+
- added: (ESLint) rules `jsdoc/check-template-names`, `jsdoc/require-asterisk-prefix`
|
|
21
29
|
|
|
22
|
-
##
|
|
30
|
+
## `0.4.1` – 2024-Aug-06
|
|
23
31
|
|
|
24
|
-
- added:
|
|
32
|
+
- added: (StyleLint) default ignore globs (`dist`)
|
|
25
33
|
|
|
26
|
-
##
|
|
34
|
+
## `0.4.0` – 2024-Aug-06
|
|
27
35
|
|
|
28
|
-
- added:
|
|
29
|
-
- changed:
|
|
36
|
+
- added: (ESLint) rules `jsdoc/require-template`, `jsdoc/require-throws`
|
|
37
|
+
- changed: (StyleLint) default values of `stylistic` option (indent 4 spaces, double quotes)
|
|
30
38
|
|
|
31
|
-
##
|
|
39
|
+
## `0.3.3` – 2024-Aug-01
|
|
32
40
|
|
|
33
|
-
- fixed:
|
|
41
|
+
- fixed: (ESLint) `env.tsconfig` must disable "projectService" explicitly
|
|
34
42
|
|
|
35
|
-
##
|
|
43
|
+
## `0.3.2` – 2024-Aug-01
|
|
36
44
|
|
|
37
|
-
- added:
|
|
45
|
+
- added: (ESLint) restore environment `env.tsconfig` to workaround VSCode issues
|
|
38
46
|
|
|
39
|
-
##
|
|
47
|
+
## `0.3.1` – 2024-Aug-01
|
|
40
48
|
|
|
41
|
-
- added:
|
|
42
|
-
- changed:
|
|
49
|
+
- added: (ESLint) default ignore globs (`dist`, `gitlab-ci`, and others)
|
|
50
|
+
- changed: (ESLint) default values of `stylistic` option (indent 4 spaces, always semicolons, double quotes)
|
|
43
51
|
|
|
44
|
-
##
|
|
52
|
+
## `0.3.0` – 2024-Aug-01
|
|
45
53
|
|
|
46
|
-
- chore:
|
|
47
|
-
- removed:
|
|
48
|
-
- changed:
|
|
54
|
+
- chore: (ESLint) [major bump of `typescript-eslint` to v8](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/)
|
|
55
|
+
- removed: (ESLint) environment `env.tsconfig` (always using `projectService` of `typescript-eslint` instead)
|
|
56
|
+
- changed: (ESLint) pattern for unused variables is now `^_.` (instead `^_`) to detect dangling underscore imports
|
|
49
57
|
|
|
50
|
-
##
|
|
58
|
+
## `0.2.0` – 2024-Jul-31
|
|
51
59
|
|
|
52
60
|
- chore: bump dependencies
|
|
53
61
|
- chore: bump peer dependencies (eslint `^9.8` and stylelint `^16.8`)
|
|
54
62
|
|
|
55
|
-
##
|
|
63
|
+
## `0.1.13` – 2024-Jul-31
|
|
56
64
|
|
|
57
65
|
- change: disable rule `no-console` in environment `env.node`
|
|
58
66
|
- chore: add renovate bot
|
|
59
67
|
- chore: bump dependencies
|
|
60
68
|
|
|
61
|
-
##
|
|
69
|
+
## `0.1.12` – 2024-Jul-30
|
|
62
70
|
|
|
63
71
|
- chore: bump `eslint-plugin-jsdoc` dependency
|
|
64
72
|
|
|
65
|
-
##
|
|
73
|
+
## `0.1.11` – 2024-Jul-30
|
|
66
74
|
|
|
67
75
|
- chore: bump dependencies
|
|
68
76
|
- skipped eslint-plugin-jsdoc: <https://github.com/gajus/eslint-plugin-jsdoc/issues/1282>
|
|
69
77
|
- skipped @stylistic/eslint-plugin: <https://github.com/typescript-eslint/typescript-eslint/issues/9655>
|
|
70
78
|
|
|
71
|
-
##
|
|
79
|
+
## `0.1.10` – 2024-Jul-26
|
|
72
80
|
|
|
73
81
|
- chore: bump dependencies
|
|
74
82
|
- chore: remove old license headers
|
|
75
83
|
|
|
76
|
-
##
|
|
84
|
+
## `0.1.9` – 2024-Jul-26
|
|
77
85
|
|
|
78
|
-
- added:
|
|
86
|
+
- added: (ESLint) `env.node`: option `settings` with shared settings for `eslint-plugin-n`
|
|
79
87
|
- chore: bump dependencies
|
|
80
88
|
|
|
81
|
-
##
|
|
89
|
+
## `0.1.8` – 2024-Jul-23
|
|
82
90
|
|
|
83
|
-
- fixed:
|
|
91
|
+
- fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
|
|
84
92
|
|
|
85
|
-
##
|
|
93
|
+
## `0.1.7` – 2024-Jul-23
|
|
86
94
|
|
|
87
|
-
- changed:
|
|
88
|
-
- changed:
|
|
89
|
-
- chore:
|
|
95
|
+
- changed: (ESLint) reverted option `modules` for `env.project` (introduced in 0.1.6)
|
|
96
|
+
- changed: (ESLint) `env.project`: renamed option `packages` to `hierarchy`
|
|
97
|
+
- chore: (ESLint) split rule `env-project/no-invalid-modules` (added `env-project/no-invalid-hierarchy`)
|
|
90
98
|
|
|
91
|
-
##
|
|
99
|
+
## `0.1.6` – 2024-Jul-23
|
|
92
100
|
|
|
93
|
-
- changed:
|
|
94
|
-
- chore:
|
|
101
|
+
- changed: (ESLint) moved rule options for `env.project` into own `modules` option
|
|
102
|
+
- chore: (ESLint) unit test for `env.project`
|
|
95
103
|
|
|
96
|
-
##
|
|
104
|
+
## `0.1.5` – 2024-Jul-23
|
|
97
105
|
|
|
98
106
|
- chore: bump dependencies
|
|
99
107
|
|
|
100
|
-
##
|
|
108
|
+
## `0.1.4` – 2024-Jul-15
|
|
101
109
|
|
|
102
|
-
- added:
|
|
110
|
+
- added: (ESLint) option `language.nativeDecorators` to support native ES decorators in JS files
|
|
103
111
|
|
|
104
|
-
##
|
|
112
|
+
## `0.1.3` – 2024-Jul-15
|
|
105
113
|
|
|
106
114
|
- chore: bump dependencies
|
|
107
115
|
|
|
108
|
-
##
|
|
116
|
+
## `0.1.2` – 2024-Jul-12
|
|
109
117
|
|
|
110
|
-
- added:
|
|
118
|
+
- added: (ESLint) option `restricted.nativeDecorators`
|
|
111
119
|
|
|
112
|
-
##
|
|
120
|
+
## `0.1.1` – 2024-Jul-11
|
|
113
121
|
|
|
114
|
-
- changed:
|
|
122
|
+
- changed: (ESLint) option `stylistic.semi` as enum (always/never/off)
|
|
115
123
|
|
|
116
|
-
##
|
|
124
|
+
## `0.1.0` – 2024-Jul-10
|
|
117
125
|
|
|
118
126
|
- chore: converted source code to TypeScript
|
|
119
127
|
|
|
120
|
-
##
|
|
128
|
+
## `0.0.6` – 2024-Jul-10
|
|
121
129
|
|
|
122
|
-
- fixed:
|
|
130
|
+
- fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
|
|
123
131
|
|
|
124
|
-
##
|
|
132
|
+
## `0.0.5` – 2024-Jul-10
|
|
125
133
|
|
|
126
|
-
- changed:
|
|
127
|
-
- chore:
|
|
134
|
+
- changed: (ESLint) `env-project/no-invalid-modules`: renamed option `packages.dependsOn` to `packages.extends`
|
|
135
|
+
- chore: (ESLint) documentation for option `restricted`
|
|
128
136
|
- chore: bump dependencies
|
|
129
137
|
|
|
130
|
-
##
|
|
138
|
+
## `0.0.4` – 2024-Jul-10
|
|
131
139
|
|
|
132
|
-
- fixed:
|
|
140
|
+
- fixed: (ESLint) file exists detection in rule `env-project/no-invalid-modules`
|
|
133
141
|
|
|
134
|
-
##
|
|
142
|
+
## `0.0.3` – 2024-Jul-09
|
|
135
143
|
|
|
136
|
-
- added:
|
|
137
|
-
- added:
|
|
138
|
-
- added:
|
|
139
|
-
- added:
|
|
140
|
-
- added:
|
|
141
|
-
- changed:
|
|
142
|
-
- fixed:
|
|
144
|
+
- added: (ESLint) `eslint-plugin-import`
|
|
145
|
+
- added: (ESLint) option "restricted" for `env.node` and `env.browser`
|
|
146
|
+
- added: (ESLint) custom rule `env-project/no-amd-module-directive`
|
|
147
|
+
- added: (ESLint) custom rule `env-project/no-invalid-modules`
|
|
148
|
+
- added: (ESLint) environment `env.project` (wraps all `env-project/*` rules)
|
|
149
|
+
- changed: (ESLint) environment `env.plugin` renamed to `env.eslint`
|
|
150
|
+
- fixed: (StyleLint) support for LESS files
|
|
143
151
|
- chore: bump dependencies
|
|
144
152
|
|
|
145
|
-
##
|
|
153
|
+
## `0.0.2` – 2024-Jul-08
|
|
146
154
|
|
|
147
|
-
- added:
|
|
155
|
+
- added: (StyleLint) project configuration (core, less, sass, license, stylistic)
|
|
148
156
|
|
|
149
|
-
##
|
|
157
|
+
## `0.0.1` – 2024-Jul-05
|
|
150
158
|
|
|
151
|
-
- added:
|
|
152
|
-
- added:
|
|
159
|
+
- added: (ESLint) project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
|
|
160
|
+
- added: (ESLint) environment presets (tsconfig, node, browser, jest, vitest, codecept, react, plugin)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
-
import type
|
|
2
|
+
import { type LanguageOptions } from "../shared/env-utils.js";
|
|
3
3
|
/**
|
|
4
4
|
* Defines standard module settings and additional rules targeting JavaScript
|
|
5
5
|
* _and_ TypeScript source files.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import eslintJs from "@eslint/js";
|
|
2
2
|
import babelParser from "@babel/eslint-parser";
|
|
3
|
+
import { JS_GLOB, SRC_GLOB, extGlob } from "../shared/env-utils.js";
|
|
3
4
|
// functions ==================================================================
|
|
4
5
|
/**
|
|
5
6
|
* Defines standard module settings and additional rules targeting JavaScript
|
|
@@ -19,7 +20,7 @@ export default function base(options) {
|
|
|
19
20
|
const languageOptions = (sourceType, ...extensions) => {
|
|
20
21
|
const { ecmaVersion } = options;
|
|
21
22
|
return {
|
|
22
|
-
files: extensions
|
|
23
|
+
files: extGlob(extensions),
|
|
23
24
|
languageOptions: { ecmaVersion, sourceType },
|
|
24
25
|
};
|
|
25
26
|
};
|
|
@@ -39,7 +40,7 @@ export default function base(options) {
|
|
|
39
40
|
languageOptions(options.sourceType, "js", "jsx", "ts", "tsx"),
|
|
40
41
|
// ECMA decorators via Babel plugin
|
|
41
42
|
...(options.nativeDecorators ? [{
|
|
42
|
-
files:
|
|
43
|
+
files: JS_GLOB,
|
|
43
44
|
languageOptions: {
|
|
44
45
|
parser: babelParser,
|
|
45
46
|
parserOptions: {
|
|
@@ -56,7 +57,7 @@ export default function base(options) {
|
|
|
56
57
|
}] : []),
|
|
57
58
|
// configure linter rules
|
|
58
59
|
{
|
|
59
|
-
files:
|
|
60
|
+
files: SRC_GLOB,
|
|
60
61
|
rules: {
|
|
61
62
|
// enable all rules recommended by ESLint itself
|
|
62
63
|
...eslintJs.configs.recommended.rules,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commentsPluginConfigs from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
2
|
+
import { SRC_GLOB } from "../shared/env-utils.js";
|
|
2
3
|
// functions ==================================================================
|
|
3
4
|
/**
|
|
4
5
|
* Checks inline linter directives.
|
|
@@ -10,8 +11,9 @@ import commentsPluginConfigs from "@eslint-community/eslint-plugin-eslint-commen
|
|
|
10
11
|
* An array of configuration objects to be added to the flat configuration.
|
|
11
12
|
*/
|
|
12
13
|
export default function directives() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// register rule implementations and recommended rules
|
|
15
|
+
return [{
|
|
16
|
+
files: SRC_GLOB,
|
|
17
|
+
...commentsPluginConfigs.recommended,
|
|
18
|
+
}];
|
|
17
19
|
}
|
package/dist/eslint/config/js.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
1
|
+
import { JS_GLOB, NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
2
2
|
// functions ==================================================================
|
|
3
3
|
/**
|
|
4
4
|
* Defines additional standard rules targeting JavaScript but _not_ TypeScript
|
|
@@ -9,7 +9,7 @@ import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export default function js() {
|
|
11
11
|
return [{
|
|
12
|
-
files:
|
|
12
|
+
files: JS_GLOB,
|
|
13
13
|
rules: {
|
|
14
14
|
// possible problems
|
|
15
15
|
"no-duplicate-imports": "error",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import jsdocPlugin from "eslint-plugin-jsdoc";
|
|
2
|
+
import { TS_GLOB, SRC_GLOB } from "../shared/env-utils.js";
|
|
2
3
|
// functions ==================================================================
|
|
3
4
|
/**
|
|
4
5
|
* Checks the JSDoc comments in source files.
|
|
@@ -12,7 +13,10 @@ import jsdocPlugin from "eslint-plugin-jsdoc";
|
|
|
12
13
|
export default function jsdoc() {
|
|
13
14
|
return [
|
|
14
15
|
// register rule implementations and recommended rules
|
|
15
|
-
|
|
16
|
+
{
|
|
17
|
+
files: SRC_GLOB,
|
|
18
|
+
...jsdocPlugin.configs["flat/recommended-error"],
|
|
19
|
+
},
|
|
16
20
|
// general configuration
|
|
17
21
|
{
|
|
18
22
|
settings: {
|
|
@@ -31,7 +35,7 @@ export default function jsdoc() {
|
|
|
31
35
|
},
|
|
32
36
|
// overrides for TypeScript files
|
|
33
37
|
{
|
|
34
|
-
files:
|
|
38
|
+
files: TS_GLOB,
|
|
35
39
|
rules: {
|
|
36
40
|
...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
|
|
37
41
|
"jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
|
|
@@ -39,6 +43,7 @@ export default function jsdoc() {
|
|
|
39
43
|
},
|
|
40
44
|
// configure plugin rules
|
|
41
45
|
{
|
|
46
|
+
files: SRC_GLOB,
|
|
42
47
|
rules: {
|
|
43
48
|
"jsdoc/check-template-names": "error",
|
|
44
49
|
"jsdoc/require-asterisk-prefix": "error",
|
|
@@ -13,7 +13,7 @@ import jsonPlugin from "eslint-plugin-jsonc";
|
|
|
13
13
|
* An array of configuration objects to be added to the flat configuration.
|
|
14
14
|
*/
|
|
15
15
|
export default function json(options) {
|
|
16
|
-
|
|
16
|
+
const configs = [
|
|
17
17
|
// register rule implementations and recommended rules
|
|
18
18
|
...jsonPlugin.configs["flat/recommended-with-json"],
|
|
19
19
|
// reconfigure plugin rules
|
|
@@ -28,4 +28,7 @@ export default function json(options) {
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
];
|
|
31
|
+
// add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
|
|
32
|
+
const files = configs.find(config => config.files)?.files;
|
|
33
|
+
return configs.map(config => (!config.files && config.rules) ? { ...config, files } : config);
|
|
31
34
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import licensePlugin from "eslint-plugin-license-header";
|
|
2
|
+
import { SRC_GLOB } from "../shared/env-utils.js";
|
|
2
3
|
// functions ==================================================================
|
|
3
4
|
/**
|
|
4
5
|
* Checks the existence of license headers in source files.
|
|
@@ -14,7 +15,7 @@ import licensePlugin from "eslint-plugin-license-header";
|
|
|
14
15
|
*/
|
|
15
16
|
export default function license(path) {
|
|
16
17
|
return [{
|
|
17
|
-
files:
|
|
18
|
+
files: SRC_GLOB,
|
|
18
19
|
// register rule implementations of the plugin
|
|
19
20
|
plugins: {
|
|
20
21
|
"license-header": licensePlugin,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
/**
|
|
3
|
+
* Defines standard linting rules for Markdown files.
|
|
4
|
+
*
|
|
5
|
+
* Wraps the following packages:
|
|
6
|
+
* - `@eslint/markdown`
|
|
7
|
+
*
|
|
8
|
+
* @returns
|
|
9
|
+
* An array of configuration objects to be added to the flat configuration.
|
|
10
|
+
*/
|
|
11
|
+
export default function markdown(): TSESLint.FlatConfig.ConfigArray;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import markdownPlugin from "@eslint/markdown";
|
|
2
|
+
// functions ==================================================================
|
|
3
|
+
/**
|
|
4
|
+
* Defines standard linting rules for Markdown files.
|
|
5
|
+
*
|
|
6
|
+
* Wraps the following packages:
|
|
7
|
+
* - `@eslint/markdown`
|
|
8
|
+
*
|
|
9
|
+
* @returns
|
|
10
|
+
* An array of configuration objects to be added to the flat configuration.
|
|
11
|
+
*/
|
|
12
|
+
export default function markdown() {
|
|
13
|
+
return markdownPlugin.configs.recommended;
|
|
14
|
+
}
|
|
@@ -22,6 +22,8 @@ export default function stylistic(options) {
|
|
|
22
22
|
stylisticPlugin.configs["disable-legacy"],
|
|
23
23
|
// "@stylistic" plugin
|
|
24
24
|
{
|
|
25
|
+
// do not lint markdown files
|
|
26
|
+
ignores: ["**/*.md"],
|
|
25
27
|
// register rule implementations of the plugins
|
|
26
28
|
plugins: {
|
|
27
29
|
"@stylistic": stylisticPlugin,
|
package/dist/eslint/config/ts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import typescriptEslint from "typescript-eslint";
|
|
2
|
-
import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
2
|
+
import { TS_GLOB, DTS_GLOB, NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
3
3
|
// functions ==================================================================
|
|
4
4
|
/**
|
|
5
5
|
* Defines standard rules for TypeScript source files.
|
|
@@ -13,7 +13,7 @@ import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
|
|
|
13
13
|
export default function ts() {
|
|
14
14
|
// plugin configuration, additional rules
|
|
15
15
|
return typescriptEslint.config({
|
|
16
|
-
files:
|
|
16
|
+
files: TS_GLOB,
|
|
17
17
|
// suppress warning for new TypeScript versions
|
|
18
18
|
languageOptions: {
|
|
19
19
|
parserOptions: {
|
|
@@ -40,6 +40,7 @@ export default function ts() {
|
|
|
40
40
|
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
|
|
41
41
|
}],
|
|
42
42
|
"@typescript-eslint/no-array-constructor": "error",
|
|
43
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
43
44
|
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
|
44
45
|
"@typescript-eslint/no-empty-function": ["error", {
|
|
45
46
|
allow: ["private-constructors", "protected-constructors", "decoratedFunctions", "overrideMethods"],
|
|
@@ -68,7 +69,7 @@ export default function ts() {
|
|
|
68
69
|
},
|
|
69
70
|
// fixes for module definition files
|
|
70
71
|
{
|
|
71
|
-
files:
|
|
72
|
+
files: DTS_GLOB,
|
|
72
73
|
rules: {
|
|
73
74
|
"@typescript-eslint/consistent-type-exports": "off",
|
|
74
75
|
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "no-type-imports", disallowTypeAnnotations: false }],
|
|
@@ -13,7 +13,7 @@ import yamlPlugin from "eslint-plugin-yml";
|
|
|
13
13
|
* An array of configuration objects to be added to the flat configuration.
|
|
14
14
|
*/
|
|
15
15
|
export default function yaml(options) {
|
|
16
|
-
|
|
16
|
+
const configs = [
|
|
17
17
|
// register rule implementations and recommended rules
|
|
18
18
|
...yamlPlugin.configs["flat/recommended"],
|
|
19
19
|
// reconfigure plugin rules
|
|
@@ -25,4 +25,7 @@ export default function yaml(options) {
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
];
|
|
28
|
+
// add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
|
|
29
|
+
const files = configs.find(config => config.files)?.files;
|
|
30
|
+
return configs.map(config => (!config.files && config.rules) ? { ...config, files } : config);
|
|
28
31
|
}
|
package/dist/eslint/env/react.js
CHANGED
|
@@ -5,6 +5,7 @@ import reactRefreshPlugin from "eslint-plugin-react-refresh";
|
|
|
5
5
|
import jsxExpressionsPlugin from "eslint-plugin-jsx-expressions";
|
|
6
6
|
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
7
7
|
import { fixupPluginRules } from "@eslint/compat";
|
|
8
|
+
import { JS_GLOB } from "../shared/env-utils.js";
|
|
8
9
|
import { concatConfigs, createConfig, customRules } from "../shared/env-utils.js";
|
|
9
10
|
// functions ==================================================================
|
|
10
11
|
/**
|
|
@@ -69,7 +70,7 @@ export default function react(envOptions) {
|
|
|
69
70
|
}),
|
|
70
71
|
// additional rules for TSX only
|
|
71
72
|
createConfig(envOptions, {
|
|
72
|
-
ignores:
|
|
73
|
+
ignores: JS_GLOB,
|
|
73
74
|
rules: {
|
|
74
75
|
// replace "react/jsx-no-leaked-render" rule with advanced alternative
|
|
75
76
|
"jsx-expressions/strict-logical-expressions": "error",
|
package/dist/eslint/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import js from "./config/js.js";
|
|
|
3
3
|
import ts from "./config/ts.js";
|
|
4
4
|
import json from "./config/json.js";
|
|
5
5
|
import yaml from "./config/yaml.js";
|
|
6
|
+
import markdown from "./config/markdown.js";
|
|
6
7
|
import license from "./config/license.js";
|
|
7
8
|
import directives from "./config/directives.js";
|
|
8
9
|
import imports from "./config/imports.js";
|
|
@@ -81,6 +82,8 @@ export function configure(options) {
|
|
|
81
82
|
...json(stylisticOptions),
|
|
82
83
|
// default configuration for YAML files
|
|
83
84
|
...yaml(stylisticOptions),
|
|
85
|
+
// default configuration for Markdown files
|
|
86
|
+
...markdown(),
|
|
84
87
|
// check for correct license headers
|
|
85
88
|
...(options?.license ? license(options.license) : []),
|
|
86
89
|
// default configuration for ESLint inline directives
|
|
@@ -84,6 +84,34 @@ export interface EnvBaseOptions extends EnvFilesOptions {
|
|
|
84
84
|
*/
|
|
85
85
|
rules?: TSESLint.FlatConfig.Rules;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* File extensions for JavaScript source files.
|
|
89
|
+
*/
|
|
90
|
+
export declare const JS_EXTENSIONS: string[];
|
|
91
|
+
/**
|
|
92
|
+
* File extensions for TypeScript source files.
|
|
93
|
+
*/
|
|
94
|
+
export declare const TS_EXTENSIONS: string[];
|
|
95
|
+
/**
|
|
96
|
+
* File extensions for all source files (JavaScript and TypeScript).
|
|
97
|
+
*/
|
|
98
|
+
export declare const SRC_EXTENSIONS: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Glob array for JavaScript source files.
|
|
101
|
+
*/
|
|
102
|
+
export declare const JS_GLOB: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Glob array for TypeScript source files.
|
|
105
|
+
*/
|
|
106
|
+
export declare const TS_GLOB: string[];
|
|
107
|
+
/**
|
|
108
|
+
* Glob array for TypeScript type declaration files.
|
|
109
|
+
*/
|
|
110
|
+
export declare const DTS_GLOB: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Glob array for all source files (JavaScript and TypeScript).
|
|
113
|
+
*/
|
|
114
|
+
export declare const SRC_GLOB: string[];
|
|
87
115
|
/**
|
|
88
116
|
* Shared options for the core rule `no-unused-vars`, and the plugin rule
|
|
89
117
|
* `@typescript-eslint/no-unused-vars`.
|
|
@@ -95,6 +123,17 @@ export declare const NO_UNUSED_VARS_OPTIONS: {
|
|
|
95
123
|
caughtErrors: string;
|
|
96
124
|
ignoreRestSiblings: boolean;
|
|
97
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* Creates a glob pattern deeply matching all files with the specified file
|
|
128
|
+
* extensions.
|
|
129
|
+
*
|
|
130
|
+
* @param extensions
|
|
131
|
+
* The file extensions to be converted to a glob pattern.
|
|
132
|
+
*
|
|
133
|
+
* @returns
|
|
134
|
+
* The glob pattern for the specified file extensions.
|
|
135
|
+
*/
|
|
136
|
+
export declare function extGlob(extensions: string[]): string[];
|
|
98
137
|
/**
|
|
99
138
|
* Concatenates and flattens multiple elements or arrays into a single array
|
|
100
139
|
* while skipping all falsy parameters.
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
// constants ==================================================================
|
|
2
|
+
/**
|
|
3
|
+
* File extensions for JavaScript source files.
|
|
4
|
+
*/
|
|
5
|
+
export const JS_EXTENSIONS = ["js", "jsx", "mjs", "cjs"];
|
|
6
|
+
/**
|
|
7
|
+
* File extensions for TypeScript source files.
|
|
8
|
+
*/
|
|
9
|
+
export const TS_EXTENSIONS = ["ts", "tsx", "mts", "cts"];
|
|
10
|
+
/**
|
|
11
|
+
* File extensions for all source files (JavaScript and TypeScript).
|
|
12
|
+
*/
|
|
13
|
+
export const SRC_EXTENSIONS = [...JS_EXTENSIONS, ...TS_EXTENSIONS];
|
|
14
|
+
/**
|
|
15
|
+
* Glob array for JavaScript source files.
|
|
16
|
+
*/
|
|
17
|
+
export const JS_GLOB = extGlob(JS_EXTENSIONS);
|
|
18
|
+
/**
|
|
19
|
+
* Glob array for TypeScript source files.
|
|
20
|
+
*/
|
|
21
|
+
export const TS_GLOB = extGlob(TS_EXTENSIONS);
|
|
22
|
+
/**
|
|
23
|
+
* Glob array for TypeScript type declaration files.
|
|
24
|
+
*/
|
|
25
|
+
export const DTS_GLOB = extGlob(TS_EXTENSIONS.map(ext => "d." + ext));
|
|
26
|
+
/**
|
|
27
|
+
* Glob array for all source files (JavaScript and TypeScript).
|
|
28
|
+
*/
|
|
29
|
+
export const SRC_GLOB = extGlob(SRC_EXTENSIONS);
|
|
2
30
|
/**
|
|
3
31
|
* Shared options for the core rule `no-unused-vars`, and the plugin rule
|
|
4
32
|
* `@typescript-eslint/no-unused-vars`.
|
|
@@ -11,6 +39,19 @@ export const NO_UNUSED_VARS_OPTIONS = {
|
|
|
11
39
|
ignoreRestSiblings: true,
|
|
12
40
|
};
|
|
13
41
|
// functions ==================================================================
|
|
42
|
+
/**
|
|
43
|
+
* Creates a glob pattern deeply matching all files with the specified file
|
|
44
|
+
* extensions.
|
|
45
|
+
*
|
|
46
|
+
* @param extensions
|
|
47
|
+
* The file extensions to be converted to a glob pattern.
|
|
48
|
+
*
|
|
49
|
+
* @returns
|
|
50
|
+
* The glob pattern for the specified file extensions.
|
|
51
|
+
*/
|
|
52
|
+
export function extGlob(extensions) {
|
|
53
|
+
return extensions.map(ext => "**/*." + ext);
|
|
54
|
+
}
|
|
14
55
|
/**
|
|
15
56
|
* Concatenates and flattens multiple elements or arrays into a single array
|
|
16
57
|
* while skipping all falsy parameters.
|
package/doc/eslint/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Generates standard configuration targeting the source files in the entire projec
|
|
|
15
15
|
| TypeScript files with type-aware rules (including `.tsx`) | [typescript-eslint](https://typescript-eslint.io/) |
|
|
16
16
|
| JSON files | [eslint-plugin-jsonc](https://ota-meshi.github.io/eslint-plugin-jsonc/) |
|
|
17
17
|
| YAML files | [eslint-plugin-yml](https://ota-meshi.github.io/eslint-plugin-yml/) |
|
|
18
|
+
| Markdown files | [@eslint/markdown](https://github.com/eslint/markdown) |
|
|
18
19
|
| License headers | [eslint-plugin-license-header](https://github.com/nikku/eslint-plugin-license-header) |
|
|
19
20
|
| ESLint inline directives | [@eslint-community/eslint-plugin-eslint-comments](https://github.com/eslint-community/eslint-plugin-eslint-comments) |
|
|
20
21
|
| Module imports | [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) |
|
package/package.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@open-xchange/linter-presets",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://gitlab.open-xchange.com/fspd/commons/plugins/-/tree/main/packages/linter-presets"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
12
|
+
},
|
|
13
|
+
"packageManager": "yarn@4.4.1",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": "./dist/index.js",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"prepare": "yarn build",
|
|
18
|
+
"prepack": "yarn build && yarn lint && yarn test",
|
|
19
|
+
"build": "rimraf dist && tsc",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"test": "cd test && eslint ."
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@babel/core": "7.25.2",
|
|
25
|
+
"@babel/eslint-parser": "7.25.1",
|
|
26
|
+
"@babel/plugin-proposal-decorators": "7.24.7",
|
|
27
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.4.0",
|
|
28
|
+
"@eslint/compat": "1.1.1",
|
|
29
|
+
"@eslint/js": "9.9.1",
|
|
30
|
+
"@eslint/markdown": "6.0.0",
|
|
31
|
+
"@stylistic/eslint-plugin": "2.3.0",
|
|
32
|
+
"@stylistic/eslint-plugin-migrate": "2.3.0",
|
|
33
|
+
"@stylistic/stylelint-config": "2.0.0",
|
|
34
|
+
"@stylistic/stylelint-plugin": "3.0.1",
|
|
35
|
+
"confusing-browser-globals": "1.0.11",
|
|
36
|
+
"eslint-plugin-chai-expect": "3.1.0",
|
|
37
|
+
"eslint-plugin-codeceptjs": "1.3.0",
|
|
38
|
+
"eslint-plugin-eslint-plugin": "6.2.0",
|
|
39
|
+
"eslint-plugin-import": "2.29.1",
|
|
40
|
+
"eslint-plugin-jest": "28.8.0",
|
|
41
|
+
"eslint-plugin-jest-dom": "5.4.0",
|
|
42
|
+
"eslint-plugin-jsdoc": "50.2.2",
|
|
43
|
+
"eslint-plugin-jsonc": "2.16.0",
|
|
44
|
+
"eslint-plugin-jsx-a11y": "6.9.0",
|
|
45
|
+
"eslint-plugin-jsx-expressions": "1.3.2",
|
|
46
|
+
"eslint-plugin-license-header": "0.6.1",
|
|
47
|
+
"eslint-plugin-n": "17.10.2",
|
|
48
|
+
"eslint-plugin-promise": "7.1.0",
|
|
49
|
+
"eslint-plugin-react": "7.35.0",
|
|
50
|
+
"eslint-plugin-react-hooks": "4.6.2",
|
|
51
|
+
"eslint-plugin-react-hooks-static-deps": "1.0.7",
|
|
52
|
+
"eslint-plugin-react-refresh": "0.4.11",
|
|
53
|
+
"eslint-plugin-testing-library": "6.3.0",
|
|
54
|
+
"eslint-plugin-vitest": "0.5.4",
|
|
55
|
+
"eslint-plugin-yml": "1.14.0",
|
|
56
|
+
"find-up": "7.0.0",
|
|
57
|
+
"globals": "15.9.0",
|
|
58
|
+
"picomatch": "4.0.2",
|
|
59
|
+
"stylelint-config-standard": "36.0.1",
|
|
60
|
+
"stylelint-config-standard-less": "3.0.1",
|
|
61
|
+
"stylelint-config-standard-scss": "13.1.0",
|
|
62
|
+
"stylelint-plugin-license-header": "1.0.3",
|
|
63
|
+
"typescript-eslint": "8.3.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@eslint/core": "0.4.0",
|
|
67
|
+
"@types/confusing-browser-globals": "1.0.3",
|
|
68
|
+
"@types/eslint__js": "8.42.3",
|
|
69
|
+
"@types/picomatch": "3.0.1",
|
|
70
|
+
"@typescript-eslint/utils": "8.3.0",
|
|
71
|
+
"eslint": "9.9.1",
|
|
72
|
+
"jest": "29.7.0",
|
|
73
|
+
"rimraf": "6.0.1",
|
|
74
|
+
"stylelint": "16.8.2",
|
|
75
|
+
"typescript": "5.5.4"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"eslint": "^9.8",
|
|
79
|
+
"jest": "^29.7",
|
|
80
|
+
"stylelint": "^16.8",
|
|
81
|
+
"typescript": "^5.5",
|
|
82
|
+
"vitest": "^2.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependenciesMeta": {
|
|
85
|
+
"eslint": {
|
|
86
|
+
"optional": true
|
|
7
87
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
88
|
+
"jest": {
|
|
89
|
+
"optional": true
|
|
11
90
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"exports": "./dist/index.js",
|
|
15
|
-
"scripts": {
|
|
16
|
-
"prepare": "husky",
|
|
17
|
-
"prepack": "yarn build && yarn lint && yarn test",
|
|
18
|
-
"build": "npx --yes rimraf dist && tsc",
|
|
19
|
-
"lint": "eslint .",
|
|
20
|
-
"test": "cd test && eslint ."
|
|
91
|
+
"stylelint": {
|
|
92
|
+
"optional": true
|
|
21
93
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
94
|
+
"typescript": {
|
|
95
|
+
"optional": true
|
|
24
96
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"@babel/eslint-parser": "7.25.1",
|
|
28
|
-
"@babel/plugin-proposal-decorators": "7.24.7",
|
|
29
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.4.0",
|
|
30
|
-
"@eslint/compat": "1.1.1",
|
|
31
|
-
"@eslint/js": "9.9.0",
|
|
32
|
-
"@stylistic/eslint-plugin": "2.3.0",
|
|
33
|
-
"@stylistic/eslint-plugin-migrate": "2.3.0",
|
|
34
|
-
"@stylistic/stylelint-config": "2.0.0",
|
|
35
|
-
"@stylistic/stylelint-plugin": "3.0.1",
|
|
36
|
-
"confusing-browser-globals": "1.0.11",
|
|
37
|
-
"eslint-plugin-chai-expect": "3.1.0",
|
|
38
|
-
"eslint-plugin-codeceptjs": "1.3.0",
|
|
39
|
-
"eslint-plugin-eslint-plugin": "6.2.0",
|
|
40
|
-
"eslint-plugin-import": "2.29.1",
|
|
41
|
-
"eslint-plugin-jest": "28.8.0",
|
|
42
|
-
"eslint-plugin-jest-dom": "5.4.0",
|
|
43
|
-
"eslint-plugin-jsdoc": "50.2.2",
|
|
44
|
-
"eslint-plugin-jsonc": "2.16.0",
|
|
45
|
-
"eslint-plugin-jsx-a11y": "6.9.0",
|
|
46
|
-
"eslint-plugin-jsx-expressions": "1.3.2",
|
|
47
|
-
"eslint-plugin-license-header": "0.6.1",
|
|
48
|
-
"eslint-plugin-n": "17.10.2",
|
|
49
|
-
"eslint-plugin-promise": "7.1.0",
|
|
50
|
-
"eslint-plugin-react": "7.35.0",
|
|
51
|
-
"eslint-plugin-react-hooks": "4.6.2",
|
|
52
|
-
"eslint-plugin-react-hooks-static-deps": "1.0.7",
|
|
53
|
-
"eslint-plugin-react-refresh": "0.4.10",
|
|
54
|
-
"eslint-plugin-testing-library": "6.3.0",
|
|
55
|
-
"eslint-plugin-vitest": "0.5.4",
|
|
56
|
-
"eslint-plugin-yml": "1.14.0",
|
|
57
|
-
"find-up": "7.0.0",
|
|
58
|
-
"globals": "15.9.0",
|
|
59
|
-
"picomatch": "4.0.2",
|
|
60
|
-
"stylelint-config-standard": "36.0.1",
|
|
61
|
-
"stylelint-config-standard-less": "3.0.1",
|
|
62
|
-
"stylelint-config-standard-scss": "13.1.0",
|
|
63
|
-
"stylelint-plugin-license-header": "1.0.3",
|
|
64
|
-
"typescript-eslint": "8.2.0"
|
|
65
|
-
},
|
|
66
|
-
"devDependencies": {
|
|
67
|
-
"@types/confusing-browser-globals": "1.0.3",
|
|
68
|
-
"@types/eslint__js": "8.42.3",
|
|
69
|
-
"@types/picomatch": "3.0.1",
|
|
70
|
-
"@typescript-eslint/utils": "8.2.0",
|
|
71
|
-
"eslint": "9.9.0",
|
|
72
|
-
"husky": "9.1.5",
|
|
73
|
-
"jest": "29.7.0",
|
|
74
|
-
"stylelint": "16.8.2",
|
|
75
|
-
"typescript": "5.5.4"
|
|
76
|
-
},
|
|
77
|
-
"peerDependencies": {
|
|
78
|
-
"eslint": "^9.8",
|
|
79
|
-
"jest": "^29.7",
|
|
80
|
-
"stylelint": "^16.8",
|
|
81
|
-
"typescript": "^5.5",
|
|
82
|
-
"vitest": "^2.0"
|
|
83
|
-
},
|
|
84
|
-
"peerDependenciesMeta": {
|
|
85
|
-
"eslint": {
|
|
86
|
-
"optional": true
|
|
87
|
-
},
|
|
88
|
-
"jest": {
|
|
89
|
-
"optional": true
|
|
90
|
-
},
|
|
91
|
-
"stylelint": {
|
|
92
|
-
"optional": true
|
|
93
|
-
},
|
|
94
|
-
"typescript": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
97
|
-
"vitest": {
|
|
98
|
-
"optional": true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"resolutions": {
|
|
102
|
-
"semver": "^7.6.2"
|
|
97
|
+
"vitest": {
|
|
98
|
+
"optional": true
|
|
103
99
|
}
|
|
104
|
-
}
|
|
100
|
+
},
|
|
101
|
+
"resolutions": {
|
|
102
|
+
"semver": "^7.6.2"
|
|
103
|
+
}
|
|
104
|
+
}
|
package/.vscode/settings.json
DELETED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 OX Software GmbH, Germany <info@open-xchange.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|