@workleap/eslint-configs 1.0.0 → 1.1.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 +12 -0
  2. package/dist/by-project-type/defineMonorepoWorkspaceConfig.d.ts +2 -2
  3. package/dist/by-project-type/defineMonorepoWorkspaceConfig.js +10 -10
  4. package/dist/by-project-type/defineMonorepoWorkspaceConfig.js.map +1 -1
  5. package/dist/by-project-type/defineReactLibraryConfig.d.ts +3 -2
  6. package/dist/by-project-type/defineReactLibraryConfig.js +29 -24
  7. package/dist/by-project-type/defineReactLibraryConfig.js.map +1 -1
  8. package/dist/by-project-type/defineTypescriptLibraryConfig.d.ts +3 -2
  9. package/dist/by-project-type/defineTypescriptLibraryConfig.js +21 -16
  10. package/dist/by-project-type/defineTypescriptLibraryConfig.js.map +1 -1
  11. package/dist/by-project-type/defineWebApplicationConfig.d.ts +3 -2
  12. package/dist/by-project-type/defineWebApplicationConfig.js +29 -24
  13. package/dist/by-project-type/defineWebApplicationConfig.js.map +1 -1
  14. package/dist/core.d.ts +1 -1
  15. package/dist/core.js +2 -2
  16. package/dist/core.js.map +1 -1
  17. package/dist/index.d.ts +10 -10
  18. package/dist/index.js +41 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/jest.d.ts +2 -1
  21. package/dist/jest.js +7 -3
  22. package/dist/jest.js.map +1 -1
  23. package/dist/json.d.ts +1 -1
  24. package/dist/json.js +2 -2
  25. package/dist/json.js.map +1 -1
  26. package/dist/jsxAlly.d.ts +1 -1
  27. package/dist/jsxAlly.js +2 -2
  28. package/dist/jsxAlly.js.map +1 -1
  29. package/dist/packageJson.d.ts +1 -1
  30. package/dist/packageJson.js +2 -2
  31. package/dist/packageJson.js.map +1 -1
  32. package/dist/react.d.ts +1 -1
  33. package/dist/react.js +2 -2
  34. package/dist/react.js.map +1 -1
  35. package/dist/storybook.d.ts +1 -1
  36. package/dist/storybook.js +2 -2
  37. package/dist/storybook.js.map +1 -1
  38. package/dist/testingLibrary.d.ts +1 -1
  39. package/dist/testingLibrary.js +2 -2
  40. package/dist/testingLibrary.js.map +1 -1
  41. package/dist/typescript.d.ts +2 -2
  42. package/dist/typescript.js +2 -2
  43. package/dist/typescript.js.map +1 -1
  44. package/dist/vitest.d.ts +2 -1
  45. package/dist/vitest.js +6 -3
  46. package/dist/vitest.js.map +1 -1
  47. package/dist/yaml.d.ts +1 -1
  48. package/dist/yaml.js +2 -2
  49. package/dist/yaml.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/by-project-type/defineMonorepoWorkspaceConfig.ts +11 -11
  52. package/src/by-project-type/defineReactLibraryConfig.ts +31 -23
  53. package/src/by-project-type/defineTypescriptLibraryConfig.ts +23 -15
  54. package/src/by-project-type/defineWebApplicationConfig.ts +31 -90
  55. package/src/core.ts +1 -1
  56. package/src/index.ts +10 -10
  57. package/src/jest.ts +8 -1
  58. package/src/json.ts +1 -1
  59. package/src/jsxAlly.ts +1 -1
  60. package/src/packageJson.ts +1 -1
  61. package/src/react.ts +1 -1
  62. package/src/storybook.ts +1 -1
  63. package/src/testingLibrary.ts +1 -1
  64. package/src/typescript.ts +2 -2
  65. package/src/vitest.ts +7 -1
  66. package/src/yaml.ts +1 -1
@@ -1,15 +1,15 @@
1
1
  import { defineConfig, globalIgnores } from "eslint/config";
