@workleap/eslint-configs 1.0.1 → 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 +6 -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 +2 -2
  6. package/dist/by-project-type/defineReactLibraryConfig.js +22 -22
  7. package/dist/by-project-type/defineReactLibraryConfig.js.map +1 -1
  8. package/dist/by-project-type/defineTypescriptLibraryConfig.d.ts +2 -2
  9. package/dist/by-project-type/defineTypescriptLibraryConfig.js +14 -14
  10. package/dist/by-project-type/defineTypescriptLibraryConfig.js.map +1 -1
  11. package/dist/by-project-type/defineWebApplicationConfig.d.ts +2 -2
  12. package/dist/by-project-type/defineWebApplicationConfig.js +22 -22
  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 +1 -1
  21. package/dist/jest.js +2 -2
  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 +1 -1
  45. package/dist/vitest.js +2 -2
  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 +23 -23
  53. package/src/by-project-type/defineTypescriptLibraryConfig.ts +15 -15
  54. package/src/by-project-type/defineWebApplicationConfig.ts +23 -54
  55. package/src/core.ts +1 -1
  56. package/src/index.ts +10 -10
  57. package/src/jest.ts +1 -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 +1 -1
  66. package/src/yaml.ts +1 -1
@@ -1,17 +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
12
  testFramework?: "vitest" | "jest";
13
13
  core?: CoreConfigOptions;
14
- typescript?: TypescriptConfigOptions;
14
+ typescript?: TypeScriptConfigOptions;
15
15
  jest?: JestConfigOptions;
16
16
  json?: JsonConfigOptions;
17
17
  vitest?: VitestConfigOptions;
@@ -49,21 +49,21 @@ export function defineTypeScriptLibraryConfig(tsconfigRootDir: string, options:
49
49
  ...vitestGlobalIgnores,
50
50
  ...yamlGlobalIgnores
51
51
  ]),
52
- ...coreConfig(core),
53
- ...jestConfig({
52
+ ...defineCoreConfig(core),
53
+ ...defineJestConfig({
54
54
  ...jest,
55
55
  enabled: jest?.enabled ?? testFramework === "jest"
56
56
  }),
57
- ...jsonConfig(json),
58
- ...packageJsonConfig(packageJson),
59
- ...typescriptConfig(tsconfigRootDir, typescript),
57
+ ...defineJsonConfig(json),
58
+ ...definePackageJsonConfig(packageJson),
59
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
60
60
  // Temporary fix until the vitest plugin support defineConfig and the types are fixed.
61
- ...(vitestConfig({
61
+ ...(defineVitestConfig({
62
62
  ...vitest,
63
63
  enabled: vitest?.enabled ?? testFramework === "vitest"
64
64
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
65
  }) as any),
66
- ...yamlConfig(yaml),
66
+ ...defineYamlConfig(yaml),
67
67
  {
68
68
  plugins: {
69
69
  "@workleap": WorkleapPlugin
@@ -1,47 +1,16 @@
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
- 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
18
-
19
- -> It usually means that the project tsconfig.json file cannot find the specified file
20
- -> Make sure to clear the ESLint cache after such an error because update the tsconfig.json file doesn't invalidate the ESLint cache
21
-
22
- */
23
-
24
- /*
25
-
26
- import { defineConfig, globalIgnores } from "eslint/config";
27
- import { defineReactLibraryConfig } from "@workleap/eslint-configs";
28
-
29
- export default defineConfig([
30
- globalIgnores([
31
- "/reports/**"
32
- ]),
33
- defineReactLibraryConfig(import.meta.dirname)
34
- ]);
35
-
36
- */
37
-
38
- /*
39
-
40
- The key insight was that ESLint 9's flat config system requires ignores to be specified in the configuration
41
- file itself for optimal performance, rather than relying on CLI flags (--ignore-pattern). The ignores array at the beginning of the
42
- config ensures files are filtered out during the file discovery phase, not after.
43
-
44
- */
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";
45
14
 
46
15
  export interface DefineWebApplicationConfigOptions {
47
16
  testFramework?: "vitest" | "jest";
@@ -53,7 +22,7 @@ export interface DefineWebApplicationConfigOptions {
53
22
  react?: ReactConfigOptions;
54
23
  storybook?: StorybookConfigOptions;
55
24
  testingLibrary?: TestingLibraryConfigOptions;
56
- typescript?: TypescriptConfigOptions;
25
+ typescript?: TypeScriptConfigOptions;
57
26
  vitest?: VitestConfigOptions;
58
27
  yaml?: YamlConfigOptions;
59
28
  }
@@ -96,25 +65,25 @@ export const defineWebApplicationConfig = (tsconfigRootDir: string, options: Def
96
65
  ...vitestGlobalIgnores,
97
66
  ...yamlGlobalIgnores
98
67
  ]),
99
- ...coreConfig(core),
100
- ...jestConfig({
68
+ ...defineCoreConfig(core),
69
+ ...defineJestConfig({
101
70
  ...jest,
102
71
  enabled: jest?.enabled ?? testFramework === "jest"
103
72
  }),
104
- ...jsonConfig(json),
105
- ...jsxAllyConfig(jsxAlly),
106
- ...packageJsonConfig(packageJson),
107
- ...reactConfig(react),
108
- ...storybookConfig(storybook),
109
- ...testingLibraryConfig(testingLibrary),
110
- ...typescriptConfig(tsconfigRootDir, typescript),
73
+ ...defineJsonConfig(json),
74
+ ...defineJsxAllyConfig(jsxAlly),
75
+ ...definePackageJsonConfig(packageJson),
76
+ ...defineReactConfig(react),
77
+ ...defineStorybookConfig(storybook),
78
+ ...defineTestingLibraryConfig(testingLibrary),
79
+ ...defineTypeScriptConfig(tsconfigRootDir, typescript),
111
80
  // Temporary fix until the vitest plugin support defineConfig and the types are fixed.
112
- ...(vitestConfig({
81
+ ...(defineVitestConfig({
113
82
  ...vitest,
114
83
  enabled: vitest?.enabled ?? testFramework === "vitest"
115
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
85
  }) as any),
117
- ...yamlConfig(yaml),
86
+ ...defineYamlConfig(yaml),
118
87
  {
119
88
  plugins: {
120
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
@@ -10,7 +10,7 @@ export interface JestConfigOptions {
10
10
 
11
11
  export const jestGlobalIgnores = [];
12
12
 
13
- export function jestConfig(options: JestConfigOptions = {}) {
13
+ export function defineJestConfig(options: JestConfigOptions = {}) {
14
14
  const {
15
15
  enabled = false,
16
16
  rules = {}
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
@@ -9,7 +9,7 @@ export interface VitestConfigOptions {
9
9
 
10
10
  export const vitestGlobalIgnores = [];
11
11
 
12
- export function vitestConfig(options: VitestConfigOptions = {}) {
12
+ export function defineVitestConfig(options: VitestConfigOptions = {}) {
13
13
  const {
14
14
  enabled = true,
15
15
  rules = {}
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;