@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
  import type { EnvRestrictedOptions } from "../shared/restricted.js";
3
3
  /**
4
4
  * Configuration options for the environment preset "env.browser".
@@ -17,6 +17,6 @@ export interface EnvBrowserOptions extends EnvRestrictedOptions {
17
17
  * Configuration options for the environment.
18
18
  *
19
19
  * @returns
20
- * An array of configuration objects to be added to the flat configuration.
20
+ * The configuration entries to be added to the resulting configuration array.
21
21
  */
22
- export default function browser(envOptions: EnvBrowserOptions): Linter.Config[];
22
+ export default function browser(envOptions: EnvBrowserOptions): ConfigWithExtendsArg;
@@ -1,6 +1,6 @@
1
1
  import JAVASCRIPT_GLOBALS from "globals";
2
2
  import CONFUSING_BROWSER_GLOBALS from "confusing-browser-globals";
3
- import { createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
3
+ import { createConfig, customRules } from "../shared/env-utils.js";
4
4
  import { restrictedRulesConfig } from "../shared/restricted.js";
5
5
  // constants ==================================================================
6
6
  /**
@@ -85,22 +85,23 @@ const RESTRICTED_GLOBALS = AMBIGUOUS_BROWSER_TYPES.map(name => {
85
85
  * Configuration options for the environment.
86
86
  *
87
87
  * @returns
88
- * An array of configuration objects to be added to the flat configuration.
88
+ * The configuration entries to be added to the resulting configuration array.
89
89
  */
90
90
  export default function browser(envOptions) {
91
- return createConfigArray(
92
- // register global symbols used in browser scripts
93
- createConfig("browser:globals", envOptions, {
94
- languageOptions: {
95
- globals: BROWSER_GLOBALS,
96
- },
97
- }),
98
- // generate the "no-restricted-?" rules according to passed configuration
99
- restrictedRulesConfig("browser:restricted", envOptions, {
100
- globals: RESTRICTED_GLOBALS,
101
- properties: RESTRICTED_PROPERTIES,
102
- syntax: RESTRICTED_SYNTAX,
103
- }),
104
- // custom rules
105
- customRules("browser:rules", envOptions));
91
+ return [
92
+ // register global symbols used in browser scripts
93
+ createConfig("browser:globals", envOptions, {
94
+ languageOptions: {
95
+ globals: BROWSER_GLOBALS,
96
+ },
97
+ }),
98
+ // generate the "no-restricted-?" rules according to passed configuration
99
+ restrictedRulesConfig("browser:restricted", envOptions, {
100
+ globals: RESTRICTED_GLOBALS,
101
+ properties: RESTRICTED_PROPERTIES,
102
+ syntax: RESTRICTED_SYNTAX,
103
+ }),
104
+ // custom rules
105
+ customRules("browser:rules", envOptions),
106
+ ];
106
107
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Configuration options for the environment preset "env.codecept".
5
4
  */
@@ -17,6 +16,6 @@ export interface EnvCodeceptOptions extends EnvBaseOptions {
17
16
  * Configuration options for the environment.
18
17
  *
19
18
  * @returns
20
- * An array of configuration objects to be added to the flat configuration.
19
+ * The configuration entries to be added to the resulting configuration array.
21
20
  */
22
- export default function codecept(envOptions: EnvCodeceptOptions): Linter.Config[];
21
+ export default function codecept(envOptions: EnvCodeceptOptions): ConfigWithExtendsArg;
@@ -1,6 +1,6 @@
1
1
  import codeceptPlugin from "eslint-plugin-codeceptjs";
2
2
  import chaiExpectPlugin from "eslint-plugin-chai-expect";
3
- import { createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
3
+ import { createConfig, customRules } from "../shared/env-utils.js";
4
4
  // functions ==================================================================
5
5
  /**
6
6
  * Creates configuration objects with global symbols and linter rules for E2E
@@ -14,31 +14,32 @@ import { createConfigArray, createConfig, customRules } from "../shared/env-util
14
14
  * Configuration options for the environment.
15
15
  *
16
16
  * @returns
17
- * An array of configuration objects to be added to the flat configuration.
17
+ * The configuration entries to be added to the resulting configuration array.
18
18
  */
19
19
  export default function codecept(envOptions) {
20
- return createConfigArray(
21
- // "codecept" plugin
22
- createConfig("codecept:plugin", envOptions, {
23
- // register rule implementations of the plugins
24
- plugins: {
25
- codeceptjs: codeceptPlugin,
26
- },
27
- // register global symbols of CodeceptJS
28
- languageOptions: {
29
- globals: codeceptPlugin.environments.codeceptjs.globals,
30
- },
31
- // recommended rules
32
- rules: codeceptPlugin.configs.recommended.rules,
33
- }),
34
- // "chai-expect" plugin
35
- createConfig("codecept:recommended", envOptions, chaiExpectPlugin.configs["recommended-flat"]),
36
- // custom rules
37
- customRules("codecept:rules", envOptions, {
38
- "new-cap": ["error", {
39
- capIsNewExceptions: ["After", "AfterSuite", "Before", "BeforeSuite", "Feature", "Scenario"],
40
- }],
41
- "no-restricted-properties": ["warn", { object: "Scenario", property: "todo", message: "Unexpected unimplemented test." }],
42
- "codeceptjs/no-skipped-tests": "warn",
43
- }));
20
+ return [
21
+ // "codecept" plugin
22
+ createConfig("codecept:plugin", envOptions, {
23
+ // register rule implementations of the plugins
24
+ plugins: {
25
+ codeceptjs: codeceptPlugin,
26
+ },
27
+ // register global symbols of CodeceptJS
28
+ languageOptions: {
29
+ globals: codeceptPlugin.environments.codeceptjs.globals,
30
+ },
31
+ // recommended rules
32
+ rules: codeceptPlugin.configs.recommended.rules,
33
+ }),
34
+ // "chai-expect" plugin
35
+ createConfig("codecept:recommended", envOptions, chaiExpectPlugin.configs["recommended-flat"]),
36
+ // custom rules
37
+ customRules("codecept:rules", envOptions, {
38
+ "new-cap": ["error", {
39
+ capIsNewExceptions: ["After", "AfterSuite", "Before", "BeforeSuite", "Feature", "Scenario"],
40
+ }],
41
+ "no-restricted-properties": ["warn", { object: "Scenario", property: "todo", message: "Unexpected unimplemented test." }],
42
+ "codeceptjs/no-skipped-tests": "warn",
43
+ }),
44
+ ];
44
45
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Configuration options for the environment preset "env.decorators".
5
4
  */
@@ -16,6 +15,6 @@ export interface EnvDecoratorsOptions extends EnvBaseOptions {
16
15
  * Configuration options for the environment.
17
16
  *
18
17
  * @returns
19
- * An array of configuration objects to be added to the flat configuration.
18
+ * The configuration entries to be added to the resulting configuration array.
20
19
  */
21
- export default function decorators(envOptions: EnvBaseOptions): Linter.Config[];
20
+ export default function decorators(envOptions: EnvBaseOptions): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import babelParser from "@babel/eslint-parser";
2
- import { TS_GLOB, createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
2
+ import { TS_GLOB, createConfig, customRules } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Adds support for native decorators in JavaScript source files.
@@ -12,23 +12,26 @@ import { TS_GLOB, createConfigArray, createConfig, customRules } from "../shared
12
12
  * Configuration options for the environment.
13
13
  *
14
14
  * @returns
15
- * An array of configuration objects to be added to the flat configuration.
15
+ * The configuration entries to be added to the resulting configuration array.
16
16
  */
17
17
  export default function decorators(envOptions) {
18
- return createConfigArray(createConfig("decorators:language-options", envOptions, {
19
- ignores: TS_GLOB,
20
- languageOptions: {
21
- parser: babelParser,
22
- parserOptions: {
23
- requireConfigFile: false,
24
- babelOptions: {
25
- babelrc: false,
26
- configFile: false,
27
- plugins: [
28
- ["@babel/plugin-proposal-decorators", { version: "2023-11" }],
29
- ],
18
+ return [
19
+ createConfig("decorators:language-options", envOptions, {
20
+ ignores: TS_GLOB,
21
+ languageOptions: {
22
+ parser: babelParser,
23
+ parserOptions: {
24
+ requireConfigFile: false,
25
+ babelOptions: {
26
+ babelrc: false,
27
+ configFile: false,
28
+ plugins: [
29
+ ["@babel/plugin-proposal-decorators", { version: "2023-11" }],
30
+ ],
31
+ },
30
32
  },
31
33
  },
32
- },
33
- }), customRules("decorators:rules", envOptions));
34
+ }),
35
+ customRules("decorators:rules", envOptions),
36
+ ];
34
37
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Configuration options for the environment preset "env.eslint".
5
4
  */
@@ -15,6 +14,6 @@ export interface EnvEslintOptions extends EnvBaseOptions {
15
14
  * Configuration options for the environment.
16
15
  *
17
16
  * @returns
18
- * An array of configuration objects to be added to the flat configuration.
17
+ * The configuration entries to be added to the resulting configuration array.
19
18
  */
20
- export default function eslint(envOptions: EnvEslintOptions): Linter.Config[];
19
+ export default function eslint(envOptions: EnvEslintOptions): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import eslintPlugin from "eslint-plugin-eslint-plugin";
2
- import { createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
2
+ import { createConfig, customRules } from "../shared/env-utils.js";
3
3
  // exports ====================================================================
4
4
  /**
5
5
  * Adds linter rules for ESLint plugin implementations.
@@ -11,20 +11,21 @@ import { createConfigArray, createConfig, customRules } from "../shared/env-util
11
11
  * Configuration options for the environment.
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 eslint(envOptions) {
17
- return createConfigArray(
18
- // register rule implementations and recommended rules
19
- createConfig("eslint:recommended", envOptions, eslintPlugin.configs["flat/rules-recommended"]),
20
- // custom rules
21
- customRules("eslint:rules", envOptions, {
22
- "eslint-plugin/no-meta-schema-default": "error",
23
- "eslint-plugin/no-property-in-node": "error",
24
- "eslint-plugin/prefer-placeholders": "error",
25
- "eslint-plugin/prefer-replace-text": "error",
26
- "eslint-plugin/require-meta-default-options": "error",
27
- "eslint-plugin/require-meta-docs-description": "error",
28
- "eslint-plugin/require-meta-schema-description": "error",
29
- }));
17
+ return [
18
+ // register rule implementations and recommended rules
19
+ createConfig("eslint:recommended", envOptions, eslintPlugin.configs["flat/rules-recommended"]),
20
+ // custom rules
21
+ customRules("eslint:rules", envOptions, {
22
+ "eslint-plugin/no-meta-schema-default": "error",
23
+ "eslint-plugin/no-property-in-node": "error",
24
+ "eslint-plugin/prefer-placeholders": "error",
25
+ "eslint-plugin/prefer-replace-text": "error",
26
+ "eslint-plugin/require-meta-default-options": "error",
27
+ "eslint-plugin/require-meta-docs-description": "error",
28
+ "eslint-plugin/require-meta-schema-description": "error",
29
+ }),
30
+ ];
30
31
  }
@@ -1,4 +1,4 @@
1
- import type { Linter } from "eslint";
1
+ import { type ConfigWithExtendsArg } from "../shared/env-utils.js";
2
2
  import { type EnvUnitTestOptions } from "../shared/unittest.js";
3
3
  /**
4
4
  * Configuration options for the environment preset "env.jest".
@@ -19,6 +19,6 @@ export interface EnvJestOptions extends EnvUnitTestOptions {
19
19
  * Configuration options for the environment.
20
20
  *
21
21
  * @returns
22
- * An array of configuration objects to be added to the flat configuration.
22
+ * The configuration entries to be added to the resulting configuration array.
23
23
  */
24
- export default function jest(envOptions: EnvJestOptions): Linter.Config[];
24
+ export default function jest(envOptions: EnvJestOptions): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import jestPlugin from "eslint-plugin-jest";
2
- import { JS_GLOB, createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
2
+ import { JS_GLOB, createConfig, customRules } from "../shared/env-utils.js";
3
3
  import { createUnitTestPluginConfigs } from "../shared/unittest.js";
4
4
  // functions ==================================================================
5
5
  /**
@@ -16,41 +16,42 @@ import { createUnitTestPluginConfigs } from "../shared/unittest.js";
16
16
  * Configuration options for the environment.
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 jest(envOptions) {
22
- return createConfigArray(
23
- // register rule implementations, globals, and recommended rules
24
- createConfig("jest:recommended", envOptions, jestPlugin.configs["flat/recommended"]),
25
- // add recommended stylistic rules
26
- createConfig("jest:stylistic", envOptions, jestPlugin.configs["flat/style"]),
27
- // "jest-dom" and "testing-library" plugin
28
- createUnitTestPluginConfigs("jest", envOptions),
29
- // custom rules
30
- customRules("jest:rules", envOptions, {
31
- "jest/consistent-test-it": ["error", { fn: "it" }],
32
- "jest/no-commented-out-tests": "error",
33
- "jest/no-conditional-expect": "off",
34
- "jest/no-confusing-set-timeout": "error",
35
- "jest/no-duplicate-hooks": "error",
36
- "jest/no-test-return-statement": "error",
37
- "jest/prefer-comparison-matcher": "error",
38
- "jest/prefer-equality-matcher": "error",
39
- "jest/prefer-expect-resolves": "error",
40
- "jest/prefer-hooks-on-top": "error",
41
- "jest/prefer-jest-mocked": "error",
42
- "jest/prefer-lowercase-title": "error",
43
- "jest/prefer-mock-promise-shorthand": "error",
44
- "jest/prefer-spy-on": "error",
45
- "jest/prefer-todo": "error",
46
- "jest/require-top-level-describe": "error",
47
- }),
48
- // enable "jest/unbound-method" for TS files
49
- createConfig("jest:typescript", envOptions, {
50
- ignores: JS_GLOB,
51
- rules: {
52
- "jest/unbound-method": "error",
53
- "@typescript-eslint/unbound-method": "off", // replaced by "jest/unbound-method"
54
- },
55
- }));
22
+ return [
23
+ // register rule implementations, globals, and recommended rules
24
+ createConfig("jest:recommended", envOptions, jestPlugin.configs["flat/recommended"]),
25
+ // add recommended stylistic rules
26
+ createConfig("jest:stylistic", envOptions, jestPlugin.configs["flat/style"]),
27
+ // "jest-dom" and "testing-library" plugin
28
+ createUnitTestPluginConfigs("jest", envOptions),
29
+ // custom rules
30
+ customRules("jest:rules", envOptions, {
31
+ "jest/consistent-test-it": ["error", { fn: "it" }],
32
+ "jest/no-commented-out-tests": "error",
33
+ "jest/no-conditional-expect": "off",
34
+ "jest/no-confusing-set-timeout": "error",
35
+ "jest/no-duplicate-hooks": "error",
36
+ "jest/no-test-return-statement": "error",
37
+ "jest/prefer-comparison-matcher": "error",
38
+ "jest/prefer-equality-matcher": "error",
39
+ "jest/prefer-expect-resolves": "error",
40
+ "jest/prefer-hooks-on-top": "error",
41
+ "jest/prefer-jest-mocked": "error",
42
+ "jest/prefer-lowercase-title": "error",
43
+ "jest/prefer-mock-promise-shorthand": "error",
44
+ "jest/prefer-spy-on": "error",
45
+ "jest/prefer-todo": "error",
46
+ "jest/require-top-level-describe": "error",
47
+ }),
48
+ // enable "jest/unbound-method" for TS files
49
+ createConfig("jest:typescript", envOptions, {
50
+ ignores: JS_GLOB,
51
+ rules: {
52
+ "jest/unbound-method": "error",
53
+ "@typescript-eslint/unbound-method": "off", // replaced by "jest/unbound-method"
54
+ },
55
+ }),
56
+ ];
56
57
  }
@@ -1,6 +1,5 @@
1
- import type { Linter } from "eslint";
2
1
  import type ts from "typescript";
3
- import type { LanguageOptions } from "../shared/env-utils.js";
2
+ import type { ConfigWithExtendsArg, LanguageOptions } from "../shared/env-utils.js";
4
3
  import { type EnvRestrictedOptions } from "../shared/restricted.js";
5
4
  export type EnvNodeConvertPathPattern = [pattern: string, replacement: string];
6
5
  export type EnvNodeConvertPathObject = Record<string, EnvNodeConvertPathPattern>;
@@ -45,6 +44,6 @@ export interface EnvNodeOptions extends EnvRestrictedOptions {
45
44
  * Configuration options for the environment.
46
45
  *
47
46
  * @returns
48
- * An array of configuration objects to be added to the flat configuration.
47
+ * The configuration entries to be added to the resulting configuration array.
49
48
  */
50
- export default function node(envOptions: EnvNodeOptions): Linter.Config[];
49
+ export default function node(envOptions: EnvNodeOptions): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import nodePlugin from "eslint-plugin-n";
2
- import { createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
2
+ import { createConfig, customRules } from "../shared/env-utils.js";
3
3
  import { restrictedRulesConfig } from "../shared/restricted.js";
4
4
  // functions ==================================================================
5
5
  /**
@@ -13,29 +13,30 @@ import { restrictedRulesConfig } from "../shared/restricted.js";
13
13
  * Configuration options for the environment.
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 node(envOptions) {
19
19
  // the plugin configuration key, according to source module type
20
20
  const configKey = (envOptions.sourceType === "commonjs") ? "flat/recommended-script" : "flat/recommended-module";
21
- return createConfigArray(
22
- // register rule implementations
23
- createConfig("node:recommended", envOptions, {
24
- ...nodePlugin.configs[configKey],
25
- settings: {
26
- n: {
27
- tryExtensions: [".js", ".ts", ".d.ts"], // automatically add missing extensions in imports
28
- ...envOptions.settings,
21
+ return [
22
+ // register rule implementations
23
+ createConfig("node:recommended", envOptions, {
24
+ ...nodePlugin.configs[configKey],
25
+ settings: {
26
+ n: {
27
+ tryExtensions: [".js", ".ts", ".d.ts"], // automatically add missing extensions in imports
28
+ ...envOptions.settings,
29
+ },
29
30
  },
30
- },
31
- }),
32
- // generate the "no-restricted-?" rules according to passed configuration
33
- restrictedRulesConfig("node:restricted", envOptions),
34
- // custom rules
35
- customRules("node:rules", envOptions, {
36
- "no-console": "off",
37
- "n/no-missing-import": ["error", { ignoreTypeImport: true }],
38
- "n/no-unsupported-features/node-builtins": ["error", { allowExperimental: true }],
39
- "n/prefer-node-protocol": "error",
40
- }));
31
+ }),
32
+ // generate the "no-restricted-?" rules according to passed configuration
33
+ restrictedRulesConfig("node:restricted", envOptions),
34
+ // custom rules
35
+ customRules("node:rules", envOptions, {
36
+ "no-console": "off",
37
+ "n/no-missing-import": ["error", { ignoreTypeImport: true }],
38
+ "n/no-unsupported-features/node-builtins": ["error", { allowExperimental: true }],
39
+ "n/prefer-node-protocol": "error",
40
+ }),
41
+ ];
41
42
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "../shared/env-utils.js";
3
2
  import type { SharedRuleSettings } from "../shared/rule-utils.js";
4
3
  import { type RuleNoInvalidModulesOptions } from "../rules/no-invalid-modules.js";
5
4
  import { type RuleNoInvalidHierarchyOptions } from "../rules/no-invalid-hierarchy.js";
@@ -27,6 +26,6 @@ export interface EnvProjectOptions extends EnvBaseOptions {
27
26
  * Configuration options for the environment.
28
27
  *
29
28
  * @returns
30
- * An array of configuration objects to be added to the flat configuration.
29
+ * The configuration entries to be added to the resulting configuration array.
31
30
  */
32
- export default function project(envOptions: EnvProjectOptions): Linter.Config[];
31
+ export default function project(envOptions: EnvProjectOptions): ConfigWithExtendsArg;
@@ -1,4 +1,4 @@
1
- import { createConfigArray, createConfig, customRules } from "../shared/env-utils.js";
1
+ import { createConfig, customRules } from "../shared/env-utils.js";
2
2
  import noAmdModuleDirective from "../rules/no-amd-module-directive.js";
3
3
  import noInvalidModules from "../rules/no-invalid-modules.js";
4
4
  import noInvalidHierarchy from "../rules/no-invalid-hierarchy.js";
@@ -10,31 +10,32 @@ import noInvalidHierarchy from "../rules/no-invalid-hierarchy.js";
10
10
  * Configuration options for the environment.
11
11
  *
12
12
  * @returns
13
- * An array of configuration objects to be added to the flat configuration.
13
+ * The configuration entries to be added to the resulting configuration array.
14
14
  */
15
15
  export default function project(envOptions) {
16
- return createConfigArray(
17
- // register rule implementations
18
- createConfig("project:plugin", envOptions, {
19
- plugins: {
20
- "env-project": {
21
- rules: {
22
- "no-amd-module-directive": noAmdModuleDirective,
23
- "no-invalid-modules": noInvalidModules,
24
- "no-invalid-hierarchy": noInvalidHierarchy,
25
- }, // TODO
16
+ return [
17
+ // register rule implementations
18
+ createConfig("project:plugin", envOptions, {
19
+ plugins: {
20
+ "env-project": {
21
+ rules: {
22
+ "no-amd-module-directive": noAmdModuleDirective,
23
+ "no-invalid-modules": noInvalidModules,
24
+ "no-invalid-hierarchy": noInvalidHierarchy,
25
+ }, // TODO
26
+ },
26
27
  },
27
- },
28
- settings: {
29
- "env-project": {
30
- alias: envOptions.alias,
28
+ settings: {
29
+ "env-project": {
30
+ alias: envOptions.alias,
31
+ },
31
32
  },
32
- },
33
- }),
34
- // custom rules
35
- customRules("project:rules", envOptions, {
36
- "env-project/no-amd-module-directive": "error",
37
- "env-project/no-invalid-modules": ["error", { external: envOptions.external ?? [] }],
38
- "env-project/no-invalid-hierarchy": envOptions.hierarchy ? ["error", envOptions.hierarchy] : "off",
39
- }));
33
+ }),
34
+ // custom rules
35
+ customRules("project:rules", envOptions, {
36
+ "env-project/no-amd-module-directive": "error",
37
+ "env-project/no-invalid-modules": ["error", { external: envOptions.external ?? [] }],
38
+ "env-project/no-invalid-hierarchy": envOptions.hierarchy ? ["error", envOptions.hierarchy] : "off",
39
+ }),
40
+ ];
40
41
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "../shared/env-utils.js";
3
2
  /**
4
3
  * Configuration options for the environment preset "env.react".
5
4
  */
@@ -47,6 +46,6 @@ export interface EnvReactOptions extends EnvBaseOptions {
47
46
  * Configuration options for the environment.
48
47
  *
49
48
  * @returns
50
- * An array of configuration objects to be added to the flat configuration.
49
+ * The configuration entries to be added to the resulting configuration array.
51
50
  */
52
- export default function react(envOptions: EnvReactOptions): Linter.Config[];
51
+ export default function react(envOptions: EnvReactOptions): ConfigWithExtendsArg;