@open-xchange/linter-presets 1.6.0 → 1.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/eslint/core/base.d.ts +3 -4
  3. package/dist/eslint/core/base.js +95 -94
  4. package/dist/eslint/core/directives.d.ts +3 -3
  5. package/dist/eslint/core/directives.js +4 -4
  6. package/dist/eslint/core/js.d.ts +3 -3
  7. package/dist/eslint/core/js.js +4 -4
  8. package/dist/eslint/core/jsdoc.d.ts +3 -3
  9. package/dist/eslint/core/jsdoc.js +43 -42
  10. package/dist/eslint/core/json.d.ts +3 -4
  11. package/dist/eslint/core/json.js +4 -4
  12. package/dist/eslint/core/license.d.ts +4 -4
  13. package/dist/eslint/core/license.js +5 -5
  14. package/dist/eslint/core/markdown.d.ts +1 -1
  15. package/dist/eslint/core/markdown.js +1 -1
  16. package/dist/eslint/core/packages.d.ts +3 -4
  17. package/dist/eslint/core/packages.js +16 -15
  18. package/dist/eslint/core/promises.d.ts +3 -3
  19. package/dist/eslint/core/promises.js +18 -18
  20. package/dist/eslint/core/regexp.d.ts +3 -3
  21. package/dist/eslint/core/regexp.js +4 -5
  22. package/dist/eslint/core/stylistic.d.ts +3 -4
  23. package/dist/eslint/core/stylistic.js +99 -99
  24. package/dist/eslint/core/ts.d.ts +6 -3
  25. package/dist/eslint/core/ts.js +78 -72
  26. package/dist/eslint/core/vue.d.ts +3 -4
  27. package/dist/eslint/core/vue.js +4 -4
  28. package/dist/eslint/core/yaml.d.ts +3 -4
  29. package/dist/eslint/core/yaml.js +4 -4
  30. package/dist/eslint/env/browser.d.ts +3 -3
  31. package/dist/eslint/env/browser.js +18 -17
  32. package/dist/eslint/env/codecept.d.ts +3 -4
  33. package/dist/eslint/env/codecept.js +27 -26
  34. package/dist/eslint/env/decorators.d.ts +3 -4
  35. package/dist/eslint/env/decorators.js +19 -16
  36. package/dist/eslint/env/eslint.d.ts +3 -4
  37. package/dist/eslint/env/eslint.js +16 -15
  38. package/dist/eslint/env/jest.d.ts +3 -3
  39. package/dist/eslint/env/jest.js +37 -36
  40. package/dist/eslint/env/node.d.ts +3 -4
  41. package/dist/eslint/env/node.js +22 -21
  42. package/dist/eslint/env/project.d.ts +3 -4
  43. package/dist/eslint/env/project.js +25 -24
  44. package/dist/eslint/env/react.d.ts +3 -4
  45. package/dist/eslint/env/react.js +65 -64
  46. package/dist/eslint/env/tsconfig.d.ts +3 -4
  47. package/dist/eslint/env/tsconfig.js +14 -13
  48. package/dist/eslint/env/vitest.d.ts +3 -3
  49. package/dist/eslint/env/vitest.js +54 -53
  50. package/dist/eslint/index.d.ts +26 -21
  51. package/dist/eslint/index.js +15 -13
  52. package/dist/eslint/shared/env-utils.d.ts +11 -23
  53. package/dist/eslint/shared/env-utils.js +17 -31
  54. package/dist/eslint/shared/restricted.d.ts +3 -3
  55. package/dist/eslint/shared/restricted.js +12 -11
  56. package/dist/eslint/shared/unittest.d.ts +4 -5
  57. package/dist/eslint/shared/unittest.js +21 -20
  58. package/dist/stylelint/index.d.ts +9 -6
  59. package/dist/stylelint/index.js +7 -6
  60. package/dist/utils/resolver.d.ts +20 -10
  61. package/dist/utils/resolver.js +28 -10
  62. package/dist/utils/utils.d.ts +1 -1
  63. package/dist/utils/utils.js +1 -1
  64. package/docs/eslint/README.md +3 -30
  65. package/docs/stylelint/README.md +3 -30
  66. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import type { Linter } from "eslint";