2
- import { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from "../core.ts";
3
- import { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
4
- import { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
5
- import { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
6
- import { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
2
+ import { type CoreConfigOptions, coreGlobalIgnores, defineCoreConfig } from "../core.ts";
3
+ import { defineJsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
4
+ import { definePackageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
5
+ import { defineTypeScriptConfig, type TypeScriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
6
+ import { defineYamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
7
7
 
8
8
  export interface DefineMonorepoWorkspaceConfigOptions {
9
9
  core?: CoreConfigOptions;
10
10
  json?: JsonConfigOptions;
11
11
  packageJson?: PackageJsonConfigOptions;
12
- typescript?: TypescriptConfigOptions;
12
+ typescript?: TypeScriptConfigOptions;
13
13
  yaml?: YamlConfigOptions;
14
14
  }
15
15
 
@@ -37,11 +37,11 @@ export function defineMonorepoWorkspaceConfig(tsconfigRootDir: string, options:
37
37
  ...typescriptGlobalIgnores,
38
38
  ...yamlGlobalIgnores
39
39
  ]),
40
- ...coreConfig(core),
41
- ...jsonConfig(json),
42
- ...packageJsonConfig(packageJson),
43
- ...typescriptConfig(tsconfigRootDir, typescript),
44
- ...yamlConfig(yaml),
40
+ ...defineCoreConfig(core),
41
+ ...defineJsonConfig(json),
42
+ ...definePackageJsonConfig(packageJson),
43
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
44
+ ...defineYamlConfig(yaml),
45
45
  {
46
46
  rules: {
47
47
  "package-json/valid-version": "off"
@@ -1,18 +1,19 @@
1
1
  import { defineConfig, globalIgnores } from "eslint/config";
2
- import { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from "../core.ts";
3
- import { jestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
- import { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
- import { jsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from "../jsxAlly.ts";
6
- import { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
2
+ import { type CoreConfigOptions, coreGlobalIgnores, defineCoreConfig } from "../core.ts";
3
+ import { defineJestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
+ import { defineJsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
+ import { defineJsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from "../jsxAlly.ts";
6
+ import { definePackageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
7
7
  import { WorkleapPlugin } from "../plugins/workleapPlugin.ts";
8
- import { reactConfig, type ReactConfigOptions, reactGlobalIgnores } from "../react.ts";
9
- import { storybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from "../storybook.ts";
10
- import { testingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from "../testingLibrary.ts";
11
- import { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
12
- import { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
13
- import { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
8
+ import { defineReactConfig, type ReactConfigOptions, reactGlobalIgnores } from "../react.ts";
9
+ import { defineStorybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from "../storybook.ts";
10
+ import { defineTestingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from "../testingLibrary.ts";
11
+ import { defineTypeScriptConfig, type TypeScriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
12
+ import { defineVitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
13
+ import { defineYamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
14
14
 
15
15
  export interface DefineReactLibraryConfigOptions {
16
+ testFramework?: "vitest" | "jest";
16
17
  core?: CoreConfigOptions;
17
18
  jest?: JestConfigOptions;
18
19
  json?: JsonConfigOptions;
@@ -21,7 +22,7 @@ export interface DefineReactLibraryConfigOptions {
21
22
  react?: ReactConfigOptions;
22
23
  storybook?: StorybookConfigOptions;
23
24
  testingLibrary?: TestingLibraryConfigOptions;
24
- typescript?: TypescriptConfigOptions;
25
+ typescript?: TypeScriptConfigOptions;
25
26
  vitest?: VitestConfigOptions;
26
27
  yaml?: YamlConfigOptions;
27
28
  }
@@ -32,6 +33,7 @@ export interface DefineReactLibraryConfigOptions {
32
33
  */
33
34
  export function defineReactLibraryConfig(tsconfigRootDir: string, options: DefineReactLibraryConfigOptions = {}) {
34
35
  const {
36
+ testFramework = "vitest",
35
37
  core,
36
38
  jest,
37
39
  json,
@@ -63,19 +65,25 @@ export function defineReactLibraryConfig(tsconfigRootDir: string, options: Defin
63
65
  ...vitestGlobalIgnores,
64
66
  ...yamlGlobalIgnores
65
67
  ]),
66
- ...coreConfig(core),
67
- ...jestConfig(jest),
68
- ...jsonConfig(json),
69
- ...jsxAllyConfig(jsxAlly),
70
- ...packageJsonConfig(packageJson),
71
- ...reactConfig(react),
72
- ...storybookConfig(storybook),
73
- ...testingLibraryConfig(testingLibrary),
74
- ...typescriptConfig(tsconfigRootDir, typescript),
68
+ ...defineCoreConfig(core),
69
+ ...defineJestConfig({
70
+ ...jest,
71
+ enabled: jest?.enabled ?? testFramework === "jest"
72
+ }),
73
+ ...defineJsonConfig(json),
74
+ ...defineJsxAllyConfig(jsxAlly),
75
+ ...definePackageJsonConfig(packageJson),
76
+ ...defineReactConfig(react),
77
+ ...defineStorybookConfig(storybook),
78
+ ...defineTestingLibraryConfig(testingLibrary),
79
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
75
80
  // Temporary fix until the vitest plugin support defineConfig and the types are fixed.
81
+ ...(defineVitestConfig({
82
+ ...vitest,
83
+ enabled: vitest?.enabled ?? testFramework === "vitest"
76
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
- ...(vitestConfig(vitest) as any),
78
- ...yamlConfig(yaml),
85
+ }) as any),
86
+ ...defineYamlConfig(yaml),
79
87
  {
80
88
  plugins: {
81
89
  "@workleap": WorkleapPlugin
@@ -1,16 +1,17 @@
1
1
  import { defineConfig, globalIgnores } from "eslint/config";
2
- import { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from "../core.ts";
3
- import { jestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
- import { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
- import { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
2
+ import { type CoreConfigOptions, coreGlobalIgnores, defineCoreConfig } from "../core.ts";
3
+ import { defineJestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
+ import { defineJsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
+ import { definePackageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
6
6
  import { WorkleapPlugin } from "../plugins/workleapPlugin.ts";
7
- import { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
8
- import { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
9
- import { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
7
+ import { defineTypeScriptConfig, type TypeScriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
8
+ import { defineVitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
9
+ import { defineYamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
10
10
 
11
11
  export interface DefineTypeScriptLibraryConfigOptions {
12
+ testFramework?: "vitest" | "jest";
12
13
  core?: CoreConfigOptions;
13
- typescript?: TypescriptConfigOptions;
14
+ typescript?: TypeScriptConfigOptions;
14
15
  jest?: JestConfigOptions;
15
16
  json?: JsonConfigOptions;
16
17
  vitest?: VitestConfigOptions;
@@ -24,6 +25,7 @@ export interface DefineTypeScriptLibraryConfigOptions {
24
25
  */
25
26
  export function defineTypeScriptLibraryConfig(tsconfigRootDir: string, options: DefineTypeScriptLibraryConfigOptions = {}) {
26
27
  const {
28
+ testFramework = "vitest",
27
29
  core,
28
30
  jest,
29
31
  json,
@@ -47,15 +49,21 @@ export function defineTypeScriptLibraryConfig(tsconfigRootDir: string, options:
47
49
  ...vitestGlobalIgnores,
48
50
  ...yamlGlobalIgnores
49
51
  ]),
50
- ...coreConfig(core),
51
- ...jestConfig(jest),
52
- ...jsonConfig(json),
53
- ...packageJsonConfig(packageJson),
54
- ...typescriptConfig(tsconfigRootDir, typescript),
52
+ ...defineCoreConfig(core),
53
+ ...defineJestConfig({
54
+ ...jest,
55
+ enabled: jest?.enabled ?? testFramework === "jest"
56
+ }),
57
+ ...defineJsonConfig(json),
58
+ ...definePackageJsonConfig(packageJson),
59
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
55
60
  // Temporary fix until the vitest plugin support defineConfig and the types are fixed.
61
+ ...(defineVitestConfig({
62
+ ...vitest,
63
+ enabled: vitest?.enabled ?? testFramework === "vitest"
56
64
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
- ...(vitestConfig(vitest) as any),
58
- ...yamlConfig(yaml),
65
+ }) as any),
66
+ ...defineYamlConfig(yaml),
59
67
  {
60
68
  plugins: {
61
69
  "@workleap": WorkleapPlugin
@@ -1,85 +1,19 @@
1
1
  import { defineConfig, globalIgnores } from "eslint/config";
2
- import { coreConfig, type CoreConfigOptions, coreGlobalIgnores } from "../core.ts";
3
- import { jestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
- import { jsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
- import { jsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from "../jsxAlly.ts";
6
- import { packageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
2
+ import { type CoreConfigOptions, coreGlobalIgnores, defineCoreConfig } from "../core.ts";
3
+ import { defineJestConfig, type JestConfigOptions, jestGlobalIgnores } from "../jest.ts";
4
+ import { defineJsonConfig, JsonConfigOptions, jsonGlobalIgnores } from "../json.ts";
5
+ import { defineJsxAllyConfig, type JsxAllyConfigOptions, jsxAllyGlobalIgnores } from "../jsxAlly.ts";
6
+ import { definePackageJsonConfig, type PackageJsonConfigOptions, packageJsonGlobalIgnores } from "../packageJson.ts";
7
7
  import { WorkleapPlugin } from "../plugins/workleapPlugin.ts";
8
- import { reactConfig, type ReactConfigOptions, reactGlobalIgnores } from "../react.ts";
9
- import { storybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from "../storybook.ts";
10
- import { testingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from "../testingLibrary.ts";
11
- import { typescriptConfig, type TypescriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
12
- import { vitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
13
- import { yamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
14
-
15
- /*
16
-
17
- The WHY for the interface instead of using nested "extends".
18
-
19
- 1- ESlint flat config doesn't support nested "extends":
20
-
21
- Each configuration object may have an extends key, but only at the top level — not inside another config that already came from an extends.
22
-
23
- Flat config was designed to be explicitly ordered and fully expanded:
24
-
25
- - "extends" in flat config is syntactic sugar for concatenating multiple config objects.
26
- - Allowing recursion would make config evaluation order ambiguous and slow.
27
-
28
- So ESLint enforces a one-level-deep rule:
29
-
30
- - only a top-level config object can have extends.
31
-
32
- 2- Each object in the array is evaluated independently. "plugins" declared in one object are not inherited by the next object.
33
- So when a second object sets the rule using a plugin "xyz", it doesn’t "see" the plugin "xyz" that’s defined inside a predefine config, and ESLint throws.
34
-
35
- 3- Trying to redefine a plugin that as already been define in a configuration object will throw: Cannot redefine plugin "xyz".
36
-
37
- */
38
-
39
- /*
40
-
41
- error Parsing error: C:\Dev\workleap\wl-web-configs\samples\storybook\rsbuild\.storybook\main.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject
42
-
43
- -> It usually means that the project tsconfig.json file cannot find the specified file
44
- -> Make sure to clear the ESLint cache after such an error because update the tsconfig.json file doesn't invalidate the ESLint cache
45
-
46
- */
47
-
48
- /*
49
-
50
- import { defineConfig, globalIgnores } from "eslint/config";
51
- import { defineReactLibraryConfig } from "@workleap/eslint-configs";
52
-
53
- export default defineConfig([
54
- globalIgnores([
55
- "/reports/**"
56
- ]),
57
- defineReactLibraryConfig(import.meta.dirname)
58
- ]);
59
-
60
- */
61
-
62
- /*
63
-
64
- The key insight was that ESLint 9's flat config system requires ignores to be specified in the configuration
65
- file itself for optimal performance, rather than relying on CLI flags (--ignore-pattern). The ignores array at the beginning of the
66
- config ensures files are filtered out during the file discovery phase, not after.
67
-
68
- */
69
-
70
- /*
71
-
72
- Document the React compiler setting
73
-
74
- */
75
-
76
- /*
77
-
78
- - Document how to extend the rules
79
-
80
- */
8
+ import { defineReactConfig, type ReactConfigOptions, reactGlobalIgnores } from "../react.ts";
9
+ import { defineStorybookConfig, type StorybookConfigOptions, storybookGlobalIgnores } from "../storybook.ts";
10
+ import { defineTestingLibraryConfig, type TestingLibraryConfigOptions, testingLibraryGlobalIgnores } from "../testingLibrary.ts";
11
+ import { defineTypeScriptConfig, type TypeScriptConfigOptions, typescriptGlobalIgnores } from "../typescript.ts";
12
+ import { defineVitestConfig, type VitestConfigOptions, vitestGlobalIgnores } from "../vitest.ts";
13
+ import { defineYamlConfig, type YamlConfigOptions, yamlGlobalIgnores } from "../yaml.ts";
81
14
 
82
15
  export interface DefineWebApplicationConfigOptions {
16
+ testFramework?: "vitest" | "jest";
83
17
  core?: CoreConfigOptions;
84
18
  jest?: JestConfigOptions;
85
19
  json?: JsonConfigOptions;
@@ -88,7 +22,7 @@ export interface DefineWebApplicationConfigOptions {
88
22
  react?: ReactConfigOptions;
89
23
  storybook?: StorybookConfigOptions;
90
24
  testingLibrary?: TestingLibraryConfigOptions;
91
- typescript?: TypescriptConfigOptions;
25
+ typescript?: TypeScriptConfigOptions;
92
26
  vitest?: VitestConfigOptions;
93
27
  yaml?: YamlConfigOptions;
94
28
  }
@@ -99,6 +33,7 @@ export interface DefineWebApplicationConfigOptions {
99
33
  */
100
34
  export const defineWebApplicationConfig = (tsconfigRootDir: string, options: DefineWebApplicationConfigOptions = {}) => {
101
35
  const {
36
+ testFramework = "vitest",
102
37
  core,
103
38
  jest,
104
39
  json,
@@ -130,19 +65,25 @@ export const defineWebApplicationConfig = (tsconfigRootDir: string, options: Def
130
65
  ...vitestGlobalIgnores,
131
66
  ...yamlGlobalIgnores
132
67
  ]),
133
- ...coreConfig(core),
134
- ...jestConfig(jest),
135
- ...jsonConfig(json),
136
- ...jsxAllyConfig(jsxAlly),
137
- ...packageJsonConfig(packageJson),
138
- ...reactConfig(react),
139
- ...storybookConfig(storybook),
140
- ...testingLibraryConfig(testingLibrary),
141
- ...typescriptConfig(tsconfigRootDir, typescript),
68
+ ...defineCoreConfig(core),
69
+ ...defineJestConfig({
70
+ ...jest,
71
+ enabled: jest?.enabled ?? testFramework === "jest"
72
+ }),
73
+ ...defineJsonConfig(json),
74
+ ...defineJsxAllyConfig(jsxAlly),
75
+ ...definePackageJsonConfig(packageJson),
76
+ ...defineReactConfig(react),
77
+ ...defineStorybookConfig(storybook),
78
+ ...defineTestingLibraryConfig(testingLibrary),
79
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
142
80
  // Temporary fix until the vitest plugin support defineConfig and the types are fixed.
81
+ ...(defineVitestConfig({
82
+ ...vitest,
83
+ enabled: vitest?.enabled ?? testFramework === "vitest"
143
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
- ...(vitestConfig(vitest) as any),
145
- ...yamlConfig(yaml),
85
+ }) as any),
86
+ ...defineYamlConfig(yaml),
146
87
  {
147
88
  plugins: {
148
89
  "@workleap": WorkleapPlugin
package/src/core.ts CHANGED
@@ -10,7 +10,7 @@ export interface CoreConfigOptions {
10
10
 
11
11
  export const coreGlobalIgnores = [];
12
12
 
13
- export function coreConfig(options: CoreConfigOptions = {}) {
13
+ export function defineCoreConfig(options: CoreConfigOptions = {}) {
14
14
  const {
15
15
  rules
16
16
  } = options;
package/src/index.ts CHANGED
@@ -2,15 +2,15 @@ export { defineMonorepoWorkspaceConfig, type DefineMonorepoWorkspaceConfigOption
2
2
  export { defineReactLibraryConfig, type DefineReactLibraryConfigOptions } from "./by-project-type/defineReactLibraryConfig.ts";
3
3
  export { defineTypeScriptLibraryConfig, type DefineTypeScriptLibraryConfigOptions } from "./by-project-type/defineTypescriptLibraryConfig.ts";
4
4
  export { defineWebApplicationConfig, type DefineWebApplicationConfigOptions } from "./by-project-type/defineWebApplicationConfig.ts";
5
- export type { CoreConfigOptions } from "./core.ts";
6
- export type { JestConfigOptions } from "./jest.ts";
7
- export type { JsxAllyConfigOptions } from "./jsxAlly.ts";
8
- export type { PackageJsonConfigOptions } from "./packageJson.ts";
9
- export type { ReactConfigOptions } from "./react.ts";
10
- export type { StorybookConfigOptions } from "./storybook.ts";
11
- export type { TestingLibraryConfigOptions } from "./testingLibrary.ts";
5
+ export { defineCoreConfig, type CoreConfigOptions } from "./core.ts";
6
+ export { defineJestConfig, type JestConfigOptions } from "./jest.ts";
7
+ export { defineJsxAllyConfig, type JsxAllyConfigOptions } from "./jsxAlly.ts";
8
+ export { definePackageJsonConfig, type PackageJsonConfigOptions } from "./packageJson.ts";
9
+ export { defineReactConfig, type ReactConfigOptions } from "./react.ts";
10
+ export { defineStorybookConfig, type StorybookConfigOptions } from "./storybook.ts";
11
+ export { defineTestingLibraryConfig, type TestingLibraryConfigOptions } from "./testingLibrary.ts";
12
12
  export type { ConfigWithExtends, ExtendsElement, InfiniteArray, SimpleExtendsElement } from "./types.ts";
13
- export type { TypescriptConfigOptions } from "./typescript.ts";
14
- export type { VitestConfigOptions } from "./vitest.ts";
15
- export type { YamlConfigOptions } from "./yaml.ts";
13
+ export { defineTypeScriptConfig, type TypeScriptConfigOptions } from "./typescript.ts";
14
+ export { defineVitestConfig, type VitestConfigOptions } from "./vitest.ts";
15
+ export { defineYamlConfig, type YamlConfigOptions } from "./yaml.ts";
16
16
 
package/src/jest.ts CHANGED
@@ -4,16 +4,22 @@ import globals from "globals";
4
4
  import type { ConfigWithExtends } from "./types.ts";
5
5
 
6
6
  export interface JestConfigOptions {
7
+ enabled?: boolean;
7
8
  rules?: Partial<Linter.RulesRecord>;
8
9
  }
9
10
 
10
11
  export const jestGlobalIgnores = [];
11
12
 
12
- export function jestConfig(options: JestConfigOptions = {}) {
13
+ export function defineJestConfig(options: JestConfigOptions = {}) {
13
14
  const {
15
+ enabled = false,
14
16
  rules = {}
15
17
  } = options;
16
18
 
19
+ if (!enabled) {
20
+ return [];
21
+ }
22
+
17
23
  const config: ConfigWithExtends[] = [{
18
24
  name: "@workleap/eslint-configs/jest",
19
25
  files: [
@@ -40,6 +46,7 @@ export function jestConfig(options: JestConfigOptions = {}) {
40
46
  }
41
47
  },
42
48
  rules: {
49
+ "jest/no-commented-out-tests": "off",
43
50
  // Gives better failure messages for array checks.
44
51
  "jest/prefer-to-contain": "error",
45
52
  // Prefer spies to allow for automatic restoration.
package/src/json.ts CHANGED
@@ -8,7 +8,7 @@ export interface JsonConfigOptions {
8
8
 
9
9
  export const jsonGlobalIgnores = [];
10
10
 
11
- export function jsonConfig(options: JsonConfigOptions = {}) {
11
+ export function defineJsonConfig(options: JsonConfigOptions = {}) {
12
12
  const {
13
13
  rules = {}
14
14
  } = options;
package/src/jsxAlly.ts CHANGED
@@ -8,7 +8,7 @@ export interface JsxAllyConfigOptions {
8
8
 
9
9
  export const jsxAllyGlobalIgnores = [];
10
10
 
11
- export function jsxAllyConfig(options: JsxAllyConfigOptions = {}) {
11
+ export function defineJsxAllyConfig(options: JsxAllyConfigOptions = {}) {
12
12
  const {
13
13
  rules = {}
14
14
  } = options;
@@ -8,7 +8,7 @@ export interface PackageJsonConfigOptions {
8
8
 
9
9
  export const packageJsonGlobalIgnores = [];
10
10
 
11
- export function packageJsonConfig(options: PackageJsonConfigOptions = {}) {
11
+ export function definePackageJsonConfig(options: PackageJsonConfigOptions = {}) {
12
12
  const {
13
13
  rules = {}
14
14
  } = options;
package/src/react.ts CHANGED
@@ -11,7 +11,7 @@ export interface ReactConfigOptions {
11
11
 
12
12
  export const reactGlobalIgnores = [];
13
13
 
14
- export function reactConfig(options: ReactConfigOptions = {}) {
14
+ export function defineReactConfig(options: ReactConfigOptions = {}) {
15
15
  const {
16
16
  rules = {},
17
17
  compiler = false
package/src/storybook.ts CHANGED
@@ -12,7 +12,7 @@ export const storybookGlobalIgnores = [
12
12
  "storybook-static"
13
13
  ];
14
14
 
15
- export function storybookConfig(options: StorybookConfigOptions = {}) {
15
+ export function defineStorybookConfig(options: StorybookConfigOptions = {}) {
16
16
  const {
17
17
  storiesRules = {},
18
18
  mainFileRules = {}
@@ -9,7 +9,7 @@ export interface TestingLibraryConfigOptions {
9
9
 
10
10
  export const testingLibraryGlobalIgnores = [];
11
11
 
12
- export function testingLibraryConfig(options: TestingLibraryConfigOptions = {}) {
12
+ export function defineTestingLibraryConfig(options: TestingLibraryConfigOptions = {}) {
13
13
  const {
14
14
  reactRules = {},
15
15
  jsRules = {}
package/src/typescript.ts CHANGED
@@ -4,13 +4,13 @@ import type { Linter } from "eslint";
4
4
  import tseslint from "typescript-eslint";
5
5
  import type { ConfigWithExtends } from "./types.ts";
6
6
 
7
- export interface TypescriptConfigOptions {
7
+ export interface TypeScriptConfigOptions {
8
8
  rules?: Partial<Linter.RulesRecord>;
9
9
  }
10
10
 
11
11
  export const typescriptGlobalIgnores = [];
12
12
 
13
- export function typescriptConfig(tsconfigRootDir: string, options: TypescriptConfigOptions = {}) {
13
+ export function defineTypeScriptConfig(tsconfigRootDir: string, options: TypeScriptConfigOptions = {}) {
14
14
  const {
15
15
  rules = {}
16
16
  } = options;
package/src/vitest.ts CHANGED
@@ -3,16 +3,22 @@ import type { Linter } from "eslint";
3
3
  import type { ConfigWithExtends } from "./types.ts";
4
4
 
5
5
  export interface VitestConfigOptions {
6
+ enabled?: boolean;
6
7
  rules?: Partial<Linter.RulesRecord>;
7
8
  }
8
9
 
9
10
  export const vitestGlobalIgnores = [];
10
11
 
11
- export function vitestConfig(options: VitestConfigOptions = {}) {
12
+ export function defineVitestConfig(options: VitestConfigOptions = {}) {
12
13
  const {
14
+ enabled = true,
13
15
  rules = {}
14
16
  } = options;
15
17
 
18
+ if (!enabled) {
19
+ return [];
20
+ }
21
+
16
22
  const config: ConfigWithExtends[] = [{
17
23
  name: "@workleap/eslint-configs/vitest",
18
24
  files: [
package/src/yaml.ts CHANGED
@@ -10,7 +10,7 @@ export const yamlGlobalIgnores = [
10
10
  "pnpm-lock.yaml"
11
11
  ];
12
12
 
13
- export function yamlConfig(options: YamlConfigOptions = {}) {
13
+ export function defineYamlConfig(options: YamlConfigOptions = {}) {
14
14
  const {
15
15
  rules = {}
16
16
  } = options;