@workleap/eslint-configs 1.0.1 → 1.1.1
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.
- package/CHANGELOG.md +12 -0
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.d.ts +2 -2
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.js +10 -10
- package/dist/by-project-type/defineMonorepoWorkspaceConfig.js.map +1 -1
- package/dist/by-project-type/defineReactLibraryConfig.d.ts +2 -2
- package/dist/by-project-type/defineReactLibraryConfig.js +22 -22
- package/dist/by-project-type/defineReactLibraryConfig.js.map +1 -1
- package/dist/by-project-type/defineTypescriptLibraryConfig.d.ts +2 -2
- package/dist/by-project-type/defineTypescriptLibraryConfig.js +14 -14
- package/dist/by-project-type/defineTypescriptLibraryConfig.js.map +1 -1
- package/dist/by-project-type/defineWebApplicationConfig.d.ts +2 -2
- package/dist/by-project-type/defineWebApplicationConfig.js +22 -22
- package/dist/by-project-type/defineWebApplicationConfig.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +41 -1
- package/dist/index.js.map +1 -1
- package/dist/jest.d.ts +1 -1
- package/dist/jest.js +2 -2
- package/dist/jest.js.map +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.js +2 -2
- package/dist/json.js.map +1 -1
- package/dist/jsxAlly.d.ts +1 -1
- package/dist/jsxAlly.js +2 -2
- package/dist/jsxAlly.js.map +1 -1
- package/dist/packageJson.d.ts +1 -1
- package/dist/packageJson.js +2 -2
- package/dist/packageJson.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/storybook.d.ts +1 -1
- package/dist/storybook.js +2 -2
- package/dist/storybook.js.map +1 -1
- package/dist/testingLibrary.d.ts +1 -1
- package/dist/testingLibrary.js +2 -2
- package/dist/testingLibrary.js.map +1 -1
- package/dist/typescript.d.ts +2 -2
- package/dist/typescript.js +11 -2
- package/dist/typescript.js.map +1 -1
- package/dist/vitest.d.ts +1 -1
- package/dist/vitest.js +2 -2
- package/dist/vitest.js.map +1 -1
- package/dist/yaml.d.ts +1 -1
- package/dist/yaml.js +2 -2
- package/dist/yaml.js.map +1 -1
- package/package.json +1 -1
- package/src/by-project-type/defineMonorepoWorkspaceConfig.ts +11 -11
- package/src/by-project-type/defineReactLibraryConfig.ts +23 -23
- package/src/by-project-type/defineTypescriptLibraryConfig.ts +15 -15
- package/src/by-project-type/defineWebApplicationConfig.ts +23 -54
- package/src/core.ts +1 -1
- package/src/index.ts +10 -10
- package/src/jest.ts +1 -1
- package/src/json.ts +1 -1
- package/src/jsxAlly.ts +1 -1
- package/src/packageJson.ts +1 -1
- package/src/react.ts +1 -1
- package/src/storybook.ts +1 -1
- package/src/testingLibrary.ts +1 -1
- package/src/typescript.ts +11 -2
- package/src/vitest.ts +1 -1
- package/src/yaml.ts +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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?:
|
|
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
|
-
...
|
|
53
|
-
...
|
|
52
|
+
...defineCoreConfig(core),
|
|
53
|
+
...defineJestConfig({
|
|
54
54
|
...jest,
|
|
55
55
|
enabled: jest?.enabled ?? testFramework === "jest"
|
|
56
56
|
}),
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
-
...
|
|
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
|
-
...(
|
|
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
|
-
...
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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?:
|
|
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
|
-
...
|
|
100
|
-
...
|
|
68
|
+
...defineCoreConfig(core),
|
|
69
|
+
...defineJestConfig({
|
|
101
70
|
...jest,
|
|
102
71
|
enabled: jest?.enabled ?? testFramework === "jest"
|
|
103
72
|
}),
|
|
104
|
-
...
|
|
105
|
-
...
|
|
106
|
-
...
|
|
107
|
-
...
|
|
108
|
-
...
|
|
109
|
-
...
|
|
110
|
-
...
|
|
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
|
-
...(
|
|
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
|
-
...
|
|
86
|
+
...defineYamlConfig(yaml),
|
|
118
87
|
{
|
|
119
88
|
plugins: {
|
|
120
89
|
"@workleap": WorkleapPlugin
|
package/src/core.ts
CHANGED
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
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
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
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
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
|
|
13
|
+
export function defineJestConfig(options: JestConfigOptions = {}) {
|
|
14
14
|
const {
|
|
15
15
|
enabled = false,
|
|
16
16
|
rules = {}
|
package/src/json.ts
CHANGED
package/src/jsxAlly.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface JsxAllyConfigOptions {
|
|
|
8
8
|
|
|
9
9
|
export const jsxAllyGlobalIgnores = [];
|
|
10
10
|
|
|
11
|
-
export function
|
|
11
|
+
export function defineJsxAllyConfig(options: JsxAllyConfigOptions = {}) {
|
|
12
12
|
const {
|
|
13
13
|
rules = {}
|
|
14
14
|
} = options;
|
package/src/packageJson.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface PackageJsonConfigOptions {
|
|
|
8
8
|
|
|
9
9
|
export const packageJsonGlobalIgnores = [];
|
|
10
10
|
|
|
11
|
-
export function
|
|
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
|
|
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
|
|
15
|
+
export function defineStorybookConfig(options: StorybookConfigOptions = {}) {
|
|
16
16
|
const {
|
|
17
17
|
storiesRules = {},
|
|
18
18
|
mainFileRules = {}
|
package/src/testingLibrary.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface TestingLibraryConfigOptions {
|
|
|
9
9
|
|
|
10
10
|
export const testingLibraryGlobalIgnores = [];
|
|
11
11
|
|
|
12
|
-
export function
|
|
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
|
|
7
|
+
export interface TypeScriptConfigOptions {
|
|
8
8
|
rules?: Partial<Linter.RulesRecord>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const typescriptGlobalIgnores = [];
|
|
12
12
|
|
|
13
|
-
export function
|
|
13
|
+
export function defineTypeScriptConfig(tsconfigRootDir: string, options: TypeScriptConfigOptions = {}) {
|
|
14
14
|
const {
|
|
15
15
|
rules = {}
|
|
16
16
|
} = options;
|
|
@@ -140,6 +140,15 @@ export function typescriptConfig(tsconfigRootDir: string, options: TypescriptCon
|
|
|
140
140
|
}
|
|
141
141
|
],
|
|
142
142
|
"@stylistic/operator-linebreak": "off",
|
|
143
|
+
"@stylistic/space-before-function-paren": [
|
|
144
|
+
"warn",
|
|
145
|
+
{
|
|
146
|
+
anonymous: "always",
|
|
147
|
+
named: "never",
|
|
148
|
+
asyncArrow: "always",
|
|
149
|
+
catch: "never"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
143
152
|
"@stylistic/spaced-comment": "off",
|
|
144
153
|
// Should be the default but somehow it's not enforced if it's not explicitly specified.
|
|
145
154
|
"@stylistic/quote-props": "off",
|
package/src/vitest.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface VitestConfigOptions {
|
|
|
9
9
|
|
|
10
10
|
export const vitestGlobalIgnores = [];
|
|
11
11
|
|
|
12
|
-
export function
|
|
12
|
+
export function defineVitestConfig(options: VitestConfigOptions = {}) {
|
|
13
13
|
const {
|
|
14
14
|
enabled = true,
|
|
15
15
|
rules = {}
|
package/src/yaml.ts
CHANGED