@open-xchange/linter-presets 1.6.1 → 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 +10 -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 -98
  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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.7.0` – 2025-Jul-17
4
+
5
+ - added: (ESLint and StyleLint) mandatory option `root`
6
+ - added: (ESLint) configuration entries can be callback functions receiving a path resolver
7
+ - changed: (ESLint and StyleLint) option `license` can be a relative path
8
+ - removed: (ESLint and StyleLint) `createResolver` function
9
+ - fixed: (ESLint) set `tsconfigRootDir` for TypeScript plugin to fix errors in VS Code
10
+ - chore: bump dependencies
11
+
3
12
  ## `1.6.1` – 2025-Jul-16
4
13
 
5
14
  - removed: (ESLint) deprecated rule `@stylistic/jsx-indent`
@@ -9,7 +18,7 @@
9
18
  - changed: dedicated package exports `/eslint` and `/stylelint`
10
19
  - changed: (ESLint) replaced `configure` function with `defineConfig` function
11
20
  - changed: (StyleLint) replaced `configure` function with `defineConfig` function
12
- - changed: replaced `resolver` function with `createResolver` function (exported from both sub packages)
21
+ - changed: (ESLint and StyleLint) replaced `resolver` function with `createResolver` function
13
22
  - added: (ESLint) new plugin `eslint-plugin-regexp`
14
23
  - added: (ESLint) disable `no-duplicate-imports` rule in `.d.ts` files
15
24
  - chore: bump dependencies
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import { type LanguageConfig } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, LanguageConfig } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Defines standard module settings and additional rules targeting JavaScript
5
4
  * _and_ TypeScript source files.
@@ -11,6 +10,6 @@ import { type LanguageConfig } 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 base(languageConfig: LanguageConfig): Linter.Config[];
15
+ export default function base(languageConfig: LanguageConfig): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import eslintJs from "@eslint/js";
2
- import { SRC_GLOB, VUE_GLOB, NO_IMPLICIT_COERCION_OPTIONS, extGlob, createConfigArray } from "../shared/env-utils.js";
2
+ import { SRC_GLOB, VUE_GLOB, NO_IMPLICIT_COERCION_OPTIONS, extGlob } from "../shared/env-utils.js";
3
3
  import { builtinRestrictedRules } from "../shared/restricted.js";
4
4
  // functions ==================================================================
5
5
  /**
@@ -13,7 +13,7 @@ import { builtinRestrictedRules } from "../shared/restricted.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 base(languageConfig) {
19
19
  // returns language options for specific file extensions
@@ -25,98 +25,99 @@ export default function base(languageConfig) {
25
25
  languageOptions: { ecmaVersion, sourceType },
26
26
  };
27
27
  };
28
- return createConfigArray(
29
- // global linter configuration
30
- {
31
- name: "base:linter-options",
32
- linterOptions: {
33
- // report unused inline linter directives in source code
34
- reportUnusedDisableDirectives: "error",
28
+ return [
29
+ // global linter configuration
30
+ {
31
+ name: "base:linter-options",
32
+ linterOptions: {
33
+ // report unused inline linter directives in source code
34
+ reportUnusedDisableDirectives: "error",
35
+ },
35
36
  },
36
- },
37
- // ECMA version and module type for ES modules
38
- languageOptions("module", "mjs", "mts"),
39
- // ECMA version and module type for CommonJS modules
40
- languageOptions("commonjs", "cjs", "cts"),
41
- // ECMA version and module type for *.js and *.ts files
42
- languageOptions(languageConfig.sourceType, "js", "jsx", "ts", "tsx"),
43
- // configure linter rules
44
- {
45
- name: "base:rules",
46
- files: [...SRC_GLOB, ...VUE_GLOB],
47
- rules: {
48
- // enable all rules recommended by ESLint itself
49
- ...eslintJs.configs.recommended.rules,
50
- // possible problems
51
- "no-cond-assign": ["error", "except-parens"],
52
- "no-constant-binary-expression": "error",
53
- "no-constructor-return": "error",
54
- "no-control-regex": "off",
55
- "no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
56
- "no-new-native-nonconstructor": "error",
57
- "no-new-symbol": "off", // disabled in favour of "no-new-native-nonconstructor"
58
- "no-promise-executor-return": ["error", { allowVoid: true }],
59
- "no-self-compare": "error",
60
- "no-template-curly-in-string": "error",
61
- "no-unassigned-vars": "error",
62
- "no-unreachable-loop": "error",
63
- "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
64
- "no-unused-private-class-members": "error",
65
- "require-atomic-updates": "error",
66
- // suggestions
67
- "block-scoped-var": "error",
68
- curly: "error",
69
- eqeqeq: "error",
70
- "grouped-accessor-pairs": "error",
71
- "new-cap": "error",
72
- "no-alert": "error",
73
- "no-caller": "error",
74
- "no-console": "error",
75
- "no-else-return": "error",
76
- "no-empty": "off",
77
- "no-empty-static-block": "error",
78
- "no-eval": "error",
79
- "no-extend-native": "error",
80
- "no-extra-bind": "error",
81
- "no-extra-label": "error",
82
- "no-implicit-coercion": ["error", NO_IMPLICIT_COERCION_OPTIONS],
83
- "no-implied-eval": "error",
84
- "no-iterator": "error",
85
- "no-label-var": "error",
86
- "no-labels": "error",
87
- "no-lone-blocks": "error",
88
- "no-lonely-if": "error",
89
- "no-multi-str": "error",
90
- "no-new": "error",
91
- "no-new-func": "error",
92
- "no-new-wrappers": "error",
93
- "no-object-constructor": "error",
94
- "no-octal-escape": "error",
95
- "no-proto": "error",
96
- "no-return-assign": ["error", "except-parens"],
97
- "no-script-url": "error",
98
- "no-sequences": ["error", { allowInParentheses: false }],
99
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
100
- "no-unused-expressions": "error",
101
- "no-useless-assignment": "error",
102
- "no-useless-call": "error",
103
- "no-useless-computed-key": "error",
104
- "no-useless-concat": "error",
105
- "no-useless-rename": "error",
106
- "no-useless-return": "error",
107
- "no-var": "error",
108
- "object-shorthand": "error",
109
- "operator-assignment": "error",
110
- "prefer-arrow-callback": "error",
111
- "prefer-const": ["error", { destructuring: "all", ignoreReadBeforeAssign: true }],
112
- "prefer-numeric-literals": "error",
113
- "prefer-regex-literals": "error",
114
- "prefer-rest-params": "error",
115
- "prefer-spread": "error",
116
- radix: "error",
117
- "symbol-description": "error",
118
- // built-in restricted items
119
- ...builtinRestrictedRules(),
37
+ // ECMA version and module type for ES modules
38
+ languageOptions("module", "mjs", "mts"),
39
+ // ECMA version and module type for CommonJS modules
40
+ languageOptions("commonjs", "cjs", "cts"),
41
+ // ECMA version and module type for *.js and *.ts files
42
+ languageOptions(languageConfig.sourceType, "js", "jsx", "ts", "tsx"),
43
+ // configure linter rules
44
+ {
45
+ name: "base:rules",
46
+ files: [...SRC_GLOB, ...VUE_GLOB],
47
+ rules: {
48
+ // enable all rules recommended by ESLint itself
49
+ ...eslintJs.configs.recommended.rules,
50
+ // possible problems
51
+ "no-cond-assign": ["error", "except-parens"],
52
+ "no-constant-binary-expression": "error",
53
+ "no-constructor-return": "error",
54
+ "no-control-regex": "off",
55
+ "no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
56
+ "no-new-native-nonconstructor": "error",
57
+ "no-new-symbol": "off", // disabled in favour of "no-new-native-nonconstructor"
58
+ "no-promise-executor-return": ["error", { allowVoid: true }],
59
+ "no-self-compare": "error",
60
+ "no-template-curly-in-string": "error",
61
+ "no-unassigned-vars": "error",
62
+ "no-unreachable-loop": "error",
63
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
64
+ "no-unused-private-class-members": "error",
65
+ "require-atomic-updates": "error",
66
+ // suggestions
67
+ "block-scoped-var": "error",
68
+ curly: "error",
69
+ eqeqeq: "error",
70
+ "grouped-accessor-pairs": "error",
71
+ "new-cap": "error",
72
+ "no-alert": "error",
73
+ "no-caller": "error",
74
+ "no-console": "error",
75
+ "no-else-return": "error",
76
+ "no-empty": "off",
77
+ "no-empty-static-block": "error",
78
+ "no-eval": "error",
79
+ "no-extend-native": "error",
80
+ "no-extra-bind": "error",
81
+ "no-extra-label": "error",
82
+ "no-implicit-coercion": ["error", NO_IMPLICIT_COERCION_OPTIONS],
83
+ "no-implied-eval": "error",
84
+ "no-iterator": "error",
85
+ "no-label-var": "error",
86
+ "no-labels": "error",
87
+ "no-lone-blocks": "error",
88
+ "no-lonely-if": "error",
89
+ "no-multi-str": "error",
90
+ "no-new": "error",
91
+ "no-new-func": "error",
92
+ "no-new-wrappers": "error",
93
+ "no-object-constructor": "error",
94
+ "no-octal-escape": "error",
95
+ "no-proto": "error",
96
+ "no-return-assign": ["error", "except-parens"],
97
+ "no-script-url": "error",
98
+ "no-sequences": ["error", { allowInParentheses: false }],
99
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
100
+ "no-unused-expressions": "error",
101
+ "no-useless-assignment": "error",
102
+ "no-useless-call": "error",
103
+ "no-useless-computed-key": "error",
104
+ "no-useless-concat": "error",
105
+ "no-useless-rename": "error",
106
+ "no-useless-return": "error",
107
+ "no-var": "error",
108
+ "object-shorthand": "error",
109
+ "operator-assignment": "error",
110
+ "prefer-arrow-callback": "error",
111
+ "prefer-const": ["error", { destructuring: "all", ignoreReadBeforeAssign: true }],
112
+ "prefer-numeric-literals": "error",
113
+ "prefer-regex-literals": "error",
114
+ "prefer-rest-params": "error",
115
+ "prefer-spread": "error",
116
+ radix: "error",
117
+ "symbol-description": "error",
118
+ // built-in restricted items
119
+ ...builtinRestrictedRules(),
120
+ },
120
121
  },
121
- });
122
+ ];
122
123
  }
@@ -1,4 +1,4 @@
1
- import type { Linter } from "eslint";
1
+ import { type ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  /**
3
3
  * Checks inline linter directives.
4
4
  *
@@ -6,6 +6,6 @@ import type { Linter } from "eslint";
6
6
  * - `eslint-plugin-eslint-comments`
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 directives(): Linter.Config[];
11
+ export default function directives(): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import commentsPluginConfigs from "@eslint-community/eslint-plugin-eslint-comments/configs";
2
- import { SRC_GLOB, VUE_GLOB, createConfigArray } from "../shared/env-utils.js";
2
+ import { SRC_GLOB, VUE_GLOB } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Checks inline linter directives.
@@ -8,13 +8,13 @@ import { SRC_GLOB, VUE_GLOB, createConfigArray } from "../shared/env-utils.js";
8
8
  * - `eslint-plugin-eslint-comments`
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 directives() {
14
14
  // register rule implementations and recommended rules
15
- return createConfigArray({
15
+ return {
16
16
  name: "directives:recommended",
17
17
  files: [...SRC_GLOB, ...VUE_GLOB],
18
18
  ...commentsPluginConfigs.recommended,
19
- });
19
+ };
20
20
  }
@@ -1,9 +1,9 @@
1
- import type { Linter } from "eslint";
1
+ import { type ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  /**
3
3
  * Defines additional standard rules targeting JavaScript but _not_ TypeScript
4
4
  * source files.
5
5
  *
6
6
  * @returns
7
- * An array of configuration objects to be added to the flat configuration.
7
+ * The configuration entries to be added to the resulting configuration array.
8
8
  */
9
- export default function js(): Linter.Config[];
9
+ export default function js(): ConfigWithExtendsArg;
@@ -1,14 +1,14 @@
1
- import { JS_GLOB, NO_UNUSED_VARS_OPTIONS, createConfigArray } 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
5
5
  * source files.
6
6
  *
7
7
  * @returns
8
- * An array of configuration objects to be added to the flat configuration.
8
+ * The configuration entries to be added to the resulting configuration array.
9
9
  */
10
10
  export default function js() {
11
- return createConfigArray({
11
+ return {
12
12
  name: "js:recommended",
13
13
  files: JS_GLOB,
14
14
  rules: {
@@ -28,5 +28,5 @@ export default function js() {
28
28
  "prefer-promise-reject-errors": "error",
29
29
  "require-await": "error",
30
30
  },
31
- });
31
+ };
32
32
  }
@@ -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 JSDoc comments in source files.
4
4
  *
@@ -6,6 +6,6 @@ import type { Linter } from "eslint";
6
6
  * - `eslint-plugin-jsdoc`
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 jsdoc(): Linter.Config[];
11
+ export default function jsdoc(): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import jsdocPlugin from "eslint-plugin-jsdoc";
2
- import { TS_GLOB, SRC_GLOB, createConfigArray } from "../shared/env-utils.js";
2
+ import { TS_GLOB, SRC_GLOB } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Checks the JSDoc comments in source files.
@@ -8,52 +8,53 @@ import { TS_GLOB, SRC_GLOB, createConfigArray } from "../shared/env-utils.js";
8
8
  * - `eslint-plugin-jsdoc`
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 jsdoc() {
14
- return createConfigArray(
15
- // register rule implementations and recommended rules
16
- {
17
- name: "jsdoc:recommended",
18
- files: SRC_GLOB,
19
- ...jsdocPlugin.configs["flat/recommended-error"],
20
- },
21
- // general configuration
22
- {
23
- name: "jsdoc:settings",
24
- settings: {
25
- jsdoc: {
26
- tagNamePreference: {
27
- // disallowed tags for ES6 keywords `const`, `class`, `extends`
28
- augments: false,
29
- class: false,
30
- const: false,
31
- constant: false,
32
- constructor: false,
33
- extends: false,
14
+ return [
15
+ // register rule implementations and recommended rules
16
+ {
17
+ name: "jsdoc:recommended",
18
+ files: SRC_GLOB,
19
+ ...jsdocPlugin.configs["flat/recommended-error"],
20
+ },
21
+ // general configuration
22
+ {
23
+ name: "jsdoc:settings",
24
+ settings: {
25
+ jsdoc: {
26
+ tagNamePreference: {
27
+ // disallowed tags for ES6 keywords `const`, `class`, `extends`
28
+ augments: false,
29
+ class: false,
30
+ const: false,
31
+ constant: false,
32
+ constructor: false,
33
+ extends: false,
34
+ },
34
35
  },
35
36
  },
36
37
  },
37
- },
38
- // overrides for TypeScript files
39
- {
40
- name: "jsdoc:typescript",
41
- files: TS_GLOB,
42
- rules: {
43
- ...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
44
- "jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
38
+ // overrides for TypeScript files
39
+ {
40
+ name: "jsdoc:typescript",
41
+ files: TS_GLOB,
42
+ rules: {
43
+ ...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
44
+ "jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
45
+ },
45
46
  },
46
- },
47
- // configure plugin rules
48
- {
49
- name: "jsdoc:rules",
50
- files: SRC_GLOB,
51
- rules: {
52
- "jsdoc/check-template-names": "error",
53
- "jsdoc/require-asterisk-prefix": "error",
54
- "jsdoc/require-template": ["error", { requireSeparateTemplates: true }],
55
- "jsdoc/require-throws": "error",
56
- "jsdoc/tag-lines": "off",
47
+ // configure plugin rules
48
+ {
49
+ name: "jsdoc:rules",
50
+ files: SRC_GLOB,
51
+ rules: {
52
+ "jsdoc/check-template-names": "error",
53
+ "jsdoc/require-asterisk-prefix": "error",
54
+ "jsdoc/require-template": ["error", { requireSeparateTemplates: true }],
55
+ "jsdoc/require-throws": "error",
56
+ "jsdoc/tag-lines": "off",
57
+ },
57
58
  },
58
- });
59
+ ];
59
60
  }
@@ -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 JSON 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 json(stylisticConfig: StylisticConfig): Linter.Config[];
14
+ export default function json(stylisticConfig: StylisticConfig): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import jsonPlugin from "eslint-plugin-jsonc";
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 JSON 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 json(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
  jsonPlugin.configs["flat/recommended-with-json"],
21
21
  // reconfigure plugin rules
@@ -35,5 +35,5 @@ export default function json(stylisticConfig) {
35
35
  rules: {
36
36
  "jsonc/no-comments": "off",
37
37
  },
38
- }));
38
+ });
39
39
  }
@@ -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 existence of license headers in source files.
4
4
  *
@@ -6,9 +6,9 @@ import type { Linter } from "eslint";
6
6
  * - `eslint-plugin-license-header`
7
7
  *
8
8
  * @param path
9
- * Path to the template file containing the license header.
9
+ * Absolute path to the template file containing the license header.
10
10
  *
11
11
  * @returns
12
- * An array of configuration objects to be added to the flat configuration.
12
+ * The configuration entries to be added to the resulting configuration array.
13
13
  */
14
- export default function license(path: string): Linter.Config[];
14
+ export default function license(path: string): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import licensePlugin from "eslint-plugin-license-header";
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 existence of license headers in source files.
@@ -8,13 +8,13 @@ import { SRC_GLOB, createConfigArray } from "../shared/env-utils.js";
8
8
  * - `eslint-plugin-license-header`
9
9
  *
10
10
  * @param path
11
- * Path to the template file containing the license header.
11
+ * Absolute path to the template file containing the license header.
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 license(path) {
17
- return createConfigArray({
17
+ return {
18
18
  name: "license:recommended",
19
19
  files: SRC_GLOB,
20
20
  // register rule implementations of the plugin
@@ -25,5 +25,5 @@ export default function license(path) {
25
25
  rules: {
26
26
  "license-header/header": ["error", path],
27
27
  },
28
- });
28
+ };
29
29
  }
@@ -6,6 +6,6 @@ import type { Linter } from "eslint";
6
6
  * - `@eslint/markdown`
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
11
  export default function markdown(): Linter.Config[];
@@ -7,7 +7,7 @@ import markdownPlugin from "@eslint/markdown";
7
7
  * - `@eslint/markdown`
8
8
  *
9
9
  * @returns
10
- * An array of configuration objects to be added to the flat configuration.
10
+ * The configuration entries to be added to the resulting configuration array.
11
11
  */
12
12
  export default function markdown() {
13
13
  return markdownPlugin.configs.recommended;
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import { type PackagesConfig } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, PackagesConfig } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Defines linting rules for outdated or unneeded external dependencies.
5
4
  *
@@ -10,6 +9,6 @@ import { type PackagesConfig } 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 packages(packagesConfig: PackagesConfig): Linter.Config[];
14
+ export default function packages(packagesConfig: PackagesConfig): ConfigWithExtendsArg;
@@ -1,5 +1,4 @@
1
1
  import * as dependPlugin from "eslint-plugin-depend";
2
- import { createConfigArray } from "../shared/env-utils.js";
3
2
  // functions ==================================================================
4
3
  /**
5
4
  * Defines linting rules for outdated or unneeded external dependencies.
@@ -11,21 +10,23 @@ import { createConfigArray } 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
15
  export default function packages(packagesConfig) {
17
- return createConfigArray(
18
- // register rule implementations and recommended rules
19
- {
20
- name: "packages:recommended",
21
- ...dependPlugin.configs["flat/recommended"],
22
- }, {
23
- name: "packages:rules",
24
- rules: {
25
- "depend/ban-dependencies": ["error", {
26
- modules: packagesConfig.banned,
27
- allowed: packagesConfig.allowed,
28
- }],
16
+ return [
17
+ // register rule implementations and recommended rules
18
+ {
19
+ name: "packages:recommended",
20
+ ...dependPlugin.configs["flat/recommended"],
29
21
  },
30
- });
22
+ {
23
+ name: "packages:rules",
24
+ rules: {
25
+ "depend/ban-dependencies": ["error", {
26
+ modules: packagesConfig.banned,
27
+ allowed: packagesConfig.allowed,
28
+ }],
29
+ },
30
+ },
31
+ ];
31
32
  }