@open-xchange/linter-presets 0.5.1 → 0.6.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 +73 -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 +3 -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 +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,152 +1,156 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## `0.6.0` – 2024-Aug-26
|
|
4
|
+
|
|
5
|
+
- added: (ESLint) plugin `@eslint/markdown`
|
|
6
|
+
|
|
7
|
+
## `0.5.1` – 2024-Aug-22
|
|
4
8
|
|
|
5
9
|
- chore: bump dependencies
|
|
6
10
|
|
|
7
|
-
##
|
|
11
|
+
## `0.5.0` – 2024-Aug-15
|
|
8
12
|
|
|
9
|
-
- added:
|
|
10
|
-
- added:
|
|
11
|
-
- added:
|
|
13
|
+
- added: (ESLint) option `testingLib` for environment `env.vitest`
|
|
14
|
+
- added: (ESLint) plugins `testing-library`, `jest-dom`, and option `testingLib` for environment `env.jest`
|
|
15
|
+
- added: (ESLint) option `jestDom` for environments `env.jest` and `env.vitest`
|
|
12
16
|
- chore: bump dependencies
|
|
13
17
|
|
|
14
|
-
##
|
|
18
|
+
## `0.4.3` – 2024-Aug-08
|
|
15
19
|
|
|
16
20
|
- chore: bump dependencies
|
|
17
21
|
|
|
18
|
-
##
|
|
22
|
+
## `0.4.2` – 2024-Aug-06
|
|
19
23
|
|
|
20
|
-
- added:
|
|
24
|
+
- added: (ESLint) rules `jsdoc/check-template-names`, `jsdoc/require-asterisk-prefix`
|
|
21
25
|
|
|
22
|
-
##
|
|
26
|
+
## `0.4.1` – 2024-Aug-06
|
|
23
27
|
|
|
24
|
-
- added:
|
|
28
|
+
- added: (StyleLint) default ignore globs (`dist`)
|
|
25
29
|
|
|
26
|
-
##
|
|
30
|
+
## `0.4.0` – 2024-Aug-06
|
|
27
31
|
|
|
28
|
-
- added:
|
|
29
|
-
- changed:
|
|
32
|
+
- added: (ESLint) rules `jsdoc/require-template`, `jsdoc/require-throws`
|
|
33
|
+
- changed: (StyleLint) default values of `stylistic` option (indent 4 spaces, double quotes)
|
|
30
34
|
|
|
31
|
-
##
|
|
35
|
+
## `0.3.3` – 2024-Aug-01
|
|
32
36
|
|
|
33
|
-
- fixed:
|
|
37
|
+
- fixed: (ESLint) `env.tsconfig` must disable "projectService" explicitly
|
|
34
38
|
|
|
35
|
-
##
|
|
39
|
+
## `0.3.2` – 2024-Aug-01
|
|
36
40
|
|
|
37
|
-
- added:
|
|
41
|
+
- added: (ESLint) restore environment `env.tsconfig` to workaround VSCode issues
|
|
38
42
|
|
|
39
|
-
##
|
|
43
|
+
## `0.3.1` – 2024-Aug-01
|
|
40
44
|
|
|
41
|
-
- added:
|
|
42
|
-
- changed:
|
|
45
|
+
- added: (ESLint) default ignore globs (`dist`, `gitlab-ci`, and others)
|
|
46
|
+
- changed: (ESLint) default values of `stylistic` option (indent 4 spaces, always semicolons, double quotes)
|
|
43
47
|
|
|
44
|
-
##
|
|
48
|
+
## `0.3.0` – 2024-Aug-01
|
|
45
49
|
|
|
46
|
-
- chore:
|
|
47
|
-
- removed:
|
|
48
|
-
- changed:
|
|
50
|
+
- chore: (ESLint) [major bump of `typescript-eslint` to v8](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/)
|
|
51
|
+
- removed: (ESLint) environment `env.tsconfig` (always using `projectService` of `typescript-eslint` instead)
|
|
52
|
+
- changed: (ESLint) pattern for unused variables is now `^_.` (instead `^_`) to detect dangling underscore imports
|
|
49
53
|
|
|
50
|
-
##
|
|
54
|
+
## `0.2.0` – 2024-Jul-31
|
|
51
55
|
|
|
52
56
|
- chore: bump dependencies
|
|
53
57
|
- chore: bump peer dependencies (eslint `^9.8` and stylelint `^16.8`)
|
|
54
58
|
|
|
55
|
-
##
|
|
59
|
+
## `0.1.13` – 2024-Jul-31
|
|
56
60
|
|
|
57
61
|
- change: disable rule `no-console` in environment `env.node`
|
|
58
62
|
- chore: add renovate bot
|
|
59
63
|
- chore: bump dependencies
|
|
60
64
|
|
|
61
|
-
##
|
|
65
|
+
## `0.1.12` – 2024-Jul-30
|
|
62
66
|
|
|
63
67
|
- chore: bump `eslint-plugin-jsdoc` dependency
|
|
64
68
|
|
|
65
|
-
##
|
|
69
|
+
## `0.1.11` – 2024-Jul-30
|
|
66
70
|
|
|
67
71
|
- chore: bump dependencies
|
|
68
72
|
- skipped eslint-plugin-jsdoc: <https://github.com/gajus/eslint-plugin-jsdoc/issues/1282>
|
|
69
73
|
- skipped @stylistic/eslint-plugin: <https://github.com/typescript-eslint/typescript-eslint/issues/9655>
|
|
70
74
|
|
|
71
|
-
##
|
|
75
|
+
## `0.1.10` – 2024-Jul-26
|
|
72
76
|
|
|
73
77
|
- chore: bump dependencies
|
|
74
78
|
- chore: remove old license headers
|
|
75
79
|
|
|
76
|
-
##
|
|
80
|
+
## `0.1.9` – 2024-Jul-26
|
|
77
81
|
|
|
78
|
-
- added:
|
|
82
|
+
- added: (ESLint) `env.node`: option `settings` with shared settings for `eslint-plugin-n`
|
|
79
83
|
- chore: bump dependencies
|
|
80
84
|
|
|
81
|
-
##
|
|
85
|
+
## `0.1.8` – 2024-Jul-23
|
|
82
86
|
|
|
83
|
-
- fixed:
|
|
87
|
+
- fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
|
|
84
88
|
|
|
85
|
-
##
|
|
89
|
+
## `0.1.7` – 2024-Jul-23
|
|
86
90
|
|
|
87
|
-
- changed:
|
|
88
|
-
- changed:
|
|
89
|
-
- chore:
|
|
91
|
+
- changed: (ESLint) reverted option `modules` for `env.project` (introduced in 0.1.6)
|
|
92
|
+
- changed: (ESLint) `env.project`: renamed option `packages` to `hierarchy`
|
|
93
|
+
- chore: (ESLint) split rule `env-project/no-invalid-modules` (added `env-project/no-invalid-hierarchy`)
|
|
90
94
|
|
|
91
|
-
##
|
|
95
|
+
## `0.1.6` – 2024-Jul-23
|
|
92
96
|
|
|
93
|
-
- changed:
|
|
94
|
-
- chore:
|
|
97
|
+
- changed: (ESLint) moved rule options for `env.project` into own `modules` option
|
|
98
|
+
- chore: (ESLint) unit test for `env.project`
|
|
95
99
|
|
|
96
|
-
##
|
|
100
|
+
## `0.1.5` – 2024-Jul-23
|
|
97
101
|
|
|
98
102
|
- chore: bump dependencies
|
|
99
103
|
|
|
100
|
-
##
|
|
104
|
+
## `0.1.4` – 2024-Jul-15
|
|
101
105
|
|
|
102
|
-
- added:
|
|
106
|
+
- added: (ESLint) option `language.nativeDecorators` to support native ES decorators in JS files
|
|
103
107
|
|
|
104
|
-
##
|
|
108
|
+
## `0.1.3` – 2024-Jul-15
|
|
105
109
|
|
|
106
110
|
- chore: bump dependencies
|
|
107
111
|
|
|
108
|
-
##
|
|
112
|
+
## `0.1.2` – 2024-Jul-12
|
|
109
113
|
|
|
110
|
-
- added:
|
|
114
|
+
- added: (ESLint) option `restricted.nativeDecorators`
|
|
111
115
|
|
|
112
|
-
##
|
|
116
|
+
## `0.1.1` – 2024-Jul-11
|
|
113
117
|
|
|
114
|
-
- changed:
|
|
118
|
+
- changed: (ESLint) option `stylistic.semi` as enum (always/never/off)
|
|
115
119
|
|
|
116
|
-
##
|
|
120
|
+
## `0.1.0` – 2024-Jul-10
|
|
117
121
|
|
|
118
122
|
- chore: converted source code to TypeScript
|
|
119
123
|
|
|
120
|
-
##
|
|
124
|
+
## `0.0.6` – 2024-Jul-10
|
|
121
125
|
|
|
122
|
-
- fixed:
|
|
126
|
+
- fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
|
|
123
127
|
|
|
124
|
-
##
|
|
128
|
+
## `0.0.5` – 2024-Jul-10
|
|
125
129
|
|
|
126
|
-
- changed:
|
|
127
|
-
- chore:
|
|
130
|
+
- changed: (ESLint) `env-project/no-invalid-modules`: renamed option `packages.dependsOn` to `packages.extends`
|
|
131
|
+
- chore: (ESLint) documentation for option `restricted`
|
|
128
132
|
- chore: bump dependencies
|
|
129
133
|
|
|
130
|
-
##
|
|
134
|
+
## `0.0.4` – 2024-Jul-10
|
|
131
135
|
|
|
132
|
-
- fixed:
|
|
136
|
+
- fixed: (ESLint) file exists detection in rule `env-project/no-invalid-modules`
|
|
133
137
|
|
|
134
|
-
##
|
|
138
|
+
## `0.0.3` – 2024-Jul-09
|
|
135
139
|
|
|
136
|
-
- added:
|
|
137
|
-
- added:
|
|
138
|
-
- added:
|
|
139
|
-
- added:
|
|
140
|
-
- added:
|
|
141
|
-
- changed:
|
|
142
|
-
- fixed:
|
|
140
|
+
- added: (ESLint) `eslint-plugin-import`
|
|
141
|
+
- added: (ESLint) option "restricted" for `env.node` and `env.browser`
|
|
142
|
+
- added: (ESLint) custom rule `env-project/no-amd-module-directive`
|
|
143
|
+
- added: (ESLint) custom rule `env-project/no-invalid-modules`
|
|
144
|
+
- added: (ESLint) environment `env.project` (wraps all `env-project/*` rules)
|
|
145
|
+
- changed: (ESLint) environment `env.plugin` renamed to `env.eslint`
|
|
146
|
+
- fixed: (StyleLint) support for LESS files
|
|
143
147
|
- chore: bump dependencies
|
|
144
148
|
|
|
145
|
-
##
|
|
149
|
+
## `0.0.2` – 2024-Jul-08
|
|
146
150
|
|
|
147
|
-
- added:
|
|
151
|
+
- added: (StyleLint) project configuration (core, less, sass, license, stylistic)
|
|
148
152
|
|
|
149
|
-
##
|
|
153
|
+
## `0.0.1` – 2024-Jul-05
|
|
150
154
|
|
|
151
|
-
- added:
|
|
152
|
-
- added:
|
|
155
|
+
- added: (ESLint) project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
|
|
156
|
+
- 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: {
|
|
@@ -68,7 +68,7 @@ export default function ts() {
|
|
|
68
68
|
},
|
|
69
69
|
// fixes for module definition files
|
|
70
70
|
{
|
|
71
|
-
files:
|
|
71
|
+
files: DTS_GLOB,
|
|
72
72
|
rules: {
|
|
73
73
|
"@typescript-eslint/consistent-type-exports": "off",
|
|
74
74
|
"@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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/linter-presets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://gitlab.open-xchange.com/fspd/npm-packages/linter-presets"
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@eslint-community/eslint-plugin-eslint-comments": "4.4.0",
|
|
30
30
|
"@eslint/compat": "1.1.1",
|
|
31
31
|
"@eslint/js": "9.9.0",
|
|
32
|
+
"@eslint/markdown": "6.0.0",
|
|
32
33
|
"@stylistic/eslint-plugin": "2.3.0",
|
|
33
34
|
"@stylistic/eslint-plugin-migrate": "2.3.0",
|
|
34
35
|
"@stylistic/stylelint-config": "2.0.0",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"typescript-eslint": "8.2.0"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@eslint/core": "0.4.0",
|
|
67
69
|
"@types/confusing-browser-globals": "1.0.3",
|
|
68
70
|
"@types/eslint__js": "8.42.3",
|
|
69
71
|
"@types/picomatch": "3.0.1",
|