@open-xchange/linter-presets 1.7.0 → 1.7.2
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 +8 -0
- package/dist/eslint/core/base.js +3 -3
- package/dist/eslint/core/directives.js +1 -1
- package/dist/eslint/core/js.js +1 -1
- package/dist/eslint/core/jsdoc.js +4 -4
- package/dist/eslint/core/json.js +6 -3
- package/dist/eslint/core/license.js +1 -1
- package/dist/eslint/core/markdown.d.ts +2 -2
- package/dist/eslint/core/markdown.js +4 -1
- package/dist/eslint/core/packages.js +2 -2
- package/dist/eslint/core/promises.js +2 -2
- package/dist/eslint/core/regexp.js +6 -3
- package/dist/eslint/core/stylistic.js +3 -3
- package/dist/eslint/core/ts.js +2 -2
- package/dist/eslint/core/vue.js +6 -7
- package/dist/eslint/core/yaml.js +5 -2
- package/dist/eslint/env/browser.js +3 -3
- package/dist/eslint/env/codecept.js +3 -3
- package/dist/eslint/env/decorators.js +2 -2
- package/dist/eslint/env/eslint.js +2 -2
- package/dist/eslint/env/jest.js +5 -5
- package/dist/eslint/env/node.js +3 -3
- package/dist/eslint/env/project.js +2 -2
- package/dist/eslint/env/react.js +29 -41
- package/dist/eslint/env/tsconfig.js +2 -2
- package/dist/eslint/env/vitest.js +4 -4
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/shared/env-utils.d.ts +6 -5
- package/dist/eslint/shared/env-utils.js +20 -16
- package/dist/eslint/shared/restricted.js +1 -1
- package/dist/eslint/shared/unittest.js +3 -3
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## `1.7.2` – 2025-Jul-24
|
|
4
|
+
|
|
5
|
+
- chore: bump dependencies
|
|
6
|
+
|
|
7
|
+
## `1.7.1` – 2025-Jul-18
|
|
8
|
+
|
|
9
|
+
- changed: (ESLint) `eslint-plugin-regexp`: raise all warnings in recommended config to errors
|
|
10
|
+
|
|
3
11
|
## `1.7.0` – 2025-Jul-17
|
|
4
12
|
|
|
5
13
|
- added: (ESLint and StyleLint) mandatory option `root`
|
package/dist/eslint/core/base.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function base(languageConfig) {
|
|
|
20
20
|
const languageOptions = (sourceType, ...extensions) => {
|
|
21
21
|
const { ecmaVersion } = languageConfig;
|
|
22
22
|
return {
|
|
23
|
-
name: `base
|
|
23
|
+
name: `core.base.language-options.${sourceType}.${extensions.join(",")}`,
|
|
24
24
|
files: extGlob(extensions),
|
|
25
25
|
languageOptions: { ecmaVersion, sourceType },
|
|
26
26
|
};
|
|
@@ -28,7 +28,7 @@ export default function base(languageConfig) {
|
|
|
28
28
|
return [
|
|
29
29
|
// global linter configuration
|
|
30
30
|
{
|
|
31
|
-
name: "base
|
|
31
|
+
name: "core.base.linter-options",
|
|
32
32
|
linterOptions: {
|
|
33
33
|
// report unused inline linter directives in source code
|
|
34
34
|
reportUnusedDisableDirectives: "error",
|
|
@@ -42,7 +42,7 @@ export default function base(languageConfig) {
|
|
|
42
42
|
languageOptions(languageConfig.sourceType, "js", "jsx", "ts", "tsx"),
|
|
43
43
|
// configure linter rules
|
|
44
44
|
{
|
|
45
|
-
name: "base
|
|
45
|
+
name: "core.base.rules",
|
|
46
46
|
files: [...SRC_GLOB, ...VUE_GLOB],
|
|
47
47
|
rules: {
|
|
48
48
|
// enable all rules recommended by ESLint itself
|
|
@@ -13,8 +13,8 @@ import { SRC_GLOB, VUE_GLOB } from "../shared/env-utils.js";
|
|
|
13
13
|
export default function directives() {
|
|
14
14
|
// register rule implementations and recommended rules
|
|
15
15
|
return {
|
|
16
|
-
name: "directives:recommended",
|
|
17
16
|
files: [...SRC_GLOB, ...VUE_GLOB],
|
|
18
17
|
...commentsPluginConfigs.recommended,
|
|
18
|
+
name: "core.directives.recommended",
|
|
19
19
|
};
|
|
20
20
|
}
|
package/dist/eslint/core/js.js
CHANGED
|
@@ -14,13 +14,13 @@ export default function jsdoc() {
|
|
|
14
14
|
return [
|
|
15
15
|
// register rule implementations and recommended rules
|
|
16
16
|
{
|
|
17
|
-
name: "jsdoc:recommended",
|
|
18
17
|
files: SRC_GLOB,
|
|
19
18
|
...jsdocPlugin.configs["flat/recommended-error"],
|
|
19
|
+
name: "core.jsdoc.recommended",
|
|
20
20
|
},
|
|
21
21
|
// general configuration
|
|
22
22
|
{
|
|
23
|
-
name: "jsdoc
|
|
23
|
+
name: "core.jsdoc.settings",
|
|
24
24
|
settings: {
|
|
25
25
|
jsdoc: {
|
|
26
26
|
tagNamePreference: {
|
|
@@ -37,7 +37,7 @@ export default function jsdoc() {
|
|
|
37
37
|
},
|
|
38
38
|
// overrides for TypeScript files
|
|
39
39
|
{
|
|
40
|
-
name: "jsdoc
|
|
40
|
+
name: "core.jsdoc.typescript",
|
|
41
41
|
files: TS_GLOB,
|
|
42
42
|
rules: {
|
|
43
43
|
...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
|
|
@@ -46,7 +46,7 @@ export default function jsdoc() {
|
|
|
46
46
|
},
|
|
47
47
|
// configure plugin rules
|
|
48
48
|
{
|
|
49
|
-
name: "jsdoc
|
|
49
|
+
name: "core.jsdoc.rules",
|
|
50
50
|
files: SRC_GLOB,
|
|
51
51
|
rules: {
|
|
52
52
|
"jsdoc/check-template-names": "error",
|
package/dist/eslint/core/json.js
CHANGED
|
@@ -17,10 +17,13 @@ export default function json(stylisticConfig) {
|
|
|
17
17
|
// add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
|
|
18
18
|
return fixMissingFilesOption(
|
|
19
19
|
// register rule implementations and recommended rules
|
|
20
|
-
jsonPlugin.configs["flat/recommended-with-json"],
|
|
20
|
+
jsonPlugin.configs["flat/recommended-with-json"].map((config, index) => ({
|
|
21
|
+
...config,
|
|
22
|
+
name: `core.json.recommended-${index}`,
|
|
23
|
+
})),
|
|
21
24
|
// reconfigure plugin rules
|
|
22
25
|
{
|
|
23
|
-
name: "json
|
|
26
|
+
name: "core.json.rules",
|
|
24
27
|
rules: {
|
|
25
28
|
"jsonc/array-bracket-spacing": "error",
|
|
26
29
|
"jsonc/comma-style": "error",
|
|
@@ -30,7 +33,7 @@ export default function json(stylisticConfig) {
|
|
|
30
33
|
"jsonc/no-octal-escape": "error",
|
|
31
34
|
},
|
|
32
35
|
}, {
|
|
33
|
-
name: "json
|
|
36
|
+
name: "core.json.tsconfig",
|
|
34
37
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
35
38
|
rules: {
|
|
36
39
|
"jsonc/no-comments": "off",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConfigWithExtendsArg } from "../shared/env-utils.js";
|
|
2
2
|
/**
|
|
3
3
|
* Defines standard linting rules for Markdown files.
|
|
4
4
|
*
|
|
@@ -8,4 +8,4 @@ import type { Linter } from "eslint";
|
|
|
8
8
|
* @returns
|
|
9
9
|
* The configuration entries to be added to the resulting configuration array.
|
|
10
10
|
*/
|
|
11
|
-
export default function markdown():
|
|
11
|
+
export default function markdown(): ConfigWithExtendsArg;
|
|
@@ -10,5 +10,8 @@ import markdownPlugin from "@eslint/markdown";
|
|
|
10
10
|
* The configuration entries to be added to the resulting configuration array.
|
|
11
11
|
*/
|
|
12
12
|
export default function markdown() {
|
|
13
|
-
return markdownPlugin.configs.recommended
|
|
13
|
+
return markdownPlugin.configs.recommended.map((config, index) => ({
|
|
14
|
+
...config,
|
|
15
|
+
name: `core.markdown.recommended-${index}`,
|
|
16
|
+
}));
|
|
14
17
|
}
|
|
@@ -16,11 +16,11 @@ export default function packages(packagesConfig) {
|
|
|
16
16
|
return [
|
|
17
17
|
// register rule implementations and recommended rules
|
|
18
18
|
{
|
|
19
|
-
name: "packages:recommended",
|
|
20
19
|
...dependPlugin.configs["flat/recommended"],
|
|
20
|
+
name: "core.packages.recommended",
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
name: "packages
|
|
23
|
+
name: "core.packages.rules",
|
|
24
24
|
rules: {
|
|
25
25
|
"depend/ban-dependencies": ["error", {
|
|
26
26
|
modules: packagesConfig.banned,
|
|
@@ -13,12 +13,12 @@ export default function promises() {
|
|
|
13
13
|
return [
|
|
14
14
|
// register rule implementations and recommended rules
|
|
15
15
|
{
|
|
16
|
-
name: "promises:recommended",
|
|
17
16
|
...promisePlugin.configs["flat/recommended"],
|
|
17
|
+
name: "core.promises.recommended",
|
|
18
18
|
},
|
|
19
19
|
// reconfigure plugin rules
|
|
20
20
|
{
|
|
21
|
-
name: "promises
|
|
21
|
+
name: "core.promises.rules",
|
|
22
22
|
rules: {
|
|
23
23
|
"promise/always-return": ["error", { ignoreLastCallback: true }],
|
|
24
24
|
"promise/no-callback-in-promise": "off",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as regexpPlugin from "eslint-plugin-regexp";
|
|
2
|
-
import { SRC_GLOB } from "../shared/env-utils.js";
|
|
2
|
+
import { SRC_GLOB, convertRuleWarningsToErrors } from "../shared/env-utils.js";
|
|
3
3
|
// functions ==================================================================
|
|
4
4
|
/**
|
|
5
5
|
* Checks the regular expressions in source files.
|
|
@@ -11,10 +11,13 @@ import { SRC_GLOB } from "../shared/env-utils.js";
|
|
|
11
11
|
* The configuration entries to be added to the resulting configuration array.
|
|
12
12
|
*/
|
|
13
13
|
export default function regexp() {
|
|
14
|
+
// recommended configuration of the plugin
|
|
15
|
+
const recommendedConfig = regexpPlugin.configs["flat/recommended"];
|
|
14
16
|
// register rule implementations and recommended rules
|
|
15
17
|
return {
|
|
16
|
-
name: "regexp:recommended",
|
|
17
18
|
files: SRC_GLOB,
|
|
18
|
-
|
|
19
|
+
// raise all recommended rules to "error" level
|
|
20
|
+
...convertRuleWarningsToErrors(recommendedConfig),
|
|
21
|
+
name: "core.regexp.recommended",
|
|
19
22
|
};
|
|
20
23
|
}
|
|
@@ -21,12 +21,12 @@ export default function stylistic(stylisticConfig) {
|
|
|
21
21
|
return [
|
|
22
22
|
// globally disable all deprecated stylistic core rules
|
|
23
23
|
{
|
|
24
|
-
name: "stylistic:disable-legacy",
|
|
25
24
|
...stylisticPlugin.configs["disable-legacy"],
|
|
25
|
+
name: "core.stylistic.disable-legacy",
|
|
26
26
|
},
|
|
27
27
|
// "@stylistic" plugin
|
|
28
28
|
{
|
|
29
|
-
name: "stylistic
|
|
29
|
+
name: "core.stylistic.recommended",
|
|
30
30
|
// do not lint markdown files
|
|
31
31
|
ignores: ["**/*.md"],
|
|
32
32
|
// register rule implementations of the plugins
|
|
@@ -105,7 +105,7 @@ export default function stylistic(stylisticConfig) {
|
|
|
105
105
|
},
|
|
106
106
|
// "@stylistic/migrate" plugin
|
|
107
107
|
{
|
|
108
|
-
name: "stylistic
|
|
108
|
+
name: "core.stylistic.migrate",
|
|
109
109
|
// register rule implementations of the plugins
|
|
110
110
|
plugins: {
|
|
111
111
|
"@stylistic/migrate": migratePlugin,
|
package/dist/eslint/core/ts.js
CHANGED
|
@@ -17,7 +17,7 @@ export default function ts(rootDir) {
|
|
|
17
17
|
// plugin configuration, additional rules
|
|
18
18
|
return [
|
|
19
19
|
{
|
|
20
|
-
name: "ts
|
|
20
|
+
name: "core.ts.recommended",
|
|
21
21
|
files: TS_GLOB,
|
|
22
22
|
languageOptions: {
|
|
23
23
|
parserOptions: {
|
|
@@ -79,7 +79,7 @@ export default function ts(rootDir) {
|
|
|
79
79
|
},
|
|
80
80
|
// fixes for module definition files
|
|
81
81
|
{
|
|
82
|
-
name: "ts
|
|
82
|
+
name: "core.ts.dts",
|
|
83
83
|
files: DTS_GLOB,
|
|
84
84
|
rules: {
|
|
85
85
|
"no-duplicate-imports": "off", // triggers for multiple "declare" blocks in a file
|
package/dist/eslint/core/vue.js
CHANGED
|
@@ -25,7 +25,7 @@ export default function vue(languageConfig, stylisticConfig) {
|
|
|
25
25
|
return fixMissingFilesOption(
|
|
26
26
|
// use TypeScript parser for Vue files
|
|
27
27
|
{
|
|
28
|
-
name: "vue
|
|
28
|
+
name: "core.vue.parser",
|
|
29
29
|
languageOptions: {
|
|
30
30
|
parser: vueParser,
|
|
31
31
|
parserOptions: {
|
|
@@ -35,15 +35,14 @@ export default function vue(languageConfig, stylisticConfig) {
|
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
-
// register rule implementations and recommended rules
|
|
39
|
-
recommendedConfigs,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
rules: convertRuleWarningsToErrors(config.rules),
|
|
38
|
+
// register rule implementations and recommended rules, raise all recommended rules to "error" level
|
|
39
|
+
recommendedConfigs.map((config, index) => ({
|
|
40
|
+
...convertRuleWarningsToErrors(config),
|
|
41
|
+
name: `core.vue.recommended-${index}`,
|
|
43
42
|
})),
|
|
44
43
|
// reconfigure plugin rules
|
|
45
44
|
{
|
|
46
|
-
name: "vue
|
|
45
|
+
name: "core.vue.rules",
|
|
47
46
|
rules: {
|
|
48
47
|
"no-undef": "off",
|
|
49
48
|
"no-unused-vars": "off",
|
package/dist/eslint/core/yaml.js
CHANGED
|
@@ -17,10 +17,13 @@ export default function yaml(stylisticConfig) {
|
|
|
17
17
|
// add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
|
|
18
18
|
return fixMissingFilesOption(
|
|
19
19
|
// register rule implementations and recommended rules
|
|
20
|
-
yamlPlugin.configs["flat/recommended"],
|
|
20
|
+
yamlPlugin.configs["flat/recommended"].map((config, index) => ({
|
|
21
|
+
...config,
|
|
22
|
+
name: `core.yaml.recommended-${index}`,
|
|
23
|
+
})),
|
|
21
24
|
// reconfigure plugin rules
|
|
22
25
|
{
|
|
23
|
-
name: "yaml
|
|
26
|
+
name: "core.yaml.rules",
|
|
24
27
|
rules: {
|
|
25
28
|
"yml/indent": ["error", stylisticConfig.indent.yaml],
|
|
26
29
|
"yml/key-spacing": ["error", { mode: "minimum" }],
|
|
@@ -90,18 +90,18 @@ const RESTRICTED_GLOBALS = AMBIGUOUS_BROWSER_TYPES.map(name => {
|
|
|
90
90
|
export default function browser(envOptions) {
|
|
91
91
|
return [
|
|
92
92
|
// register global symbols used in browser scripts
|
|
93
|
-
createConfig("browser
|
|
93
|
+
createConfig("core.browser.globals", envOptions, {
|
|
94
94
|
languageOptions: {
|
|
95
95
|
globals: BROWSER_GLOBALS,
|
|
96
96
|
},
|
|
97
97
|
}),
|
|
98
98
|
// generate the "no-restricted-?" rules according to passed configuration
|
|
99
|
-
restrictedRulesConfig("browser
|
|
99
|
+
restrictedRulesConfig("core.browser.restricted", envOptions, {
|
|
100
100
|
globals: RESTRICTED_GLOBALS,
|
|
101
101
|
properties: RESTRICTED_PROPERTIES,
|
|
102
102
|
syntax: RESTRICTED_SYNTAX,
|
|
103
103
|
}),
|
|
104
104
|
// custom rules
|
|
105
|
-
customRules("browser
|
|
105
|
+
customRules("core.browser.rules", envOptions),
|
|
106
106
|
];
|
|
107
107
|
}
|
|
@@ -19,7 +19,7 @@ import { createConfig, customRules } from "../shared/env-utils.js";
|
|
|
19
19
|
export default function codecept(envOptions) {
|
|
20
20
|
return [
|
|
21
21
|
// "codecept" plugin
|
|
22
|
-
createConfig("codecept
|
|
22
|
+
createConfig("env.codecept.plugin", envOptions, {
|
|
23
23
|
// register rule implementations of the plugins
|
|
24
24
|
plugins: {
|
|
25
25
|
codeceptjs: codeceptPlugin,
|
|
@@ -32,9 +32,9 @@ export default function codecept(envOptions) {
|
|
|
32
32
|
rules: codeceptPlugin.configs.recommended.rules,
|
|
33
33
|
}),
|
|
34
34
|
// "chai-expect" plugin
|
|
35
|
-
createConfig("codecept
|
|
35
|
+
createConfig("env.codecept.chai-expect", envOptions, chaiExpectPlugin.configs["recommended-flat"]),
|
|
36
36
|
// custom rules
|
|
37
|
-
customRules("codecept
|
|
37
|
+
customRules("env.codecept.rules", envOptions, {
|
|
38
38
|
"new-cap": ["error", {
|
|
39
39
|
capIsNewExceptions: ["After", "AfterSuite", "Before", "BeforeSuite", "Feature", "Scenario"],
|
|
40
40
|
}],
|
|
@@ -16,7 +16,7 @@ import { TS_GLOB, createConfig, customRules } from "../shared/env-utils.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export default function decorators(envOptions) {
|
|
18
18
|
return [
|
|
19
|
-
createConfig("decorators
|
|
19
|
+
createConfig("core.decorators.babel", envOptions, {
|
|
20
20
|
ignores: TS_GLOB,
|
|
21
21
|
languageOptions: {
|
|
22
22
|
parser: babelParser,
|
|
@@ -32,6 +32,6 @@ export default function decorators(envOptions) {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
}),
|
|
35
|
-
customRules("decorators
|
|
35
|
+
customRules("core.decorators.rules", envOptions),
|
|
36
36
|
];
|
|
37
37
|
}
|
|
@@ -16,9 +16,9 @@ import { createConfig, customRules } from "../shared/env-utils.js";
|
|
|
16
16
|
export default function eslint(envOptions) {
|
|
17
17
|
return [
|
|
18
18
|
// register rule implementations and recommended rules
|
|
19
|
-
createConfig("eslint
|
|
19
|
+
createConfig("env.eslint.recommended", envOptions, eslintPlugin.configs["flat/rules-recommended"]),
|
|
20
20
|
// custom rules
|
|
21
|
-
customRules("eslint
|
|
21
|
+
customRules("env.eslint.rules", envOptions, {
|
|
22
22
|
"eslint-plugin/no-meta-schema-default": "error",
|
|
23
23
|
"eslint-plugin/no-property-in-node": "error",
|
|
24
24
|
"eslint-plugin/prefer-placeholders": "error",
|
package/dist/eslint/env/jest.js
CHANGED
|
@@ -21,13 +21,13 @@ import { createUnitTestPluginConfigs } from "../shared/unittest.js";
|
|
|
21
21
|
export default function jest(envOptions) {
|
|
22
22
|
return [
|
|
23
23
|
// register rule implementations, globals, and recommended rules
|
|
24
|
-
createConfig("jest
|
|
24
|
+
createConfig("env.jest.recommended", envOptions, jestPlugin.configs["flat/recommended"]),
|
|
25
25
|
// add recommended stylistic rules
|
|
26
|
-
createConfig("jest
|
|
26
|
+
createConfig("env.jest.stylistic", envOptions, jestPlugin.configs["flat/style"]),
|
|
27
27
|
// "jest-dom" and "testing-library" plugin
|
|
28
|
-
createUnitTestPluginConfigs("jest", envOptions),
|
|
28
|
+
createUnitTestPluginConfigs("env.jest", envOptions),
|
|
29
29
|
// custom rules
|
|
30
|
-
customRules("jest
|
|
30
|
+
customRules("env.jest.rules", envOptions, {
|
|
31
31
|
"jest/consistent-test-it": ["error", { fn: "it" }],
|
|
32
32
|
"jest/no-commented-out-tests": "error",
|
|
33
33
|
"jest/no-conditional-expect": "off",
|
|
@@ -46,7 +46,7 @@ export default function jest(envOptions) {
|
|
|
46
46
|
"jest/require-top-level-describe": "error",
|
|
47
47
|
}),
|
|
48
48
|
// enable "jest/unbound-method" for TS files
|
|
49
|
-
createConfig("jest
|
|
49
|
+
createConfig("env.jest.typescript", envOptions, {
|
|
50
50
|
ignores: JS_GLOB,
|
|
51
51
|
rules: {
|
|
52
52
|
"jest/unbound-method": "error",
|
package/dist/eslint/env/node.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function node(envOptions) {
|
|
|
20
20
|
const configKey = (envOptions.sourceType === "commonjs") ? "flat/recommended-script" : "flat/recommended-module";
|
|
21
21
|
return [
|
|
22
22
|
// register rule implementations
|
|
23
|
-
createConfig("node
|
|
23
|
+
createConfig("env.node.recommended", envOptions, {
|
|
24
24
|
...nodePlugin.configs[configKey],
|
|
25
25
|
settings: {
|
|
26
26
|
n: {
|
|
@@ -30,9 +30,9 @@ export default function node(envOptions) {
|
|
|
30
30
|
},
|
|
31
31
|
}),
|
|
32
32
|
// generate the "no-restricted-?" rules according to passed configuration
|
|
33
|
-
restrictedRulesConfig("node
|
|
33
|
+
restrictedRulesConfig("env.node.restricted", envOptions),
|
|
34
34
|
// custom rules
|
|
35
|
-
customRules("node
|
|
35
|
+
customRules("env.node.rules", envOptions, {
|
|
36
36
|
"no-console": "off",
|
|
37
37
|
"n/no-missing-import": ["error", { ignoreTypeImport: true }],
|
|
38
38
|
"n/no-unsupported-features/node-builtins": ["error", { allowExperimental: true }],
|
|
@@ -15,7 +15,7 @@ import noInvalidHierarchy from "../rules/no-invalid-hierarchy.js";
|
|
|
15
15
|
export default function project(envOptions) {
|
|
16
16
|
return [
|
|
17
17
|
// register rule implementations
|
|
18
|
-
createConfig("project
|
|
18
|
+
createConfig("env.project.plugin", envOptions, {
|
|
19
19
|
plugins: {
|
|
20
20
|
"env-project": {
|
|
21
21
|
rules: {
|
|
@@ -32,7 +32,7 @@ export default function project(envOptions) {
|
|
|
32
32
|
},
|
|
33
33
|
}),
|
|
34
34
|
// custom rules
|
|
35
|
-
customRules("project
|
|
35
|
+
customRules("env.project.rules", envOptions, {
|
|
36
36
|
"env-project/no-amd-module-directive": "error",
|
|
37
37
|
"env-project/no-invalid-modules": ["error", { external: envOptions.external ?? [] }],
|
|
38
38
|
"env-project/no-invalid-hierarchy": envOptions.hierarchy ? ["error", envOptions.hierarchy] : "off",
|
package/dist/eslint/env/react.js
CHANGED
|
@@ -24,53 +24,41 @@ import { createConfig, customRules, convertRuleWarningsToErrors } from "../share
|
|
|
24
24
|
* The configuration entries to be added to the resulting configuration array.
|
|
25
25
|
*/
|
|
26
26
|
export default function react(envOptions) {
|
|
27
|
-
// recommended configuration of the main plugin
|
|
28
|
-
const recommendedConfig = reactPlugin.configs["recommended-typescript"];
|
|
29
27
|
return [
|
|
30
28
|
// configure "react" plugin for all source files (JSX and TSX)
|
|
31
|
-
createConfig("react
|
|
29
|
+
createConfig("env.react.recommended", envOptions, {
|
|
32
30
|
// auto-detect installed React version
|
|
33
31
|
languageOptions: {
|
|
34
32
|
parser: parser,
|
|
35
33
|
parserOptions: { projectService: true },
|
|
36
34
|
},
|
|
37
|
-
// register rule implementations and language settings
|
|
38
|
-
...
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"@eslint-react/naming-convention/filename-extension": ["error", { allow: "as-needed" }],
|
|
60
|
-
"@eslint-react/naming-convention/use-state": "error",
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
// "react-hooks" plugin
|
|
64
|
-
createConfig("react:hooks", envOptions, {
|
|
65
|
-
// register rule implementations of the plugins
|
|
66
|
-
plugins: {
|
|
67
|
-
"react-hooks": reactHooksPlugin,
|
|
68
|
-
},
|
|
69
|
-
// recommended rules (raise all recommended rules to "error" level)
|
|
70
|
-
rules: convertRuleWarningsToErrors(reactHooksPlugin.configs.recommended.rules),
|
|
35
|
+
// register rule implementations and language settings, raise all recommended rules to "error" level
|
|
36
|
+
...convertRuleWarningsToErrors(reactPlugin.configs["recommended-typescript"]),
|
|
37
|
+
}, {
|
|
38
|
+
// custom overrides
|
|
39
|
+
"@eslint-react/jsx-no-iife": "error",
|
|
40
|
+
"@eslint-react/jsx-no-undef": "error",
|
|
41
|
+
"@eslint-react/no-children-prop": "error",
|
|
42
|
+
"@eslint-react/no-class-component": "error",
|
|
43
|
+
"@eslint-react/no-duplicate-jsx-props": "error",
|
|
44
|
+
"@eslint-react/no-implicit-key": "error",
|
|
45
|
+
"@eslint-react/no-missing-component-display-name": "error",
|
|
46
|
+
"@eslint-react/no-useless-fragment": "error",
|
|
47
|
+
"@eslint-react/prefer-read-only-props": "error",
|
|
48
|
+
"@eslint-react/prefer-shorthand-boolean": "error",
|
|
49
|
+
"@eslint-react/prefer-shorthand-fragment": "error",
|
|
50
|
+
"@eslint-react/use-jsx-vars": "error",
|
|
51
|
+
"@eslint-react/dom/no-flush-sync": "error",
|
|
52
|
+
"@eslint-react/dom/no-unknown-property": "error",
|
|
53
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "error",
|
|
54
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-memo": "error",
|
|
55
|
+
"@eslint-react/naming-convention/filename-extension": ["error", { allow: "as-needed" }],
|
|
56
|
+
"@eslint-react/naming-convention/use-state": "error",
|
|
71
57
|
}),
|
|
58
|
+
// "react-hooks" plugin and recommended rules, raise all recommended rules to "error" level
|
|
59
|
+
createConfig("env.react.react-hooks", envOptions, convertRuleWarningsToErrors(reactHooksPlugin.configs["recommended-latest"])),
|
|
72
60
|
// "react-hooks-static-deps" plugin
|
|
73
|
-
(envOptions.additionalHooks ?? envOptions.staticHooks) && createConfig("react
|
|
61
|
+
(envOptions.additionalHooks ?? envOptions.staticHooks) && createConfig("env.react.static-deps", envOptions, {
|
|
74
62
|
plugins: {
|
|
75
63
|
"react-hooks-static-deps": fixupPluginRules(reactHooksStaticDepsPlugin), // https://github.com/stoikio/eslint-plugin-react-hooks-static-deps/issues/1
|
|
76
64
|
},
|
|
@@ -83,10 +71,10 @@ export default function react(envOptions) {
|
|
|
83
71
|
},
|
|
84
72
|
}),
|
|
85
73
|
// "react-refresh" plugin
|
|
86
|
-
createConfig("react
|
|
74
|
+
createConfig("env.react.react-refresh", envOptions, reactRefreshPlugin.configs.vite),
|
|
87
75
|
// "jsx-a11y" plugin
|
|
88
|
-
createConfig("react
|
|
76
|
+
createConfig("env.react.jsx-a11y", envOptions, jsxA11yPlugin.flatConfigs.recommended),
|
|
89
77
|
// custom rules
|
|
90
|
-
customRules("react
|
|
78
|
+
customRules("env.react.rules", envOptions),
|
|
91
79
|
];
|
|
92
80
|
}
|
|
@@ -12,7 +12,7 @@ import { createConfig, customRules } from "../shared/env-utils.js";
|
|
|
12
12
|
export default function tsconfig(envOptions) {
|
|
13
13
|
return [
|
|
14
14
|
// path to project configuration file
|
|
15
|
-
createConfig("tsconfig
|
|
15
|
+
createConfig("env.tsconfig.project", envOptions, {
|
|
16
16
|
languageOptions: {
|
|
17
17
|
parserOptions: {
|
|
18
18
|
projectService: false,
|
|
@@ -21,6 +21,6 @@ export default function tsconfig(envOptions) {
|
|
|
21
21
|
},
|
|
22
22
|
}),
|
|
23
23
|
// custom rules
|
|
24
|
-
customRules("tsconfig
|
|
24
|
+
customRules("env.tsconfig.rules", envOptions),
|
|
25
25
|
];
|
|
26
26
|
}
|
|
@@ -21,7 +21,7 @@ import { createUnitTestPluginConfigs } from "../shared/unittest.js";
|
|
|
21
21
|
export default function vitest(envOptions) {
|
|
22
22
|
return [
|
|
23
23
|
// "vitest" plugin
|
|
24
|
-
createConfig("vitest
|
|
24
|
+
createConfig("env.vitest.recommended", envOptions, {
|
|
25
25
|
// register rule implementations of the plugins
|
|
26
26
|
plugins: {
|
|
27
27
|
vitest: vitestPlugin,
|
|
@@ -34,9 +34,9 @@ export default function vitest(envOptions) {
|
|
|
34
34
|
rules: vitestPlugin.configs.recommended.rules,
|
|
35
35
|
}),
|
|
36
36
|
// "jest-dom" and "testing-library" plugin
|
|
37
|
-
createUnitTestPluginConfigs("vitest", envOptions),
|
|
37
|
+
createUnitTestPluginConfigs("env.vitest", envOptions),
|
|
38
38
|
// allow to add type-checking expectations in tests
|
|
39
|
-
createConfig("vitest
|
|
39
|
+
createConfig("env.vitest.type-check", envOptions, {
|
|
40
40
|
ignores: JS_GLOB,
|
|
41
41
|
settings: {
|
|
42
42
|
vitest: {
|
|
@@ -45,7 +45,7 @@ export default function vitest(envOptions) {
|
|
|
45
45
|
},
|
|
46
46
|
}),
|
|
47
47
|
// custom rules
|
|
48
|
-
customRules("vitest
|
|
48
|
+
customRules("env.vitest.rules", envOptions, {
|
|
49
49
|
// "vitest" plugin
|
|
50
50
|
"vitest/consistent-test-it": "error",
|
|
51
51
|
"vitest/no-alias-methods": "error",
|
package/dist/eslint/index.js
CHANGED
|
@@ -128,7 +128,7 @@ export function defineConfig(options, ...configs) {
|
|
|
128
128
|
// default configuration for code style checks
|
|
129
129
|
stylistic(stylisticConfig),
|
|
130
130
|
// custom rules
|
|
131
|
-
options.rules && { name: "index
|
|
131
|
+
options.rules && { name: "core.index.custom-rules", rules: options.rules },
|
|
132
132
|
// custom configuration entries
|
|
133
133
|
configs.map(config => (typeof config === "function") ? config(resolver) : config)));
|
|
134
134
|
}
|
|
@@ -255,15 +255,16 @@ export declare function customRules(name: string, envOptions: EnvBaseOptions, ru
|
|
|
255
255
|
*/
|
|
256
256
|
export declare function fixMissingFilesOption(...configs: ConfigWithExtendsArg[]): ConfigWithExtends[];
|
|
257
257
|
/**
|
|
258
|
-
* Converts all
|
|
258
|
+
* Converts severity "warning" of all rules in the passed configuration entry
|
|
259
|
+
* to severity "error".
|
|
259
260
|
*
|
|
260
|
-
* @param
|
|
261
|
-
* The
|
|
261
|
+
* @param config
|
|
262
|
+
* The configuration entry to be converted.
|
|
262
263
|
*
|
|
263
264
|
* @returns
|
|
264
|
-
* The converted
|
|
265
|
+
* The converted configuration entry.
|
|
265
266
|
*/
|
|
266
|
-
export declare function convertRuleWarningsToErrors(
|
|
267
|
+
export declare function convertRuleWarningsToErrors(config: ConfigWithExtends): ConfigWithExtends;
|
|
267
268
|
/**
|
|
268
269
|
* Translates the stylistic option `dangle` to the configuration options for
|
|
269
270
|
* "comma-dangle" rules.
|
|
@@ -87,8 +87,8 @@ export function extGlob(extensions) {
|
|
|
87
87
|
*/
|
|
88
88
|
export function createConfig(name, envOptions, config, rules) {
|
|
89
89
|
return {
|
|
90
|
-
name,
|
|
91
90
|
...config,
|
|
91
|
+
name,
|
|
92
92
|
files: flattenDeepArrays(envOptions.files, config.files),
|
|
93
93
|
ignores: flattenDeepArrays(envOptions.ignores, config.ignores),
|
|
94
94
|
rules: { ...config.rules, ...rules },
|
|
@@ -136,24 +136,28 @@ export function fixMissingFilesOption(...configs) {
|
|
|
136
136
|
return files ? flatConfigs.map(config => (!config.files && (config.languageOptions || config.rules)) ? { ...config, files } : config) : flatConfigs;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Converts all
|
|
139
|
+
* Converts severity "warning" of all rules in the passed configuration entry
|
|
140
|
+
* to severity "error".
|
|
140
141
|
*
|
|
141
|
-
* @param
|
|
142
|
-
* The
|
|
142
|
+
* @param config
|
|
143
|
+
* The configuration entry to be converted.
|
|
143
144
|
*
|
|
144
145
|
* @returns
|
|
145
|
-
* The converted
|
|
146
|
-
*/
|
|
147
|
-
export function convertRuleWarningsToErrors(
|
|
148
|
-
return rules ?
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
146
|
+
* The converted configuration entry.
|
|
147
|
+
*/
|
|
148
|
+
export function convertRuleWarningsToErrors(config) {
|
|
149
|
+
return config.rules ? {
|
|
150
|
+
...config,
|
|
151
|
+
rules: Object.fromEntries(Object.entries(config.rules).map(([key, value]) => {
|
|
152
|
+
if (value === "warn") {
|
|
153
|
+
value = "error";
|
|
154
|
+
}
|
|
155
|
+
else if (Array.isArray(value) && (value[0] === "warn")) {
|
|
156
|
+
value = ["error", ...value.slice(1)];
|
|
157
|
+
}
|
|
158
|
+
return [key, value];
|
|
159
|
+
})),
|
|
160
|
+
} : config;
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
163
|
* Translates the stylistic option `dangle` to the configuration options for
|
|
@@ -90,7 +90,7 @@ export function restrictedRulesConfig(baseName, envOptions, fixed) {
|
|
|
90
90
|
rules: createRulesRecord(key => items[key]),
|
|
91
91
|
}),
|
|
92
92
|
// generate the override entries (join with base items)
|
|
93
|
-
restricted?.overrides?.map((override, index) => createConfig(`${baseName}
|
|
93
|
+
restricted?.overrides?.map((override, index) => createConfig(`${baseName}.override-${index}`, override, {
|
|
94
94
|
rules: createRulesRecord(key => flattenDeepArrays(items[key], override[key])),
|
|
95
95
|
})),
|
|
96
96
|
];
|
|
@@ -19,11 +19,11 @@ import { createConfig } from "./env-utils.js";
|
|
|
19
19
|
export function createUnitTestPluginConfigs(baseName, envOptions) {
|
|
20
20
|
return [
|
|
21
21
|
// "jest-extended" plugin (config "flat/recommended" is empty)
|
|
22
|
-
envOptions.jestExtended && createConfig(`${baseName}
|
|
22
|
+
envOptions.jestExtended && createConfig(`${baseName}.extended`, envOptions, extendedPlugin.configs["flat/all"]),
|
|
23
23
|
// "jest-dom" plugin
|
|
24
|
-
envOptions.jestDom && createConfig(`${baseName}
|
|
24
|
+
envOptions.jestDom && createConfig(`${baseName}.jest-dom`, envOptions, jestDomPlugin.configs["flat/recommended"]),
|
|
25
25
|
// "testing-library" plugin
|
|
26
|
-
envOptions.testingLib && createConfig(`${baseName}
|
|
26
|
+
envOptions.testingLib && createConfig(`${baseName}.testing-library`, envOptions, {
|
|
27
27
|
// register rule implementations of the plugins
|
|
28
28
|
plugins: {
|
|
29
29
|
"testing-library": testingLibraryPlugin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/linter-presets",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"@eslint/compat": "^1.3.1",
|
|
39
39
|
"@eslint/config-helpers": "^0.3.0",
|
|
40
40
|
"@eslint/js": "^9.31.0",
|
|
41
|
-
"@eslint/markdown": "^7.
|
|
42
|
-
"@stylistic/eslint-plugin": "^5.2.
|
|
41
|
+
"@eslint/markdown": "^7.1.0",
|
|
42
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
43
43
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
44
|
-
"@stylistic/stylelint-config": "^
|
|
45
|
-
"@stylistic/stylelint-plugin": "^
|
|
46
|
-
"@types/picomatch": "^4.0.
|
|
44
|
+
"@stylistic/stylelint-config": "^3.0.1",
|
|
45
|
+
"@stylistic/stylelint-plugin": "^4.0.0",
|
|
46
|
+
"@types/picomatch": "^4.0.1",
|
|
47
47
|
"@vitest/eslint-plugin": "^1.3.4",
|
|
48
48
|
"confusing-browser-globals": "^1.0.11",
|
|
49
49
|
"eslint-plugin-chai-expect": "^3.1.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"eslint-plugin-react-hooks-static-deps": "^1.0.7",
|
|
64
64
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
65
65
|
"eslint-plugin-regexp": "^2.9.0",
|
|
66
|
-
"eslint-plugin-testing-library": "^7.6.
|
|
66
|
+
"eslint-plugin-testing-library": "^7.6.1",
|
|
67
67
|
"eslint-plugin-vue": "^10.3.0",
|
|
68
68
|
"eslint-plugin-yml": "^1.18.0",
|
|
69
69
|
"find-up": "^7.0.0",
|
|
@@ -75,20 +75,20 @@
|
|
|
75
75
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
76
76
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
77
77
|
"stylelint-plugin-license-header": "^1.0.3",
|
|
78
|
-
"typescript-eslint": "^8.
|
|
78
|
+
"typescript-eslint": "^8.38.0",
|
|
79
79
|
"vue-eslint-parser": "^10.2.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
83
83
|
"@types/eslint-scope": "^8.3.1",
|
|
84
|
-
"@types/node": "^24.0
|
|
84
|
+
"@types/node": "^24.1.0",
|
|
85
85
|
"@types/react": "^19.1.8",
|
|
86
|
-
"@typescript-eslint/utils": "^8.
|
|
86
|
+
"@typescript-eslint/utils": "^8.38.0",
|
|
87
87
|
"eslint": "^9.31.0",
|
|
88
|
-
"jest": "^30.0.
|
|
89
|
-
"jiti": "^2.
|
|
88
|
+
"jest": "^30.0.5",
|
|
89
|
+
"jiti": "^2.5.0",
|
|
90
90
|
"premove": "^4.0.0",
|
|
91
|
-
"stylelint": "^16.
|
|
91
|
+
"stylelint": "^16.22.0",
|
|
92
92
|
"ts-patch": "^3.3.0",
|
|
93
93
|
"typescript": "^5.8.3",
|
|
94
94
|
"typescript-transform-paths": "^3.5.5"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint": "^9.30.0",
|
|
98
98
|
"jest": "^29.7.0 || ^30.0.0",
|
|
99
99
|
"postcss": "^8.4.0",
|
|
100
|
-
"stylelint": "^16.
|
|
100
|
+
"stylelint": "^16.22.0",
|
|
101
101
|
"typescript": "^5.7.0",
|
|
102
102
|
"vitest": "^2.0.0 || ^3.0.0"
|
|
103
103
|
},
|