1
+ import type { ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  /**
3
3
  * Checks for correct usage of native promises.
4
4
  *
@@ -6,6 +6,6 @@ import type { Linter } from "eslint";
6
6
  * - `eslint-plugin-promise`
7
7
  *
8
8
  * @returns
9
- * An array of configuration objects to be added to the flat configuration.
9
+ * The configuration entries to be added to the resulting configuration array.
10
10
  */
11
- export default function promises(): Linter.Config[];
11
+ export default function promises(): ConfigWithExtendsArg;
@@ -1,5 +1,4 @@
1
1
  import promisePlugin from "eslint-plugin-promise";
2
- import { createConfigArray } from "../shared/env-utils.js";
3
2
  // functions ==================================================================
4
3
  /**
5
4
  * Checks for correct usage of native promises.
@@ -8,24 +7,25 @@ import { createConfigArray } from "../shared/env-utils.js";
8
7
  * - `eslint-plugin-promise`
9
8
  *
10
9
  * @returns
11
- * An array of configuration objects to be added to the flat configuration.
10
+ * The configuration entries to be added to the resulting configuration array.
12
11
  */
13
12
  export default function promises() {
14
- return createConfigArray(
15
- // register rule implementations and recommended rules
16
- {
17
- name: "promises:recommended",
18
- ...promisePlugin.configs["flat/recommended"],
19
- },
20
- // reconfigure plugin rules
21
- {
22
- name: "promises:rules",
23
- rules: {
24
- "promise/always-return": ["error", { ignoreLastCallback: true }],
25
- "promise/no-callback-in-promise": "off",
26
- "promise/no-nesting": "error", // warning => error
27
- "promise/no-return-in-finally": "error",
28
- "promise/valid-params": "error", // warning => error
13
+ return [
14
+ // register rule implementations and recommended rules
15
+ {
16
+ name: "promises:recommended",
17
+ ...promisePlugin.configs["flat/recommended"],
29
18
  },
30
- });
19
+ // reconfigure plugin rules
20
+ {
21
+ name: "promises:rules",
22
+ rules: {
23
+ "promise/always-return": ["error", { ignoreLastCallback: true }],
24
+ "promise/no-callback-in-promise": "off",
25
+ "promise/no-nesting": "error", // warning => error
26
+ "promise/no-return-in-finally": "error",
27
+ "promise/valid-params": "error", // warning => error
28
+ },
29
+ },
30
+ ];
31
31
  }
@@ -1,4 +1,4 @@
1
- import type { Linter } from "eslint";
1
+ import { type ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  /**
3
3
  * Checks the regular expressions in source files.
4
4
  *
@@ -6,6 +6,6 @@ import type { Linter } from "eslint";
6
6
  * - `eslint-plugin-regexp`
7
7
  *
8
8
  * @returns
9
- * An array of configuration objects to be added to the flat configuration.
9
+ * The configuration entries to be added to the resulting configuration array.
10
10
  */
11
- export default function regexp(): Linter.Config[];
11
+ export default function regexp(): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import * as regexpPlugin from "eslint-plugin-regexp";
2
- import { SRC_GLOB, createConfigArray } from "../shared/env-utils.js";
2
+ import { SRC_GLOB } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Checks the regular expressions in source files.
@@ -8,14 +8,13 @@ import { SRC_GLOB, createConfigArray } from "../shared/env-utils.js";
8
8
  * - `eslint-plugin-regexp`
9
9
  *
10
10
  * @returns
11
- * An array of configuration objects to be added to the flat configuration.
11
+ * The configuration entries to be added to the resulting configuration array.
12
12
  */
13
13
  export default function regexp() {
14
- return createConfigArray(
15
14
  // register rule implementations and recommended rules
16
- {
15
+ return {
17
16
  name: "regexp:recommended",
18
17
  files: SRC_GLOB,
19
18
  ...regexpPlugin.configs["flat/recommended"],
20
- });
19
+ };
21
20
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import { type StylisticConfig } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, StylisticConfig } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Defines standard (opinionated) linter rules for source code style.
5
4
  *
@@ -11,6 +10,6 @@ import { type StylisticConfig } from "../shared/env-utils.js";
11
10
  * Resolved configuration options.
12
11
  *
13
12
  * @returns
14
- * An array of configuration objects to be added to the flat configuration.
13
+ * The configuration entries to be added to the resulting configuration array.
15
14
  */
16
- export default function stylistic(stylisticConfig: StylisticConfig): Linter.Config[];
15
+ export default function stylistic(stylisticConfig: StylisticConfig): ConfigWithExtendsArg;
@@ -1,6 +1,6 @@
1
1
  import stylisticPlugin from "@stylistic/eslint-plugin";
2
2
  import migratePlugin from "@stylistic/eslint-plugin-migrate";
3
- import { createConfigArray, getCommaDangleConfig } from "../shared/env-utils.js";
3
+ import { getCommaDangleConfig } from "../shared/env-utils.js";
4
4
  // functions ==================================================================
5
5
  /**
6
6
  * Defines standard (opinionated) linter rules for source code style.
@@ -13,109 +13,109 @@ import { createConfigArray, getCommaDangleConfig } from "../shared/env-utils.js"
13
13
  * Resolved configuration options.
14
14
  *
15
15
  * @returns
16
- * An array of configuration objects to be added to the flat configuration.
16
+ * The configuration entries to be added to the resulting configuration array.
17
17
  */
18
18
  export default function stylistic(stylisticConfig) {
19
19
  // configuration properties
20
20
  const { indent, semi, quotes } = stylisticConfig;
21
- return createConfigArray(
22
- // globally disable all deprecated stylistic core rules
23
- {
24
- name: "stylistic:disable-legacy",
25
- ...stylisticPlugin.configs["disable-legacy"],
26
- },
27
- // "@stylistic" plugin
28
- {
29
- name: "stylistic:recommended",
30
- // do not lint markdown files
31
- ignores: ["**/*.md"],
32
- // register rule implementations of the plugins
33
- plugins: {
34
- "@stylistic": stylisticPlugin,
21
+ return [
22
+ // globally disable all deprecated stylistic core rules
23
+ {
24
+ name: "stylistic:disable-legacy",
25
+ ...stylisticPlugin.configs["disable-legacy"],
35
26
  },
36
- // configure plugin rules
37
- rules: {
38
- "@stylistic/array-bracket-spacing": "error",
39
- "@stylistic/arrow-spacing": "error",
40
- "@stylistic/block-spacing": "error",
41
- "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
42
- "@stylistic/comma-dangle": getCommaDangleConfig(stylisticConfig),
43
- "@stylistic/comma-spacing": "error",
44
- "@stylistic/comma-style": "error",
45
- "@stylistic/computed-property-spacing": "error",
46
- "@stylistic/eol-last": "error",
47
- "@stylistic/function-call-spacing": "error",
48
- "@stylistic/generator-star-spacing": "error",
49
- "@stylistic/indent": ["error", indent.js, { SwitchCase: 1, MemberExpression: "off", flatTernaryExpressions: true }],
50
- "@stylistic/indent-binary-ops": ["error", indent.js],
51
- "@stylistic/jsx-child-element-spacing": "error",
52
- "@stylistic/jsx-curly-brace-presence": "error",
53
- "@stylistic/jsx-curly-spacing": "error",
54
- "@stylistic/jsx-equals-spacing": "error",
55
- "@stylistic/jsx-function-call-newline": "error",
56
- "@stylistic/jsx-indent": ["error", indent.js, { checkAttributes: true, indentLogicalExpressions: true }],
57
- "@stylistic/jsx-indent-props": ["error", indent.js],
58
- "@stylistic/jsx-one-expression-per-line": "off",
59
- "@stylistic/jsx-pascal-case": "error",
60
- "@stylistic/jsx-quotes": "error",
61
- "@stylistic/jsx-self-closing-comp": "error",
62
- "@stylistic/jsx-wrap-multilines": "error",
63
- "@stylistic/key-spacing": ["error", { mode: "minimum" }],
64
- "@stylistic/keyword-spacing": "error",
65
- "@stylistic/linebreak-style": "error",
66
- "@stylistic/member-delimiter-style": "error",
67
- "@stylistic/new-parens": "error",
68
- "@stylistic/no-extra-semi": "error",
69
- "@stylistic/no-floating-decimal": "error",
70
- "@stylistic/no-mixed-operators": ["error", {
71
- groups: [
72
- // allow to mix arithmetic operators
73
- // ["+", "-", "*", "/", "%", "**"],
74
- ["&", "|", "^", "~", "<<", ">>", ">>>"],
75
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
76
- ["&&", "||"],
77
- ["in", "instanceof"],
78
- ],
79
- allowSamePrecedence: true,
80
- }],
81
- "@stylistic/no-multiple-empty-lines": ["error", { max: 2 }],
82
- "@stylistic/no-tabs": "error",
83
- "@stylistic/no-trailing-spaces": "error",
84
- "@stylistic/no-whitespace-before-property": "error",
85
- "@stylistic/object-curly-spacing": ["error", "always"],
86
- "@stylistic/quote-props": ["error", "as-needed"],
87
- "@stylistic/quotes": (quotes === "off") ? "off" : ["error", quotes, { avoidEscape: true }],
88
- "@stylistic/rest-spread-spacing": "error",
89
- "@stylistic/semi": (semi === "off") ? "off" : ["error", semi],
90
- "@stylistic/semi-spacing": "error",
91
- "@stylistic/semi-style": "error",
92
- "@stylistic/space-before-blocks": "error",
93
- "@stylistic/space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }],
94
- "@stylistic/space-in-parens": "error",
95
- "@stylistic/space-infix-ops": "error",
96
- "@stylistic/space-unary-ops": "error",
97
- "@stylistic/switch-colon-spacing": "error",
98
- "@stylistic/template-curly-spacing": "error",
99
- "@stylistic/template-tag-spacing": "error",
100
- "@stylistic/type-annotation-spacing": "error",
101
- "@stylistic/type-generic-spacing": "error",
102
- "@stylistic/type-named-tuple-spacing": "error",
103
- "@stylistic/wrap-iife": "error",
104
- "@stylistic/yield-star-spacing": "error",
27
+ // "@stylistic" plugin
28
+ {
29
+ name: "stylistic:recommended",
30
+ // do not lint markdown files
31
+ ignores: ["**/*.md"],
32
+ // register rule implementations of the plugins
33
+ plugins: {
34
+ "@stylistic": stylisticPlugin,
35
+ },
36
+ // configure plugin rules
37
+ rules: {
38
+ "@stylistic/array-bracket-spacing": "error",
39
+ "@stylistic/arrow-spacing": "error",
40
+ "@stylistic/block-spacing": "error",
41
+ "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }],
42
+ "@stylistic/comma-dangle": getCommaDangleConfig(stylisticConfig),
43
+ "@stylistic/comma-spacing": "error",
44
+ "@stylistic/comma-style": "error",
45
+ "@stylistic/computed-property-spacing": "error",
46
+ "@stylistic/eol-last": "error",
47
+ "@stylistic/function-call-spacing": "error",
48
+ "@stylistic/generator-star-spacing": "error",
49
+ "@stylistic/indent": ["error", indent.js, { SwitchCase: 1, MemberExpression: "off", flatTernaryExpressions: true }],
50
+ "@stylistic/indent-binary-ops": ["error", indent.js],
51
+ "@stylistic/jsx-child-element-spacing": "error",
52
+ "@stylistic/jsx-curly-brace-presence": "error",
53
+ "@stylistic/jsx-curly-spacing": "error",
54
+ "@stylistic/jsx-equals-spacing": "error",
55
+ "@stylistic/jsx-function-call-newline": "error",
56
+ "@stylistic/jsx-indent-props": ["error", indent.js],
57
+ "@stylistic/jsx-one-expression-per-line": "off",
58
+ "@stylistic/jsx-pascal-case": "error",
59
+ "@stylistic/jsx-quotes": "error",
60
+ "@stylistic/jsx-self-closing-comp": "error",
61
+ "@stylistic/jsx-wrap-multilines": "error",
62
+ "@stylistic/key-spacing": ["error", { mode: "minimum" }],
63
+ "@stylistic/keyword-spacing": "error",
64
+ "@stylistic/linebreak-style": "error",
65
+ "@stylistic/member-delimiter-style": "error",
66
+ "@stylistic/new-parens": "error",
67
+ "@stylistic/no-extra-semi": "error",
68
+ "@stylistic/no-floating-decimal": "error",
69
+ "@stylistic/no-mixed-operators": ["error", {
70
+ groups: [
71
+ // allow to mix arithmetic operators
72
+ // ["+", "-", "*", "/", "%", "**"],
73
+ ["&", "|", "^", "~", "<<", ">>", ">>>"],
74
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
75
+ ["&&", "||"],
76
+ ["in", "instanceof"],
77
+ ],
78
+ allowSamePrecedence: true,
79
+ }],
80
+ "@stylistic/no-multiple-empty-lines": ["error", { max: 2 }],
81
+ "@stylistic/no-tabs": "error",
82
+ "@stylistic/no-trailing-spaces": "error",
83
+ "@stylistic/no-whitespace-before-property": "error",
84
+ "@stylistic/object-curly-spacing": ["error", "always"],
85
+ "@stylistic/quote-props": ["error", "as-needed"],
86
+ "@stylistic/quotes": (quotes === "off") ? "off" : ["error", quotes, { avoidEscape: true }],
87
+ "@stylistic/rest-spread-spacing": "error",
88
+ "@stylistic/semi": (semi === "off") ? "off" : ["error", semi],
89
+ "@stylistic/semi-spacing": "error",
90
+ "@stylistic/semi-style": "error",
91
+ "@stylistic/space-before-blocks": "error",
92
+ "@stylistic/space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }],
93
+ "@stylistic/space-in-parens": "error",
94
+ "@stylistic/space-infix-ops": "error",
95
+ "@stylistic/space-unary-ops": "error",
96
+ "@stylistic/switch-colon-spacing": "error",
97
+ "@stylistic/template-curly-spacing": "error",
98
+ "@stylistic/template-tag-spacing": "error",
99
+ "@stylistic/type-annotation-spacing": "error",
100
+ "@stylistic/type-generic-spacing": "error",
101
+ "@stylistic/type-named-tuple-spacing": "error",
102
+ "@stylistic/wrap-iife": "error",
103
+ "@stylistic/yield-star-spacing": "error",
104
+ },
105
105
  },
106
- },
107
- // "@stylistic/migrate" plugin
108
- {
109
- name: "stylistic:migrate",
110
- // register rule implementations of the plugins
111
- plugins: {
112
- "@stylistic/migrate": migratePlugin,
106
+ // "@stylistic/migrate" plugin
107
+ {
108
+ name: "stylistic:migrate",
109
+ // register rule implementations of the plugins
110
+ plugins: {
111
+ "@stylistic/migrate": migratePlugin,
112
+ },
113
+ // configure plugin rules
114
+ rules: {
115
+ "@stylistic/migrate/migrate-js": "error",
116
+ "@stylistic/migrate/migrate-ts": "error",
117
+ "@stylistic/migrate/migrate-jsx": "error",
118
+ },
113
119
  },
114
- // configure plugin rules
115
- rules: {
116
- "@stylistic/migrate/migrate-js": "error",
117
- "@stylistic/migrate/migrate-ts": "error",
118
- "@stylistic/migrate/migrate-jsx": "error",
119
- },
120
- });
120
+ ];
121
121
  }
@@ -1,11 +1,14 @@
1
- import type { Linter } from "eslint";
1
+ import { type ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  /**
3
3
  * Defines standard rules for TypeScript source files.
4
4
  *
5
5
  * Wraps the following packages:
6
6
  * - `typescript-eslint`
7
7
  *
8
+ * @param rootDir
9
+ * The project root directory.
10
+ *
8
11
  * @returns
9
- * An array of configuration objects to be added to the flat configuration.
12
+ * The configuration entries to be added to the resulting configuration array.
10
13
  */
11
- export default function ts(): Linter.Config[];
14
+ export default function ts(rootDir: string): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import { configs as pluginConfigs } from "typescript-eslint";
2
- import { TS_GLOB, DTS_GLOB, NO_UNUSED_VARS_OPTIONS, createConfigArray } 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.
@@ -7,81 +7,87 @@ import { TS_GLOB, DTS_GLOB, NO_UNUSED_VARS_OPTIONS, createConfigArray } from "..
7
7
  * Wraps the following packages:
8
8
  * - `typescript-eslint`
9
9
  *
10
+ * @param rootDir
11
+ * The project root directory.
12
+ *
10
13
  * @returns
11
- * An array of configuration objects to be added to the flat configuration.
14
+ * The configuration entries to be added to the resulting configuration array.
12
15
  */
13
- export default function ts() {
16
+ export default function ts(rootDir) {
14
17
  // plugin configuration, additional rules
15
- return createConfigArray({
16
- name: "ts:recommended",
17
- files: TS_GLOB,
18
- // suppress warning for new TypeScript versions
19
- languageOptions: {
20
- parserOptions: {
21
- projectService: true,
22
- warnOnUnsupportedTypeScriptVersion: false,
18
+ return [
19
+ {
20
+ name: "ts:recommended",
21
+ files: TS_GLOB,
22
+ languageOptions: {
23
+ parserOptions: {
24
+ projectService: true,
25
+ tsconfigRootDir: rootDir,
26
+ // suppress warning for new TypeScript versions
27
+ warnOnUnsupportedTypeScriptVersion: false,
28
+ },
29
+ },
30
+ // recommended rules
31
+ extends: [
32
+ ...pluginConfigs.strictTypeChecked,
33
+ ...pluginConfigs.stylisticTypeChecked,
34
+ ],
35
+ // reconfigure plugin rules
36
+ rules: {
37
+ "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
38
+ "@typescript-eslint/consistent-indexed-object-style": "off",
39
+ "@typescript-eslint/consistent-type-exports": "error",
40
+ "@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: false }],
41
+ "@typescript-eslint/default-param-last": "error",
42
+ "@typescript-eslint/explicit-function-return-type": ["error", {
43
+ allowExpressions: true,
44
+ allowTypedFunctionExpressions: true,
45
+ allowHigherOrderFunctions: true,
46
+ allowConciseArrowFunctionExpressionsStartingWithVoid: true,
47
+ }],
48
+ "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public", overrides: { constructors: "off" } }],
49
+ "@typescript-eslint/no-confusing-void-expression": "off",
50
+ "@typescript-eslint/no-dynamic-delete": "off",
51
+ "@typescript-eslint/no-empty-function": ["error", {
52
+ allow: ["private-constructors", "protected-constructors", "decoratedFunctions", "overrideMethods"],
53
+ }],
54
+ "@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "always" }],
55
+ "@typescript-eslint/no-explicit-any": "off",
56
+ "@typescript-eslint/no-import-type-side-effects": "error",
57
+ "@typescript-eslint/no-invalid-this": "error",
58
+ "@typescript-eslint/no-invalid-void-type": "off",
59
+ "@typescript-eslint/no-loop-func": "error",
60
+ "@typescript-eslint/no-misused-spread": "error",
61
+ "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
62
+ "@typescript-eslint/no-non-null-assertion": "off",
63
+ "@typescript-eslint/no-redeclare": "error",
64
+ "@typescript-eslint/no-shadow": ["error", { ignoreOnInitialization: true }],
65
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
66
+ "@typescript-eslint/no-unnecessary-type-conversion": "error",
67
+ "@typescript-eslint/no-unnecessary-type-parameters": "off",
68
+ "@typescript-eslint/no-unsafe-declaration-merging": "off",
69
+ "@typescript-eslint/no-unused-vars": ["error", NO_UNUSED_VARS_OPTIONS],
70
+ "@typescript-eslint/parameter-properties": "error",
71
+ "@typescript-eslint/prefer-nullish-coalescing": ["error", { ignorePrimitives: true }],
72
+ "@typescript-eslint/prefer-readonly": "error",
73
+ "@typescript-eslint/prefer-reduce-type-parameter": "off",
74
+ "@typescript-eslint/restrict-template-expressions": "off",
75
+ "@typescript-eslint/return-await": ["error", "always"],
76
+ "@typescript-eslint/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
77
+ "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
23
78
  },
24
79
  },
25
- // recommended rules
26
- extends: [
27
- ...pluginConfigs.strictTypeChecked,
28
- ...pluginConfigs.stylisticTypeChecked,
29
- ],
30
- // reconfigure plugin rules
31
- rules: {
32
- "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
33
- "@typescript-eslint/consistent-indexed-object-style": "off",
34
- "@typescript-eslint/consistent-type-exports": "error",
35
- "@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: false }],
36
- "@typescript-eslint/default-param-last": "error",
37
- "@typescript-eslint/explicit-function-return-type": ["error", {
38
- allowExpressions: true,
39
- allowTypedFunctionExpressions: true,
40
- allowHigherOrderFunctions: true,
41
- allowConciseArrowFunctionExpressionsStartingWithVoid: true,
42
- }],
43
- "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public", overrides: { constructors: "off" } }],
44
- "@typescript-eslint/no-confusing-void-expression": "off",
45
- "@typescript-eslint/no-dynamic-delete": "off",
46
- "@typescript-eslint/no-empty-function": ["error", {
47
- allow: ["private-constructors", "protected-constructors", "decoratedFunctions", "overrideMethods"],
48
- }],
49
- "@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "always" }],
50
- "@typescript-eslint/no-explicit-any": "off",
51
- "@typescript-eslint/no-import-type-side-effects": "error",
52
- "@typescript-eslint/no-invalid-this": "error",
53
- "@typescript-eslint/no-invalid-void-type": "off",
54
- "@typescript-eslint/no-loop-func": "error",
55
- "@typescript-eslint/no-misused-spread": "error",
56
- "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
57
- "@typescript-eslint/no-non-null-assertion": "off",
58
- "@typescript-eslint/no-redeclare": "error",
59
- "@typescript-eslint/no-shadow": ["error", { ignoreOnInitialization: true }],
60
- "@typescript-eslint/no-unnecessary-qualifier": "error",
61
- "@typescript-eslint/no-unnecessary-type-conversion": "error",
62
- "@typescript-eslint/no-unnecessary-type-parameters": "off",
63
- "@typescript-eslint/no-unsafe-declaration-merging": "off",
64
- "@typescript-eslint/no-unused-vars": ["error", NO_UNUSED_VARS_OPTIONS],
65
- "@typescript-eslint/parameter-properties": "error",
66
- "@typescript-eslint/prefer-nullish-coalescing": ["error", { ignorePrimitives: true }],
67
- "@typescript-eslint/prefer-readonly": "error",
68
- "@typescript-eslint/prefer-reduce-type-parameter": "off",
69
- "@typescript-eslint/restrict-template-expressions": "off",
70
- "@typescript-eslint/return-await": ["error", "always"],
71
- "@typescript-eslint/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
72
- "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
73
- },
74
- },
75
- // fixes for module definition files
76
- {
77
- name: "ts:dts",
78
- files: DTS_GLOB,
79
- rules: {
80
- "no-duplicate-imports": "off", // triggers for multiple "declare" blocks in a file
81
- "no-unused-private-class-members": "off", // allow to declare private class members
82
- "@typescript-eslint/consistent-type-exports": "off",
83
- "@typescript-eslint/consistent-type-imports": ["error", { prefer: "no-type-imports", disallowTypeAnnotations: false }],
84
- "@typescript-eslint/no-extraneous-class": "off",
80
+ // fixes for module definition files
81
+ {
82
+ name: "ts:dts",
83
+ files: DTS_GLOB,
84
+ rules: {
85
+ "no-duplicate-imports": "off", // triggers for multiple "declare" blocks in a file
86
+ "no-unused-private-class-members": "off", // allow to declare private class members
87
+ "@typescript-eslint/consistent-type-exports": "off",
88
+ "@typescript-eslint/consistent-type-imports": ["error", { prefer: "no-type-imports", disallowTypeAnnotations: false }],
89
+ "@typescript-eslint/no-extraneous-class": "off",
90
+ },
85
91
  },
86
- });
92
+ ];
87
93
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { LanguageConfig, StylisticConfig } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, LanguageConfig, StylisticConfig } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Creates configuration objects with linter rules for Vue.js.
5
4
  *
@@ -13,6 +12,6 @@ import type { LanguageConfig, StylisticConfig } from "../shared/env-utils.js";
13
12
  * Resolved stylistic configuration options.
14
13
  *
15
14
  * @returns
16
- * An array of configuration objects to be added to the flat configuration.
15
+ * The configuration entries to be added to the resulting configuration array.
17
16
  */
18
- export default function vue(languageConfig: LanguageConfig, stylisticConfig: StylisticConfig): Linter.Config[];
17
+ export default function vue(languageConfig: LanguageConfig, stylisticConfig: StylisticConfig): ConfigWithExtendsArg;
@@ -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 { NO_IMPLICIT_COERCION_OPTIONS, createConfigArray, fixMissingFilesOption, convertRuleWarningsToErrors, getCommaDangleConfig } from "../shared/env-utils.js";
4
+ import { NO_IMPLICIT_COERCION_OPTIONS, fixMissingFilesOption, convertRuleWarningsToErrors, getCommaDangleConfig } from "../shared/env-utils.js";
5
5
  // functions ==================================================================
6
6
  /**
7
7
  * Creates configuration objects with linter rules for Vue.js.
@@ -16,13 +16,13 @@ import { NO_IMPLICIT_COERCION_OPTIONS, createConfigArray, fixMissingFilesOption,
16
16
  * Resolved stylistic configuration options.
17
17
  *
18
18
  * @returns
19
- * An array of configuration objects to be added to the flat configuration.
19
+ * The configuration entries to be added to the resulting configuration array.
20
20
  */
21
21
  export default function vue(languageConfig, stylisticConfig) {
22
22
  // recommended configuration of the main plugin
23
23
  const recommendedConfigs = vuePlugin.configs["flat/recommended"];
24
24
  // add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
25
- return fixMissingFilesOption(createConfigArray(
25
+ return fixMissingFilesOption(
26
26
  // use TypeScript parser for Vue files
27
27
  {
28
28
  name: "vue:language-options",
@@ -94,5 +94,5 @@ export default function vue(languageConfig, stylisticConfig) {
94
94
  "vue/space-unary-ops": "error",
95
95
  "vue/template-curly-spacing": "error",
96
96
  },
97
- }));
97
+ });
98
98
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import { type StylisticConfig } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, StylisticConfig } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Defines standard linting rules for YAML files.
5
4
  *
@@ -10,6 +9,6 @@ import { type StylisticConfig } from "../shared/env-utils.js";
10
9
  * Resolved configuration options.
11
10
  *
12
11
  * @returns
13
- * An array of configuration objects to be added to the flat configuration.
12
+ * The configuration entries to be added to the resulting configuration array.
14
13
  */
15
- export default function yaml(stylisticConfig: StylisticConfig): Linter.Config[];
14
+ export default function yaml(stylisticConfig: StylisticConfig): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import yamlPlugin from "eslint-plugin-yml";
2
- import { createConfigArray, fixMissingFilesOption } from "../shared/env-utils.js";
2
+ import { fixMissingFilesOption } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Defines standard linting rules for YAML files.
@@ -11,11 +11,11 @@ import { createConfigArray, fixMissingFilesOption } from "../shared/env-utils.js
11
11
  * Resolved configuration options.
12
12
  *
13
13
  * @returns
14
- * An array of configuration objects to be added to the flat configuration.
14
+ * The configuration entries to be added to the resulting configuration array.
15
15
  */
16
16
  export default function yaml(stylisticConfig) {
17
17
  // add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
18
- return fixMissingFilesOption(createConfigArray(
18
+ return fixMissingFilesOption(
19
19
  // register rule implementations and recommended rules
20
20
  yamlPlugin.configs["flat/recommended"],
21
21
  // reconfigure plugin rules
@@ -26,5 +26,5 @@ export default function yaml(stylisticConfig) {
26
26
  "yml/key-spacing": ["error", { mode: "minimum" }],
27
27
  "yml/require-string-key": "error",
28
28
  },
29
- }));
29
+ });
30
30
  }