@dvukovic/style-guide 0.12.0 → 0.13.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.
- package/README.md +8 -5
- package/dist/src/eslint/configs/aws.d.ts +2 -2
- package/dist/src/eslint/configs/core.d.ts +2 -2
- package/dist/src/eslint/configs/jest.d.ts +2 -2
- package/dist/src/eslint/configs/mobx.d.ts +2 -2
- package/dist/src/eslint/configs/next.d.ts +2 -2
- package/dist/src/eslint/configs/node.d.ts +2 -2
- package/dist/src/eslint/configs/package-json.d.ts +7 -3
- package/dist/src/eslint/configs/playwright.d.ts +2 -2
- package/dist/src/eslint/configs/react.d.ts +2 -2
- package/dist/src/eslint/configs/storybook.d.ts +2 -2
- package/dist/src/eslint/configs/typescript-strict.d.ts +2 -2
- package/dist/src/eslint/configs/typescript.d.ts +2 -2
- package/dist/src/eslint/configs/vitest.d.ts +2 -2
- package/dist/src/eslint/index.d.ts +19 -16
- package/package.json +1 -1
- package/src/cli/generators/eslint.js +10 -10
- package/src/eslint/configs/aws.js +4 -4
- package/src/eslint/configs/core.js +4 -4
- package/src/eslint/configs/jest.js +4 -4
- package/src/eslint/configs/mobx.js +3 -3
- package/src/eslint/configs/next.js +3 -3
- package/src/eslint/configs/node.js +4 -4
- package/src/eslint/configs/package-json.js +9 -6
- package/src/eslint/configs/playwright.js +4 -4
- package/src/eslint/configs/react.js +3 -3
- package/src/eslint/configs/storybook.js +4 -4
- package/src/eslint/configs/typescript-strict.js +3 -3
- package/src/eslint/configs/typescript.js +4 -4
- package/src/eslint/configs/vitest.js +4 -4
- package/src/eslint/index.js +33 -34
package/README.md
CHANGED
|
@@ -28,7 +28,10 @@ Create `eslint.config.js`:
|
|
|
28
28
|
```js
|
|
29
29
|
import { customDefineConfig, core, typescript } from "@dvukovic/style-guide/eslint"
|
|
30
30
|
|
|
31
|
-
export default customDefineConfig(
|
|
31
|
+
export default customDefineConfig({
|
|
32
|
+
configs: [core(), typescript()],
|
|
33
|
+
ignores: ["dist", "build"],
|
|
34
|
+
})
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
### Available Configs
|
|
@@ -54,9 +57,8 @@ Each factory function accepts a config parameter to extend or override settings:
|
|
|
54
57
|
```js
|
|
55
58
|
import { customDefineConfig, core, typescript } from "@dvukovic/style-guide/eslint"
|
|
56
59
|
|
|
57
|
-
export default customDefineConfig(
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
+
export default customDefineConfig({
|
|
61
|
+
configs: [
|
|
60
62
|
core(),
|
|
61
63
|
typescript({
|
|
62
64
|
rules: {
|
|
@@ -64,7 +66,8 @@ export default customDefineConfig(
|
|
|
64
66
|
},
|
|
65
67
|
}),
|
|
66
68
|
],
|
|
67
|
-
|
|
69
|
+
ignores: ["dist"],
|
|
70
|
+
})
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
## Prettier
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AWS infrastructure ESLint configuration for CDK, SST, and AWS SDK
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function aws(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const awsConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core ESLint configuration with essential rules and plugins
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function core(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const coreConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Jest testing framework configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function jest(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MobX state management configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function mobx(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const mobxConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Next.js framework configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function next(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const nextConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js ESLint configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function node(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const nodeConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Package.json ESLint configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends}
|
|
6
6
|
*/
|
|
7
7
|
export function packageJson(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
-
|
|
8
|
+
additionalFiles?: string[];
|
|
9
9
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
10
10
|
/**
|
|
11
11
|
* Package.json ESLint configuration for monorepos
|
|
@@ -15,10 +15,14 @@ export function packageJson(config?: import("@eslint/config-helpers").ConfigWith
|
|
|
15
15
|
* - Root package.json: all rules including volta.node requirement
|
|
16
16
|
* - Nested packages: same rules but no volta.node requirement
|
|
17
17
|
*
|
|
18
|
-
* @param {{
|
|
18
|
+
* @param {{
|
|
19
|
+
* workspacePatterns?: string[]
|
|
20
|
+
* additionalFiles?: string[]
|
|
21
|
+
* } & import("@eslint/config-helpers").ConfigWithExtends} [config]
|
|
19
22
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends[]}
|
|
20
23
|
*/
|
|
21
24
|
export function packageJsonWorkspace(config?: {
|
|
22
25
|
workspacePatterns?: string[];
|
|
26
|
+
additionalFiles?: string[];
|
|
23
27
|
} & import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends[];
|
|
24
28
|
export const packageJsonConfigs: import("@eslint/config-helpers").Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Playwright testing configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function playwright(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const playwrightConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React framework configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function react(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const reactConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Storybook ESLint configuration with relaxed rules for story files
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function storybook(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Strict TypeScript ESLint configuration with additional safety rules
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function typescriptStrict(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
/** @type {import("@eslint/config-helpers").Config[]} */
|
|
13
13
|
export const typescriptStrictConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeScript ESLint configuration with parser setup and rules
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function typescript(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
/** @type {import("eslint").Linter.Config[]} */
|
|
13
13
|
export const typescriptConfig: import("eslint").Linter.Config[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vitest testing framework configuration
|
|
3
3
|
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
5
5
|
* - Additional config
|
|
6
6
|
*
|
|
7
7
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
8
|
*/
|
|
9
9
|
export function vitest(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
|
|
10
|
+
additionalFiles?: string[];
|
|
11
11
|
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
12
|
export const vitestConfig: import("@eslint/config-helpers").Config[];
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Custom wrapper for ESLint defineConfig with simplified API
|
|
3
3
|
*
|
|
4
|
-
* @param {string[]
|
|
5
|
-
* @param {Array} configs - Array of ESLint config objects
|
|
4
|
+
* @param {{ configs: Array; ignores?: string[]; defaultIgnores?: boolean }} options
|
|
6
5
|
* @returns {Array} ESLint configuration
|
|
7
6
|
*/
|
|
8
|
-
export function customDefineConfig(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
7
|
+
export function customDefineConfig({ configs, defaultIgnores, ignores }: {
|
|
8
|
+
configs: any[];
|
|
9
|
+
ignores?: string[];
|
|
10
|
+
defaultIgnores?: boolean;
|
|
11
|
+
}): any[];
|
|
12
|
+
export { aws } from "./configs/aws.js";
|
|
13
|
+
export { core } from "./configs/core.js";
|
|
14
|
+
export { jest } from "./configs/jest.js";
|
|
15
|
+
export { mobx } from "./configs/mobx.js";
|
|
16
|
+
export { next } from "./configs/next.js";
|
|
17
|
+
export { node } from "./configs/node.js";
|
|
18
|
+
export { playwright } from "./configs/playwright.js";
|
|
19
|
+
export { react } from "./configs/react.js";
|
|
20
|
+
export { storybook } from "./configs/storybook.js";
|
|
21
|
+
export { typescript } from "./configs/typescript.js";
|
|
22
|
+
export { typescriptStrict } from "./configs/typescript-strict.js";
|
|
23
|
+
export { vitest } from "./configs/vitest.js";
|
|
24
|
+
export { packageJson, packageJsonWorkspace } from "./configs/package-json.js";
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ export function generateESLintConfig(options) {
|
|
|
12
12
|
|
|
13
13
|
const imports = ["core", "customDefineConfig"]
|
|
14
14
|
const configs = ["core()"]
|
|
15
|
-
const ignores = ["dist"
|
|
15
|
+
const ignores = ["dist"]
|
|
16
16
|
|
|
17
17
|
if (language === "typescript") {
|
|
18
18
|
imports.push("typescript")
|
|
@@ -33,14 +33,14 @@ export function generateESLintConfig(options) {
|
|
|
33
33
|
if (framework === "next") {
|
|
34
34
|
imports.push("next")
|
|
35
35
|
configs.push("next()")
|
|
36
|
-
ignores.push("
|
|
36
|
+
ignores.push("out")
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (includeNode) {
|
|
40
40
|
imports.push("node")
|
|
41
41
|
|
|
42
42
|
if (framework === "next") {
|
|
43
|
-
configs.push('node({
|
|
43
|
+
configs.push('node({ files: ["**/api/**/*.ts", "**/app/api/**/*.ts"] })')
|
|
44
44
|
} else {
|
|
45
45
|
configs.push("node()")
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ export function generateESLintConfig(options) {
|
|
|
50
50
|
imports.push("aws")
|
|
51
51
|
|
|
52
52
|
if (framework === "next") {
|
|
53
|
-
configs.push('aws({
|
|
53
|
+
configs.push('aws({ files: ["**/api/**/*.ts", "**/app/api/**/*.ts"] })')
|
|
54
54
|
} else {
|
|
55
55
|
configs.push("aws()")
|
|
56
56
|
}
|
|
@@ -83,7 +83,7 @@ export function generateESLintConfig(options) {
|
|
|
83
83
|
|
|
84
84
|
if (isMonorepo) {
|
|
85
85
|
imports.push("packageJsonWorkspace")
|
|
86
|
-
configs.push("
|
|
86
|
+
configs.push("packageJsonWorkspace()")
|
|
87
87
|
} else {
|
|
88
88
|
imports.push("packageJson")
|
|
89
89
|
configs.push("packageJson()")
|
|
@@ -91,14 +91,14 @@ export function generateESLintConfig(options) {
|
|
|
91
91
|
|
|
92
92
|
const importStatement = `import {\n ${imports.join(",\n ")},\n} from "@dvukovic/style-guide/eslint"`
|
|
93
93
|
|
|
94
|
-
const ignoresArray = `["${ignores.join('", "')}"]`
|
|
95
94
|
const configsArray = `[\n ${configs.join(",\n ")},\n ]`
|
|
95
|
+
const ignoresArray = `["${ignores.join('", "')}"]`
|
|
96
96
|
|
|
97
97
|
return `${importStatement}
|
|
98
98
|
|
|
99
|
-
export default customDefineConfig(
|
|
100
|
-
${
|
|
101
|
-
${
|
|
102
|
-
)
|
|
99
|
+
export default customDefineConfig({
|
|
100
|
+
configs: ${configsArray},
|
|
101
|
+
ignores: ${ignoresArray},
|
|
102
|
+
})
|
|
103
103
|
`
|
|
104
104
|
}
|
|
@@ -5,24 +5,24 @@ export const awsConfig = [sonarjsAws]
|
|
|
5
5
|
/**
|
|
6
6
|
* AWS infrastructure ESLint configuration for CDK, SST, and AWS SDK
|
|
7
7
|
*
|
|
8
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
9
9
|
* - Additional config
|
|
10
10
|
*
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
12
12
|
*/
|
|
13
13
|
export function aws(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...awsConfig, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? [
|
|
19
19
|
"**/*.js",
|
|
20
20
|
"**/*.cjs",
|
|
21
21
|
"**/*.mjs",
|
|
22
22
|
"**/*.ts",
|
|
23
23
|
"**/*.cts",
|
|
24
24
|
"**/*.mts",
|
|
25
|
-
...(
|
|
25
|
+
...(additionalFiles ?? []),
|
|
26
26
|
],
|
|
27
27
|
...rest,
|
|
28
28
|
}
|
|
@@ -33,24 +33,24 @@ export const coreConfig = [
|
|
|
33
33
|
/**
|
|
34
34
|
* Core ESLint configuration with essential rules and plugins
|
|
35
35
|
*
|
|
36
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
36
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
37
37
|
* - Additional config
|
|
38
38
|
*
|
|
39
39
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
40
40
|
*/
|
|
41
41
|
export function core(config) {
|
|
42
|
-
const { extends: extendsConfig, files,
|
|
42
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
43
43
|
|
|
44
44
|
return {
|
|
45
45
|
extends: [...coreConfig, ...(extendsConfig ?? [])],
|
|
46
|
-
files:
|
|
46
|
+
files: files ?? [
|
|
47
47
|
"**/*.js",
|
|
48
48
|
".*.js",
|
|
49
49
|
"**/*.cjs",
|
|
50
50
|
"**/*.mjs",
|
|
51
51
|
"**/*.ts",
|
|
52
52
|
"**/*.tsx",
|
|
53
|
-
...(
|
|
53
|
+
...(additionalFiles ?? []),
|
|
54
54
|
],
|
|
55
55
|
...rest,
|
|
56
56
|
}
|
|
@@ -3,18 +3,18 @@ import { jest as jestPlugin } from "../plugins/jest.js"
|
|
|
3
3
|
/**
|
|
4
4
|
* Jest testing framework configuration
|
|
5
5
|
*
|
|
6
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
6
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
7
7
|
* - Additional config
|
|
8
8
|
*
|
|
9
9
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
10
10
|
*/
|
|
11
11
|
export function jest(config) {
|
|
12
12
|
const jestConfig = [jestPlugin]
|
|
13
|
-
const { extends: extendsConfig, files,
|
|
13
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
14
14
|
|
|
15
15
|
return {
|
|
16
16
|
extends: [...jestConfig, ...(extendsConfig ?? [])],
|
|
17
|
-
files:
|
|
17
|
+
files: files ?? [
|
|
18
18
|
"**/*.test.js",
|
|
19
19
|
"**/*.test.ts",
|
|
20
20
|
"**/*.spec.js",
|
|
@@ -25,7 +25,7 @@ export function jest(config) {
|
|
|
25
25
|
"**/*.int.test.ts",
|
|
26
26
|
"**/*.integration.test.js",
|
|
27
27
|
"**/*.integration.test.ts",
|
|
28
|
-
...(
|
|
28
|
+
...(additionalFiles ?? []),
|
|
29
29
|
],
|
|
30
30
|
...rest,
|
|
31
31
|
}
|
|
@@ -5,17 +5,17 @@ export const mobxConfig = [mobxPlugin]
|
|
|
5
5
|
/**
|
|
6
6
|
* MobX state management configuration
|
|
7
7
|
*
|
|
8
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
9
9
|
* - Additional config
|
|
10
10
|
*
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
12
12
|
*/
|
|
13
13
|
export function mobx(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...mobxConfig, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(additionalFiles ?? [])],
|
|
19
19
|
...rest,
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -5,17 +5,17 @@ export const nextConfig = [nextPlugin]
|
|
|
5
5
|
/**
|
|
6
6
|
* Next.js framework configuration
|
|
7
7
|
*
|
|
8
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
9
9
|
* - Additional config
|
|
10
10
|
*
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
12
12
|
*/
|
|
13
13
|
export function next(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...nextConfig, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(additionalFiles ?? [])],
|
|
19
19
|
...rest,
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -6,24 +6,24 @@ export const nodeConfig = [nodeN, securityNode]
|
|
|
6
6
|
/**
|
|
7
7
|
* Node.js ESLint configuration
|
|
8
8
|
*
|
|
9
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
9
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
10
10
|
* - Additional config
|
|
11
11
|
*
|
|
12
12
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
13
13
|
*/
|
|
14
14
|
export function node(config) {
|
|
15
|
-
const { extends: extendsConfig, files,
|
|
15
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
extends: [...nodeConfig, ...(extendsConfig ?? [])],
|
|
19
|
-
files:
|
|
19
|
+
files: files ?? [
|
|
20
20
|
"**/*.js",
|
|
21
21
|
"**/*.cjs",
|
|
22
22
|
"**/*.mjs",
|
|
23
23
|
"**/*.ts",
|
|
24
24
|
"**/*.cts",
|
|
25
25
|
"**/*.mts",
|
|
26
|
-
...(
|
|
26
|
+
...(additionalFiles ?? []),
|
|
27
27
|
],
|
|
28
28
|
...rest,
|
|
29
29
|
}
|
|
@@ -7,15 +7,15 @@ export const packageJsonConfigs = [packageJsonRules]
|
|
|
7
7
|
/**
|
|
8
8
|
* Package.json ESLint configuration
|
|
9
9
|
*
|
|
10
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends}
|
|
12
12
|
*/
|
|
13
13
|
export function packageJson(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...packageJsonConfigs, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? ["**/package.json", ...(additionalFiles ?? [])],
|
|
19
19
|
...rest,
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -28,13 +28,16 @@ export function packageJson(config) {
|
|
|
28
28
|
* - Root package.json: all rules including volta.node requirement
|
|
29
29
|
* - Nested packages: same rules but no volta.node requirement
|
|
30
30
|
*
|
|
31
|
-
* @param {{
|
|
31
|
+
* @param {{
|
|
32
|
+
* workspacePatterns?: string[]
|
|
33
|
+
* additionalFiles?: string[]
|
|
34
|
+
* } & import("@eslint/config-helpers").ConfigWithExtends} [config]
|
|
32
35
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends[]}
|
|
33
36
|
*/
|
|
34
37
|
export function packageJsonWorkspace(config) {
|
|
35
38
|
const {
|
|
39
|
+
additionalFiles,
|
|
36
40
|
extends: extendsConfig,
|
|
37
|
-
files,
|
|
38
41
|
workspacePatterns = DEFAULT_WORKSPACE_PATTERNS,
|
|
39
42
|
...rest
|
|
40
43
|
} = config ?? {}
|
|
@@ -42,7 +45,7 @@ export function packageJsonWorkspace(config) {
|
|
|
42
45
|
return [
|
|
43
46
|
{
|
|
44
47
|
extends: [...packageJsonConfigs, ...(extendsConfig ?? [])],
|
|
45
|
-
files: ["package.json", ...(
|
|
48
|
+
files: ["package.json", ...(additionalFiles ?? [])],
|
|
46
49
|
...rest,
|
|
47
50
|
},
|
|
48
51
|
{
|
|
@@ -5,17 +5,17 @@ export const playwrightConfig = [playwrightPlugin]
|
|
|
5
5
|
/**
|
|
6
6
|
* Playwright testing configuration
|
|
7
7
|
*
|
|
8
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
9
9
|
* - Additional config
|
|
10
10
|
*
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
12
12
|
*/
|
|
13
13
|
export function playwright(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...playwrightConfig, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? [
|
|
19
19
|
"**/*.test.js",
|
|
20
20
|
"**/*.test.ts",
|
|
21
21
|
"**/*.spec.js",
|
|
@@ -26,7 +26,7 @@ export function playwright(config) {
|
|
|
26
26
|
"**/*.int.test.ts",
|
|
27
27
|
"**/*.integration.test.js",
|
|
28
28
|
"**/*.integration.test.ts",
|
|
29
|
-
...(
|
|
29
|
+
...(additionalFiles ?? []),
|
|
30
30
|
],
|
|
31
31
|
...rest,
|
|
32
32
|
}
|
|
@@ -6,17 +6,17 @@ export const reactConfig = [reactPlugin, reactHooksPlugin]
|
|
|
6
6
|
/**
|
|
7
7
|
* React framework configuration
|
|
8
8
|
*
|
|
9
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
9
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
10
10
|
* - Additional config
|
|
11
11
|
*
|
|
12
12
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
13
13
|
*/
|
|
14
14
|
export function react(config) {
|
|
15
|
-
const { extends: extendsConfig, files,
|
|
15
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
16
16
|
|
|
17
17
|
return {
|
|
18
18
|
extends: [...reactConfig, ...(extendsConfig ?? [])],
|
|
19
|
-
files:
|
|
19
|
+
files: files ?? ["**/*.jsx", "**/*.tsx", ...(additionalFiles ?? [])],
|
|
20
20
|
...rest,
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@ import { storybook as storybookPlugin } from "../plugins/storybook.js"
|
|
|
3
3
|
/**
|
|
4
4
|
* Storybook ESLint configuration with relaxed rules for story files
|
|
5
5
|
*
|
|
6
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
6
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
7
7
|
* - Additional config
|
|
8
8
|
*
|
|
9
9
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
@@ -21,16 +21,16 @@ export function storybook(config) {
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
]
|
|
24
|
-
const { extends: extendsConfig, files,
|
|
24
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
25
25
|
|
|
26
26
|
return {
|
|
27
27
|
extends: [...storybookConfig, ...(extendsConfig ?? [])],
|
|
28
|
-
files:
|
|
28
|
+
files: files ?? [
|
|
29
29
|
"**/*.stories.js",
|
|
30
30
|
"**/*.stories.ts",
|
|
31
31
|
"**/*.stories.jsx",
|
|
32
32
|
"**/*.stories.tsx",
|
|
33
|
-
...(
|
|
33
|
+
...(additionalFiles ?? []),
|
|
34
34
|
],
|
|
35
35
|
...rest,
|
|
36
36
|
}
|
|
@@ -33,17 +33,17 @@ export const typescriptStrictConfig = [
|
|
|
33
33
|
/**
|
|
34
34
|
* Strict TypeScript ESLint configuration with additional safety rules
|
|
35
35
|
*
|
|
36
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
36
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
37
37
|
* - Additional config
|
|
38
38
|
*
|
|
39
39
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
40
40
|
*/
|
|
41
41
|
export function typescriptStrict(config) {
|
|
42
|
-
const { extends: extendsConfig, files,
|
|
42
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
43
43
|
|
|
44
44
|
return {
|
|
45
45
|
extends: [...typescriptStrictConfig, ...(extendsConfig ?? [])],
|
|
46
|
-
files:
|
|
46
|
+
files: files ?? ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts", ...(additionalFiles ?? [])],
|
|
47
47
|
...rest,
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -28,24 +28,24 @@ export const typescriptConfig = [
|
|
|
28
28
|
/**
|
|
29
29
|
* TypeScript ESLint configuration with parser setup and rules
|
|
30
30
|
*
|
|
31
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
31
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
32
32
|
* - Additional config
|
|
33
33
|
*
|
|
34
34
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
35
35
|
*/
|
|
36
36
|
export function typescript(config) {
|
|
37
|
-
const { extends: extendsConfig, files,
|
|
37
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
40
|
extends: [...typescriptConfig, ...(extendsConfig ?? [])],
|
|
41
|
-
files:
|
|
41
|
+
files: files ?? [
|
|
42
42
|
"**/*.js",
|
|
43
43
|
"**/*.ts",
|
|
44
44
|
"**/*.tsx",
|
|
45
45
|
"**/*.cjs",
|
|
46
46
|
"**/*.cts",
|
|
47
47
|
"**/*.mts",
|
|
48
|
-
...(
|
|
48
|
+
...(additionalFiles ?? []),
|
|
49
49
|
],
|
|
50
50
|
...rest,
|
|
51
51
|
}
|
|
@@ -5,17 +5,17 @@ export const vitestConfig = [vitestPlugin]
|
|
|
5
5
|
/**
|
|
6
6
|
* Vitest testing framework configuration
|
|
7
7
|
*
|
|
8
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & {
|
|
8
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { additionalFiles?: string[] }} [config]
|
|
9
9
|
* - Additional config
|
|
10
10
|
*
|
|
11
11
|
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
12
12
|
*/
|
|
13
13
|
export function vitest(config) {
|
|
14
|
-
const { extends: extendsConfig, files,
|
|
14
|
+
const { additionalFiles, extends: extendsConfig, files, ...rest } = config ?? {}
|
|
15
15
|
|
|
16
16
|
return {
|
|
17
17
|
extends: [...vitestConfig, ...(extendsConfig ?? [])],
|
|
18
|
-
files:
|
|
18
|
+
files: files ?? [
|
|
19
19
|
"**/*.test.js",
|
|
20
20
|
"**/*.test.ts",
|
|
21
21
|
"**/*.spec.js",
|
|
@@ -26,7 +26,7 @@ export function vitest(config) {
|
|
|
26
26
|
"**/*.int.test.ts",
|
|
27
27
|
"**/*.integration.test.js",
|
|
28
28
|
"**/*.integration.test.ts",
|
|
29
|
-
...(
|
|
29
|
+
...(additionalFiles ?? []),
|
|
30
30
|
],
|
|
31
31
|
...rest,
|
|
32
32
|
}
|
package/src/eslint/index.js
CHANGED
|
@@ -4,41 +4,40 @@ import { defineConfig, globalIgnores } from "eslint/config"
|
|
|
4
4
|
/**
|
|
5
5
|
* Custom wrapper for ESLint defineConfig with simplified API
|
|
6
6
|
*
|
|
7
|
-
* @param {string[]
|
|
8
|
-
* @param {Array} configs - Array of ESLint config objects
|
|
7
|
+
* @param {{ configs: Array; ignores?: string[]; defaultIgnores?: boolean }} options
|
|
9
8
|
* @returns {Array} ESLint configuration
|
|
10
9
|
*/
|
|
11
|
-
export function customDefineConfig(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
)
|
|
10
|
+
export function customDefineConfig({ configs, defaultIgnores = true, ignores = [] }) {
|
|
11
|
+
const defaultIgnorePatterns = defaultIgnores
|
|
12
|
+
? [
|
|
13
|
+
"node_modules",
|
|
14
|
+
"./*.js",
|
|
15
|
+
"./*.ts",
|
|
16
|
+
"./*.cjs",
|
|
17
|
+
"./*.mjs",
|
|
18
|
+
"./*.config.js",
|
|
19
|
+
"./*.config.cjs",
|
|
20
|
+
"./*.config.mjs",
|
|
21
|
+
"next-env.d.ts",
|
|
22
|
+
".next",
|
|
23
|
+
"**/__generated__/**",
|
|
24
|
+
"**/*.d.json.ts",
|
|
25
|
+
]
|
|
26
|
+
: []
|
|
27
|
+
|
|
28
|
+
return defineConfig(globalIgnores([...defaultIgnorePatterns, ...ignores]), ...configs.flat())
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
31
|
+
export { aws } from "./configs/aws.js"
|
|
32
|
+
export { core } from "./configs/core.js"
|
|
33
|
+
export { jest } from "./configs/jest.js"
|
|
34
|
+
export { mobx } from "./configs/mobx.js"
|
|
35
|
+
export { next } from "./configs/next.js"
|
|
36
|
+
export { node } from "./configs/node.js"
|
|
37
|
+
export { packageJson, packageJsonWorkspace } from "./configs/package-json.js"
|
|
38
|
+
export { playwright } from "./configs/playwright.js"
|
|
39
|
+
export { react } from "./configs/react.js"
|
|
40
|
+
export { storybook } from "./configs/storybook.js"
|
|
41
|
+
export { typescript } from "./configs/typescript.js"
|
|
42
|
+
export { typescriptStrict } from "./configs/typescript-strict.js"
|
|
43
|
+
export { vitest } from "./configs/vitest.js"
|