@open-xchange/linter-presets 0.11.6 → 0.12.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 +5 -0
- package/dist/eslint/config/stylistic.d.ts +1 -1
- package/dist/eslint/config/stylistic.js +3 -9
- package/dist/eslint/config/vue.js +44 -2
- package/dist/eslint/env/node.d.ts +3 -1
- package/dist/eslint/env/react.js +1 -9
- package/dist/eslint/rules/no-invalid-hierarchy.d.ts +3 -1
- package/dist/eslint/shared/env-utils.d.ts +33 -10
- package/dist/eslint/shared/env-utils.js +14 -0
- package/dist/eslint/shared/restricted.d.ts +3 -3
- package/dist/eslint/shared/unittest.d.ts +3 -1
- package/dist/stylelint/index.d.ts +6 -3
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
2
2
|
import migratePlugin from "@stylistic/eslint-plugin-migrate";
|
|
3
|
+
import { getCommaDangleConfig } from "../shared/env-utils.js";
|
|
3
4
|
// functions ==================================================================
|
|
4
5
|
/**
|
|
5
6
|
* Defines standard (opinionated) linter rules for source code style.
|
|
@@ -16,7 +17,7 @@ import migratePlugin from "@stylistic/eslint-plugin-migrate";
|
|
|
16
17
|
*/
|
|
17
18
|
export default function stylistic(stylisticConfig) {
|
|
18
19
|
// configuration properties
|
|
19
|
-
const { indent, semi, quotes
|
|
20
|
+
const { indent, semi, quotes } = stylisticConfig;
|
|
20
21
|
return [
|
|
21
22
|
// globally disable all deprecated stylistic core rules
|
|
22
23
|
stylisticPlugin.configs["disable-legacy"],
|
|
@@ -34,7 +35,7 @@ export default function stylistic(stylisticConfig) {
|
|
|
34
35
|
"@stylistic/arrow-spacing": "error",
|
|
35
36
|
"@stylistic/block-spacing": "error",
|
|
36
37
|
"@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
37
|
-
"@stylistic/comma-dangle": (
|
|
38
|
+
"@stylistic/comma-dangle": getCommaDangleConfig(stylisticConfig),
|
|
38
39
|
"@stylistic/comma-spacing": "error",
|
|
39
40
|
"@stylistic/comma-style": "error",
|
|
40
41
|
"@stylistic/computed-property-spacing": "error",
|
|
@@ -99,13 +100,6 @@ export default function stylistic(stylisticConfig) {
|
|
|
99
100
|
"@stylistic/yield-star-spacing": "error",
|
|
100
101
|
},
|
|
101
102
|
},
|
|
102
|
-
// special settings for Vue files
|
|
103
|
-
{
|
|
104
|
-
files: ["**/*.vue"],
|
|
105
|
-
rules: {
|
|
106
|
-
"@stylistic/indent": ["error", stylisticConfig.indent.vue],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
103
|
// "@stylistic/migrate" plugin
|
|
110
104
|
{
|
|
111
105
|
// register rule implementations of the plugins
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import vuePlugin from "eslint-plugin-vue";
|
|
2
2
|
import vueParser from "vue-eslint-parser";
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
|
-
import { fixMissingFilesOption } from "../shared/env-utils.js";
|
|
4
|
+
import { fixMissingFilesOption, getCommaDangleConfig } from "../shared/env-utils.js";
|
|
5
5
|
// functions ==================================================================
|
|
6
6
|
/**
|
|
7
7
|
* Creates configuration objects with linter rules for Vue.js.
|
|
@@ -38,10 +38,52 @@ export default function vue(languageConfig, stylisticConfig) {
|
|
|
38
38
|
{
|
|
39
39
|
rules: {
|
|
40
40
|
"no-undef": "off",
|
|
41
|
+
"no-unused-vars": "off",
|
|
41
42
|
"no-useless-assignment": "off",
|
|
42
|
-
"vue/
|
|
43
|
+
"vue/block-order": ["error", { order: ["script", "template", "style"] }],
|
|
44
|
+
"vue/component-api-style": "error",
|
|
45
|
+
"vue/define-emits-declaration": "error",
|
|
46
|
+
"vue/define-macros-order": "error",
|
|
47
|
+
"vue/define-props-declaration": "error",
|
|
48
|
+
"vue/eqeqeq": "error",
|
|
49
|
+
"vue/html-button-has-type": "error",
|
|
43
50
|
"vue/max-attributes-per-line": "off",
|
|
51
|
+
"vue/no-console": "error",
|
|
52
|
+
"vue/no-empty-pattern": "error",
|
|
53
|
+
"vue/no-irregular-whitespace": "error",
|
|
54
|
+
"vue/no-sparse-arrays": "error",
|
|
55
|
+
"vue/no-template-target-blank": "error",
|
|
56
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
57
|
+
"vue/no-useless-concat": "error",
|
|
58
|
+
"vue/no-useless-v-bind": "error",
|
|
59
|
+
"vue/object-shorthand": "error",
|
|
60
|
+
"vue/padding-line-between-blocks": "error",
|
|
61
|
+
"vue/prefer-define-options": "error",
|
|
62
|
+
"vue/prefer-true-attribute-shorthand": "error",
|
|
63
|
+
"vue/prefer-use-template-ref": "error",
|
|
64
|
+
"vue/require-explicit-slots": "error",
|
|
65
|
+
"vue/require-typed-ref": "error",
|
|
44
66
|
"vue/singleline-html-element-content-newline": "off",
|
|
67
|
+
// @stylistic extensions
|
|
68
|
+
"vue/array-bracket-spacing": "error",
|
|
69
|
+
"vue/arrow-spacing": "error",
|
|
70
|
+
"vue/block-spacing": "error",
|
|
71
|
+
"vue/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
72
|
+
"vue/comma-dangle": getCommaDangleConfig(stylisticConfig),
|
|
73
|
+
"vue/comma-spacing": "error",
|
|
74
|
+
"vue/comma-style": "error",
|
|
75
|
+
"vue/dot-notation": "error",
|
|
76
|
+
"vue/func-call-spacing": "error",
|
|
77
|
+
"vue/html-indent": ["error", stylisticConfig.indent.vue],
|
|
78
|
+
"vue/key-spacing": ["error", { mode: "minimum" }],
|
|
79
|
+
"vue/keyword-spacing": "error",
|
|
80
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
81
|
+
"vue/quote-props": ["error", "as-needed"],
|
|
82
|
+
"vue/script-indent": ["error", stylisticConfig.indent.vue, { switchCase: 1 }],
|
|
83
|
+
"vue/space-in-parens": "error",
|
|
84
|
+
"vue/space-infix-ops": "error",
|
|
85
|
+
"vue/space-unary-ops": "error",
|
|
86
|
+
"vue/template-curly-spacing": "error",
|
|
45
87
|
},
|
|
46
88
|
},
|
|
47
89
|
]);
|
|
@@ -23,7 +23,9 @@ export interface EnvNodeSharedSettings {
|
|
|
23
23
|
*/
|
|
24
24
|
export interface EnvNodeOptions extends EnvRestrictedOptions {
|
|
25
25
|
/**
|
|
26
|
-
* The module mode used by the linted files.
|
|
26
|
+
* The module mode used by the linted files.
|
|
27
|
+
*
|
|
28
|
+
* @default "module"
|
|
27
29
|
*/
|
|
28
30
|
sourceType?: LanguageOptions["sourceType"];
|
|
29
31
|
/**
|
package/dist/eslint/env/react.js
CHANGED
|
@@ -76,15 +76,7 @@ export default function react(envOptions) {
|
|
|
76
76
|
},
|
|
77
77
|
}),
|
|
78
78
|
// "react-refresh" plugin
|
|
79
|
-
createConfig(envOptions,
|
|
80
|
-
// register rule implementations of the plugins
|
|
81
|
-
plugins: {
|
|
82
|
-
"react-refresh": reactRefreshPlugin,
|
|
83
|
-
},
|
|
84
|
-
rules: {
|
|
85
|
-
"react-refresh/only-export-components": ["error", { allowConstantExport: true }],
|
|
86
|
-
},
|
|
87
|
-
}),
|
|
79
|
+
createConfig(envOptions, reactRefreshPlugin.configs.vite),
|
|
88
80
|
// "jsx-a11y" plugin
|
|
89
81
|
createConfig(envOptions, jsxA11yPlugin.flatConfigs.recommended),
|
|
90
82
|
// custom rules
|
|
@@ -14,7 +14,9 @@ export interface RuleNoInvalidHierarchyPackage {
|
|
|
14
14
|
* installation. Such a package cannot be imported statically (with
|
|
15
15
|
* `import` statement) from a non-optional package, but can only be loaded
|
|
16
16
|
* dynamically at runtime (by calling `import()`). The rule will mark all
|
|
17
|
-
* static imports of optional code as an error.
|
|
17
|
+
* static imports of optional code as an error.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
18
20
|
*/
|
|
19
21
|
optional?: boolean;
|
|
20
22
|
}
|
|
@@ -8,7 +8,8 @@ export type DeepRequired<T> = {
|
|
|
8
8
|
export interface LanguageOptions {
|
|
9
9
|
/**
|
|
10
10
|
* The ECMAScript version to be used in the project (version or year).
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* @default "latest"
|
|
12
13
|
*/
|
|
13
14
|
ecmaVersion?: Linter.EcmaVersion;
|
|
14
15
|
/**
|
|
@@ -17,13 +18,15 @@ export interface LanguageOptions {
|
|
|
17
18
|
* - "module": The files will be considered being ES modules.
|
|
18
19
|
* - "commonjs": The files will be considered being CommonJS modules.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
+
* @default "module"
|
|
21
22
|
*/
|
|
22
23
|
sourceType?: "module" | "commonjs";
|
|
23
24
|
/**
|
|
24
25
|
* Whether to support native ES decorators in JavaScript code (via Babel
|
|
25
26
|
* plugin). Does not affect TypeScript code which uses an own parser aware
|
|
26
|
-
* of the decorator syntax.
|
|
27
|
+
* of the decorator syntax.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
27
30
|
*/
|
|
28
31
|
nativeDecorators?: boolean;
|
|
29
32
|
}
|
|
@@ -34,19 +37,26 @@ export type LanguageConfig = DeepRequired<LanguageOptions>;
|
|
|
34
37
|
export interface IndentOptions {
|
|
35
38
|
/**
|
|
36
39
|
* Indentation size for JavaScript and TypeScript files, including JSX.
|
|
37
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* @default 4
|
|
38
42
|
*/
|
|
39
43
|
js?: number;
|
|
40
44
|
/**
|
|
41
|
-
* Indentation size for JSON files.
|
|
45
|
+
* Indentation size for JSON files.
|
|
46
|
+
*
|
|
47
|
+
* @default 4
|
|
42
48
|
*/
|
|
43
49
|
json?: number;
|
|
44
50
|
/**
|
|
45
|
-
* Indentation size for YAML files.
|
|
51
|
+
* Indentation size for YAML files.
|
|
52
|
+
*
|
|
53
|
+
* @default 2
|
|
46
54
|
*/
|
|
47
55
|
yaml?: number;
|
|
48
56
|
/**
|
|
49
|
-
* Indentation size for Vue.js files
|
|
57
|
+
* Indentation size for Vue.js files (script and template blocks).
|
|
58
|
+
*
|
|
59
|
+
* @default 4
|
|
50
60
|
*/
|
|
51
61
|
vue?: number;
|
|
52
62
|
}
|
|
@@ -66,11 +76,13 @@ export interface StylisticOptions {
|
|
|
66
76
|
* - "never": Require to omit semicolons according to ASI rules.
|
|
67
77
|
* - "off": Semicolons will not be checked.
|
|
68
78
|
*
|
|
69
|
-
*
|
|
79
|
+
* @default "always"
|
|
70
80
|
*/
|
|
71
81
|
semi?: "always" | "never" | "off";
|
|
72
82
|
/**
|
|
73
|
-
* The type of the string delimiter character.
|
|
83
|
+
* The type of the string delimiter character.
|
|
84
|
+
*
|
|
85
|
+
* @default "double"
|
|
74
86
|
*/
|
|
75
87
|
quotes?: "single" | "double" | "off";
|
|
76
88
|
/**
|
|
@@ -82,7 +94,7 @@ export interface StylisticOptions {
|
|
|
82
94
|
* - "never": Dangling commas will be forbidden.
|
|
83
95
|
* - "off": Dangling commas will not be checked.
|
|
84
96
|
*
|
|
85
|
-
*
|
|
97
|
+
* @default "always"
|
|
86
98
|
*/
|
|
87
99
|
dangle?: "always" | "never" | "off";
|
|
88
100
|
}
|
|
@@ -247,3 +259,14 @@ export declare function fixMissingFilesOption(configs: Linter.Config[]): Linter.
|
|
|
247
259
|
* The converted rules record.
|
|
248
260
|
*/
|
|
249
261
|
export declare function convertRuleWarningsToErrors(rules: Linter.RulesRecord): Linter.RulesRecord;
|
|
262
|
+
/**
|
|
263
|
+
* Translates the stylistic option `dangle` to the configuration options for
|
|
264
|
+
* "comma-dangle" rules.
|
|
265
|
+
*
|
|
266
|
+
* @param stylisticConfig
|
|
267
|
+
* Resolved stylistic configuration options.
|
|
268
|
+
*
|
|
269
|
+
* @returns
|
|
270
|
+
* The configuration options for "comma-dangle" rules.
|
|
271
|
+
*/
|
|
272
|
+
export declare function getCommaDangleConfig(stylisticConfig: StylisticConfig): Linter.RuleEntry;
|
|
@@ -165,3 +165,17 @@ export function convertRuleWarningsToErrors(rules) {
|
|
|
165
165
|
return [key, value];
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Translates the stylistic option `dangle` to the configuration options for
|
|
170
|
+
* "comma-dangle" rules.
|
|
171
|
+
*
|
|
172
|
+
* @param stylisticConfig
|
|
173
|
+
* Resolved stylistic configuration options.
|
|
174
|
+
*
|
|
175
|
+
* @returns
|
|
176
|
+
* The configuration options for "comma-dangle" rules.
|
|
177
|
+
*/
|
|
178
|
+
export function getCommaDangleConfig(stylisticConfig) {
|
|
179
|
+
const { dangle } = stylisticConfig;
|
|
180
|
+
return (dangle === "always") ? ["error", "always-multiline"] : (dangle === "never") ? ["error", "never"] : "off";
|
|
181
|
+
}
|
|
@@ -49,10 +49,10 @@ export interface EnvRestrictedOption extends EnvRestrictedItems {
|
|
|
49
49
|
/**
|
|
50
50
|
* Whether the environment supports native decorators. In this case, it
|
|
51
51
|
* will be required to replace TypeScript decorated `private` methods with
|
|
52
|
-
* native `#private` methods.
|
|
52
|
+
* native `#private` methods. TypeScript's experimental decorators cannot
|
|
53
|
+
* be used with native `#private` fields.
|
|
53
54
|
*
|
|
54
|
-
*
|
|
55
|
-
* used with native `#private` fields).
|
|
55
|
+
* @default false
|
|
56
56
|
*/
|
|
57
57
|
nativeDecorators?: boolean;
|
|
58
58
|
/**
|
|
@@ -7,7 +7,9 @@ export interface EnvUnitTestOptions extends EnvBaseOptions {
|
|
|
7
7
|
/**
|
|
8
8
|
* Specifies whether to include `eslint-plugin-jest-dom`. Should only be
|
|
9
9
|
* used, if the package `@testing-library/jest-dom` has been installed in
|
|
10
|
-
* the project.
|
|
10
|
+
* the project.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
11
13
|
*/
|
|
12
14
|
jestDom?: boolean;
|
|
13
15
|
/**
|
|
@@ -4,12 +4,15 @@ import type { Config } from "stylelint";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface StylisticOptions {
|
|
6
6
|
/**
|
|
7
|
-
* Default indentation size (number of space characters).
|
|
8
|
-
*
|
|
7
|
+
* Default indentation size (number of space characters).
|
|
8
|
+
*
|
|
9
|
+
* @default 4
|
|
9
10
|
*/
|
|
10
11
|
indent?: number;
|
|
11
12
|
/**
|
|
12
|
-
* The type of the string delimiter character.
|
|
13
|
+
* The type of the string delimiter character.
|
|
14
|
+
*
|
|
15
|
+
* @default "double"
|
|
13
16
|
*/
|
|
14
17
|
quotes?: "single" | "double" | "off";
|
|
15
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/linter-presets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@babel/eslint-parser": "^7.25.9",
|
|
26
26
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
27
27
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
28
|
-
"@eslint-react/eslint-plugin": "^1.17.
|
|
29
|
-
"@eslint/compat": "^1.2.
|
|
30
|
-
"@eslint/js": "^9.
|
|
28
|
+
"@eslint-react/eslint-plugin": "^1.17.3",
|
|
29
|
+
"@eslint/compat": "^1.2.4",
|
|
30
|
+
"@eslint/js": "^9.16.0",
|
|
31
31
|
"@eslint/markdown": "^6.2.1",
|
|
32
32
|
"@stylistic/eslint-plugin": "^2.11.0",
|
|
33
33
|
"@stylistic/eslint-plugin-migrate": "^2.11.0",
|
|
34
34
|
"@stylistic/stylelint-config": "^2.0.0",
|
|
35
35
|
"@stylistic/stylelint-plugin": "^3.1.1",
|
|
36
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
36
|
+
"@vitest/eslint-plugin": "^1.1.14",
|
|
37
37
|
"confusing-browser-globals": "^1.0.11",
|
|
38
|
-
"eslint-import-resolver-typescript": "^3.
|
|
38
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
39
39
|
"eslint-plugin-chai-expect": "^3.1.0",
|
|
40
40
|
"eslint-plugin-codeceptjs": "^1.3.0",
|
|
41
41
|
"eslint-plugin-eslint-plugin": "^6.3.2",
|
|
@@ -48,29 +48,29 @@
|
|
|
48
48
|
"eslint-plugin-license-header": "^0.6.1",
|
|
49
49
|
"eslint-plugin-n": "^17.14.0",
|
|
50
50
|
"eslint-plugin-promise": "^7.2.1",
|
|
51
|
-
"eslint-plugin-react-hooks": "^5.
|
|
51
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
52
52
|
"eslint-plugin-react-hooks-static-deps": "^1.0.7",
|
|
53
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
54
|
-
"eslint-plugin-testing-library": "^7.
|
|
55
|
-
"eslint-plugin-vue": "^9.
|
|
56
|
-
"eslint-plugin-yml": "^1.
|
|
53
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
54
|
+
"eslint-plugin-testing-library": "^7.1.0",
|
|
55
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
56
|
+
"eslint-plugin-yml": "^1.16.0",
|
|
57
57
|
"find-up": "^7.0.0",
|
|
58
|
-
"globals": "^15.
|
|
58
|
+
"globals": "^15.13.0",
|
|
59
59
|
"picomatch": "^4.0.2",
|
|
60
60
|
"postcss-html": "^1.7.0",
|
|
61
61
|
"stylelint-config-standard": "^36.0.1",
|
|
62
62
|
"stylelint-config-standard-less": "^3.0.1",
|
|
63
|
-
"stylelint-config-standard-scss": "^
|
|
63
|
+
"stylelint-config-standard-scss": "^14.0.0",
|
|
64
64
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
65
65
|
"stylelint-plugin-license-header": "^1.0.3",
|
|
66
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript-eslint": "^8.17.0",
|
|
67
67
|
"vue-eslint-parser": "^9.4.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
71
71
|
"@types/picomatch": "^3.0.1",
|
|
72
|
-
"@typescript-eslint/utils": "^8.
|
|
73
|
-
"eslint": "^9.
|
|
72
|
+
"@typescript-eslint/utils": "^8.17.0",
|
|
73
|
+
"eslint": "^9.16.0",
|
|
74
74
|
"jest": "^29.7.0",
|
|
75
75
|
"rimraf": "^6.0.1",
|
|
76
76
|
"stylelint": "^16.11.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"eslint": "^9.10.0",
|
|
81
81
|
"jest": "^29.7.0",
|
|
82
82
|
"postcss": "^8.4.0",
|
|
83
|
-
"stylelint": "^16.
|
|
83
|
+
"stylelint": "^16.11.0",
|
|
84
84
|
"typescript": "^5.5.0",
|
|
85
85
|
"vitest": "^2.0.0"
|
|
86
86
|
},
|