@dvukovic/style-guide 0.10.2 → 0.10.3

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 (37) hide show
  1. package/dist/cli/prompts.d.ts +1 -0
  2. package/dist/eslint/configs/aws.d.ts +12 -0
  3. package/dist/eslint/configs/aws.test.d.ts +1 -0
  4. package/dist/eslint/configs/core.d.ts +6 -2
  5. package/dist/eslint/configs/jest.d.ts +6 -2
  6. package/dist/eslint/configs/mobx.d.ts +6 -2
  7. package/dist/eslint/configs/next.d.ts +6 -2
  8. package/dist/eslint/configs/node.d.ts +6 -2
  9. package/dist/eslint/configs/package-json.d.ts +4 -2
  10. package/dist/eslint/configs/playwright.d.ts +6 -2
  11. package/dist/eslint/configs/react.d.ts +6 -2
  12. package/dist/eslint/configs/storybook.d.ts +6 -2
  13. package/dist/eslint/configs/typescript-strict.d.ts +6 -2
  14. package/dist/eslint/configs/typescript.d.ts +6 -2
  15. package/dist/eslint/configs/vitest.d.ts +6 -2
  16. package/dist/eslint/index.d.ts +1 -0
  17. package/dist/eslint/plugins/sonarjs-aws.d.ts +2 -0
  18. package/package.json +1 -1
  19. package/src/cli/generators/eslint.js +26 -2
  20. package/src/cli/prompts.js +32 -2
  21. package/src/eslint/configs/aws.js +29 -0
  22. package/src/eslint/configs/aws.test.js +17 -0
  23. package/src/eslint/configs/core.js +5 -3
  24. package/src/eslint/configs/jest.js +5 -3
  25. package/src/eslint/configs/mobx.js +5 -3
  26. package/src/eslint/configs/next.js +5 -3
  27. package/src/eslint/configs/node.js +5 -3
  28. package/src/eslint/configs/package-json.js +3 -3
  29. package/src/eslint/configs/playwright.js +5 -3
  30. package/src/eslint/configs/react.js +5 -3
  31. package/src/eslint/configs/storybook.js +5 -3
  32. package/src/eslint/configs/typescript-strict.js +5 -3
  33. package/src/eslint/configs/typescript.js +5 -3
  34. package/src/eslint/configs/vitest.js +5 -3
  35. package/src/eslint/index.js +1 -0
  36. package/src/eslint/plugins/sonarjs-aws.js +27 -0
  37. package/src/eslint/plugins/sonarjs.js +0 -17
@@ -2,6 +2,7 @@ export function promptToolSelection(): Promise<string[]>;
2
2
  export function promptESLintOptions(): Promise<{
3
3
  extras: ("mobx" | "storybook")[];
4
4
  framework: "none" | "react" | "next";
5
+ includeAws: boolean;
5
6
  includeNode: boolean;
6
7
  isMonorepo: boolean;
7
8
  language: "typescript" | "javascript";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * AWS infrastructure ESLint configuration for CDK, SST, and AWS SDK
3
+ *
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
7
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
8
+ */
9
+ export function aws(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
12
+ export const awsConfig: import("@eslint/config-helpers").Config[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Core ESLint configuration with essential rules and plugins
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function core(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function core(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const coreConfig: import("@eslint/config-helpers").Config[];
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * Jest testing framework configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function jest(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function jest(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * MobX state management configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function mobx(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function mobx(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const mobxConfig: import("@eslint/config-helpers").Config[];
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Next.js framework configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function next(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function next(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const nextConfig: import("@eslint/config-helpers").Config[];
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Node.js ESLint configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function node(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function node(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const nodeConfig: import("@eslint/config-helpers").Config[];
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Package.json ESLint configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config]
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
5
  * @returns {import("@eslint/config-helpers").ConfigWithExtends}
6
6
  */
7
- export function packageJson(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
7
+ export function packageJson(config?: import("@eslint/config-helpers").ConfigWithExtends & {
8
+ onlyFiles?: string[];
9
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
10
  /**
9
11
  * Package.json ESLint configuration for monorepos
10
12
  *
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Playwright testing configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function playwright(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function playwright(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const playwrightConfig: import("@eslint/config-helpers").Config[];
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * React framework configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function react(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function react(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const reactConfig: import("@eslint/config-helpers").Config[];
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * Storybook ESLint configuration with relaxed rules for story files
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function storybook(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function storybook(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
@@ -1,9 +1,13 @@
1
1
  /**
2
2
  * Strict TypeScript ESLint configuration with additional safety rules
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function typescriptStrict(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function typescriptStrict(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  /** @type {import("@eslint/config-helpers").Config[]} */
9
13
  export const typescriptStrictConfig: import("@eslint/config-helpers").Config[];
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * TypeScript ESLint configuration with parser setup and rules
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function typescript(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function typescript(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const typescriptConfig: {
9
13
  name?: string;
10
14
  basePath?: string;
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Vitest testing framework configuration
3
3
  *
4
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
4
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
5
+ * - Additional config
6
+ *
5
7
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
6
8
  */
7
- export function vitest(config?: import("@eslint/config-helpers").ConfigWithExtends): import("@eslint/config-helpers").ConfigWithExtends;
9
+ export function vitest(config?: import("@eslint/config-helpers").ConfigWithExtends & {
10
+ onlyFiles?: string[];
11
+ }): import("@eslint/config-helpers").ConfigWithExtends;
8
12
  export const vitestConfig: import("@eslint/config-helpers").Config[];
@@ -6,6 +6,7 @@
6
6
  * @returns {Array} ESLint configuration
7
7
  */
8
8
  export function customDefineConfig(ignores: string[], configs?: any[]): any[];
9
+ export * from "./configs/aws.js";
9
10
  export * from "./configs/core.js";
10
11
  export * from "./configs/jest.js";
11
12
  export * from "./configs/mobx.js";
@@ -0,0 +1,2 @@
1
+ /** @type {import("@eslint/config-helpers").Config} */
2
+ export const sonarjsAws: import("@eslint/config-helpers").Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvukovic/style-guide",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "My own style guide",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,14 @@
1
1
  export function generateESLintConfig(options) {
2
- const { extras, framework, includeNode, isMonorepo, language, strictMode, testing } = options
2
+ const {
3
+ extras,
4
+ framework,
5
+ includeAws,
6
+ includeNode,
7
+ isMonorepo,
8
+ language,
9
+ strictMode,
10
+ testing,
11
+ } = options
3
12
 
4
13
  const imports = ["core", "customDefineConfig"]
5
14
  const configs = ["core()"]
@@ -29,7 +38,22 @@ export function generateESLintConfig(options) {
29
38
 
30
39
  if (includeNode) {
31
40
  imports.push("node")
32
- configs.push("node()")
41
+
42
+ if (framework === "next") {
43
+ configs.push('node({ onlyFiles: ["**/api/**/*.ts", "**/app/api/**/*.ts"] })')
44
+ } else {
45
+ configs.push("node()")
46
+ }
47
+ }
48
+
49
+ if (includeAws) {
50
+ imports.push("aws")
51
+
52
+ if (framework === "next") {
53
+ configs.push('aws({ onlyFiles: ["**/api/**/*.ts", "**/app/api/**/*.ts"] })')
54
+ } else {
55
+ configs.push("aws()")
56
+ }
33
57
  }
34
58
 
35
59
  if (testing.includes("jest")) {
@@ -81,11 +81,25 @@ export async function promptESLintOptions() {
81
81
  }
82
82
 
83
83
  let includeNode = framework === "none"
84
+ let includeAws = false
84
85
 
85
- if (framework !== "none") {
86
+ if (framework === "none") {
87
+ const awsBackend = await clack.confirm({
88
+ initialValue: false,
89
+ message: "Do you use AWS (CDK, SST, SDK)?",
90
+ })
91
+
92
+ if (clack.isCancel(awsBackend)) {
93
+ clack.cancel("Setup cancelled.")
94
+
95
+ throw new SetupCancelledError()
96
+ }
97
+
98
+ includeAws = awsBackend
99
+ } else if (framework === "next") {
86
100
  const nodeBackend = await clack.confirm({
87
101
  initialValue: false,
88
- message: "Do you have a Node.js backend?",
102
+ message: "Do you have Node.js API routes?",
89
103
  })
90
104
 
91
105
  if (clack.isCancel(nodeBackend)) {
@@ -95,6 +109,21 @@ export async function promptESLintOptions() {
95
109
  }
96
110
 
97
111
  includeNode = nodeBackend
112
+
113
+ if (nodeBackend) {
114
+ const awsBackend = await clack.confirm({
115
+ initialValue: false,
116
+ message: "Do your API routes use AWS (CDK, SST, SDK)?",
117
+ })
118
+
119
+ if (clack.isCancel(awsBackend)) {
120
+ clack.cancel("Setup cancelled.")
121
+
122
+ throw new SetupCancelledError()
123
+ }
124
+
125
+ includeAws = awsBackend
126
+ }
98
127
  }
99
128
 
100
129
  const testing = await clack.multiselect({
@@ -144,6 +173,7 @@ export async function promptESLintOptions() {
144
173
  return {
145
174
  extras,
146
175
  framework,
176
+ includeAws,
147
177
  includeNode,
148
178
  isMonorepo,
149
179
  language,
@@ -0,0 +1,29 @@
1
+ import { sonarjsAws } from "../plugins/sonarjs-aws.js"
2
+
3
+ export const awsConfig = [sonarjsAws]
4
+
5
+ /**
6
+ * AWS infrastructure ESLint configuration for CDK, SST, and AWS SDK
7
+ *
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
9
+ * - Additional config
10
+ *
11
+ * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
12
+ */
13
+ export function aws(config) {
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
15
+
16
+ return {
17
+ extends: [...awsConfig, ...(extendsConfig ?? [])],
18
+ files: onlyFiles ?? [
19
+ "**/*.js",
20
+ "**/*.cjs",
21
+ "**/*.mjs",
22
+ "**/*.ts",
23
+ "**/*.cts",
24
+ "**/*.mts",
25
+ ...(files ?? []),
26
+ ],
27
+ ...rest,
28
+ }
29
+ }
@@ -0,0 +1,17 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import { awsConfig } from "./aws.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: awsConfig,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("aws", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0]?.fatalErrorCount).toBe(0)
16
+ })
17
+ })
@@ -33,15 +33,17 @@ export const coreConfig = [
33
33
  /**
34
34
  * Core ESLint configuration with essential rules and plugins
35
35
  *
36
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
36
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
37
+ * - Additional config
38
+ *
37
39
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
38
40
  */
39
41
  export function core(config) {
40
- const { extends: extendsConfig, files, ...rest } = config ?? {}
42
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
41
43
 
42
44
  return {
43
45
  extends: [...coreConfig, ...(extendsConfig ?? [])],
44
- files: [
46
+ files: onlyFiles ?? [
45
47
  "**/*.js",
46
48
  ".*.js",
47
49
  "**/*.cjs",
@@ -3,16 +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} [config] - Additional config
6
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
7
+ * - Additional config
8
+ *
7
9
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
8
10
  */
9
11
  export function jest(config) {
10
12
  const jestConfig = [jestPlugin]
11
- const { extends: extendsConfig, files, ...rest } = config ?? {}
13
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
12
14
 
13
15
  return {
14
16
  extends: [...jestConfig, ...(extendsConfig ?? [])],
15
- files: [
17
+ files: onlyFiles ?? [
16
18
  "**/*.test.js",
17
19
  "**/*.test.ts",
18
20
  "**/*.spec.js",
@@ -5,15 +5,17 @@ export const mobxConfig = [mobxPlugin]
5
5
  /**
6
6
  * MobX state management configuration
7
7
  *
8
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
9
+ * - Additional config
10
+ *
9
11
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
12
  */
11
13
  export function mobx(config) {
12
- const { extends: extendsConfig, files, ...rest } = config ?? {}
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
13
15
 
14
16
  return {
15
17
  extends: [...mobxConfig, ...(extendsConfig ?? [])],
16
- files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(files ?? [])],
18
+ files: onlyFiles ?? ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(files ?? [])],
17
19
  ...rest,
18
20
  }
19
21
  }
@@ -5,15 +5,17 @@ export const nextConfig = [nextPlugin]
5
5
  /**
6
6
  * Next.js framework configuration
7
7
  *
8
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
9
+ * - Additional config
10
+ *
9
11
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
12
  */
11
13
  export function next(config) {
12
- const { extends: extendsConfig, files, ...rest } = config ?? {}
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
13
15
 
14
16
  return {
15
17
  extends: [...nextConfig, ...(extendsConfig ?? [])],
16
- files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(files ?? [])],
18
+ files: onlyFiles ?? ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", ...(files ?? [])],
17
19
  ...rest,
18
20
  }
19
21
  }
@@ -6,15 +6,17 @@ export const nodeConfig = [nodeN, securityNode]
6
6
  /**
7
7
  * Node.js ESLint configuration
8
8
  *
9
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
9
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
10
+ * - Additional config
11
+ *
10
12
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
11
13
  */
12
14
  export function node(config) {
13
- const { extends: extendsConfig, files, ...rest } = config ?? {}
15
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
14
16
 
15
17
  return {
16
18
  extends: [...nodeConfig, ...(extendsConfig ?? [])],
17
- files: [
19
+ files: onlyFiles ?? [
18
20
  "**/*.js",
19
21
  "**/*.cjs",
20
22
  "**/*.mjs",
@@ -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} [config]
10
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
11
11
  * @returns {import("@eslint/config-helpers").ConfigWithExtends}
12
12
  */
13
13
  export function packageJson(config) {
14
- const { extends: extendsConfig, files, ...rest } = config ?? {}
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
15
15
 
16
16
  return {
17
17
  extends: [...packageJsonConfigs, ...(extendsConfig ?? [])],
18
- files: ["**/package.json", ...(files ?? [])],
18
+ files: onlyFiles ?? ["**/package.json", ...(files ?? [])],
19
19
  ...rest,
20
20
  }
21
21
  }
@@ -5,15 +5,17 @@ export const playwrightConfig = [playwrightPlugin]
5
5
  /**
6
6
  * Playwright testing configuration
7
7
  *
8
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
9
+ * - Additional config
10
+ *
9
11
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
12
  */
11
13
  export function playwright(config) {
12
- const { extends: extendsConfig, files, ...rest } = config ?? {}
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
13
15
 
14
16
  return {
15
17
  extends: [...playwrightConfig, ...(extendsConfig ?? [])],
16
- files: [
18
+ files: onlyFiles ?? [
17
19
  "**/*.test.js",
18
20
  "**/*.test.ts",
19
21
  "**/*.spec.js",
@@ -6,15 +6,17 @@ export const reactConfig = [reactPlugin, reactHooksPlugin]
6
6
  /**
7
7
  * React framework configuration
8
8
  *
9
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
9
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
10
+ * - Additional config
11
+ *
10
12
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
11
13
  */
12
14
  export function react(config) {
13
- const { extends: extendsConfig, files, ...rest } = config ?? {}
15
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
14
16
 
15
17
  return {
16
18
  extends: [...reactConfig, ...(extendsConfig ?? [])],
17
- files: ["**/*.jsx", "**/*.tsx", ...(files ?? [])],
19
+ files: onlyFiles ?? ["**/*.jsx", "**/*.tsx", ...(files ?? [])],
18
20
  ...rest,
19
21
  }
20
22
  }
@@ -3,7 +3,9 @@ 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} [config] - Additional config
6
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
7
+ * - Additional config
8
+ *
7
9
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
8
10
  */
9
11
  export function storybook(config) {
@@ -19,11 +21,11 @@ export function storybook(config) {
19
21
  },
20
22
  },
21
23
  ]
22
- const { extends: extendsConfig, files, ...rest } = config ?? {}
24
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
23
25
 
24
26
  return {
25
27
  extends: [...storybookConfig, ...(extendsConfig ?? [])],
26
- files: [
28
+ files: onlyFiles ?? [
27
29
  "**/*.stories.js",
28
30
  "**/*.stories.ts",
29
31
  "**/*.stories.jsx",
@@ -33,15 +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} [config] - Additional config
36
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
37
+ * - Additional config
38
+ *
37
39
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
38
40
  */
39
41
  export function typescriptStrict(config) {
40
- const { extends: extendsConfig, files, ...rest } = config ?? {}
42
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
41
43
 
42
44
  return {
43
45
  extends: [...typescriptStrictConfig, ...(extendsConfig ?? [])],
44
- files: ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts", ...(files ?? [])],
46
+ files: onlyFiles ?? ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts", ...(files ?? [])],
45
47
  ...rest,
46
48
  }
47
49
  }
@@ -27,15 +27,17 @@ export const typescriptConfig = [
27
27
  /**
28
28
  * TypeScript ESLint configuration with parser setup and rules
29
29
  *
30
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
30
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
31
+ * - Additional config
32
+ *
31
33
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
32
34
  */
33
35
  export function typescript(config) {
34
- const { extends: extendsConfig, files, ...rest } = config ?? {}
36
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
35
37
 
36
38
  return {
37
39
  extends: [...typescriptConfig, ...(extendsConfig ?? [])],
38
- files: [
40
+ files: onlyFiles ?? [
39
41
  "**/*.js",
40
42
  "**/*.ts",
41
43
  "**/*.tsx",
@@ -5,15 +5,17 @@ export const vitestConfig = [vitestPlugin]
5
5
  /**
6
6
  * Vitest testing framework configuration
7
7
  *
8
- * @param {import("@eslint/config-helpers").ConfigWithExtends} [config] - Additional config
8
+ * @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
9
+ * - Additional config
10
+ *
9
11
  * @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
10
12
  */
11
13
  export function vitest(config) {
12
- const { extends: extendsConfig, files, ...rest } = config ?? {}
14
+ const { extends: extendsConfig, files, onlyFiles, ...rest } = config ?? {}
13
15
 
14
16
  return {
15
17
  extends: [...vitestConfig, ...(extendsConfig ?? [])],
16
- files: [
18
+ files: onlyFiles ?? [
17
19
  "**/*.test.js",
18
20
  "**/*.test.ts",
19
21
  "**/*.spec.js",
@@ -29,6 +29,7 @@ export function customDefineConfig(ignores, configs = []) {
29
29
  )
30
30
  }
31
31
 
32
+ export * from "./configs/aws.js"
32
33
  export * from "./configs/core.js"
33
34
  export * from "./configs/jest.js"
34
35
  export * from "./configs/mobx.js"
@@ -0,0 +1,27 @@
1
+ import plugin from "eslint-plugin-sonarjs"
2
+
3
+ /** @type {import("@eslint/config-helpers").Config} */
4
+ export const sonarjsAws = {
5
+ plugins: {
6
+ sonarjs: plugin,
7
+ },
8
+ rules: {
9
+ "sonarjs/aws-apigateway-public-api": "error",
10
+ "sonarjs/aws-ec2-rds-dms-public": "error",
11
+ "sonarjs/aws-ec2-unencrypted-ebs-volume": "error",
12
+ "sonarjs/aws-efs-unencrypted": "error",
13
+ "sonarjs/aws-iam-all-privileges": "error",
14
+ "sonarjs/aws-iam-all-resources-accessible": "error",
15
+ "sonarjs/aws-iam-privilege-escalation": "error",
16
+ "sonarjs/aws-iam-public-access": "error",
17
+ "sonarjs/aws-opensearchservice-domain": "error",
18
+ "sonarjs/aws-rds-unencrypted-databases": "error",
19
+ "sonarjs/aws-s3-bucket-granted-access": "error",
20
+ "sonarjs/aws-s3-bucket-insecure-http": "error",
21
+ "sonarjs/aws-s3-bucket-public-access": "error",
22
+ "sonarjs/aws-s3-bucket-versioning": "error",
23
+ "sonarjs/aws-sagemaker-unencrypted-notebook": "error",
24
+ "sonarjs/aws-sns-unencrypted-topics": "error",
25
+ "sonarjs/aws-sqs-unencrypted-queue": "error",
26
+ },
27
+ }
@@ -13,23 +13,6 @@ export const sonarjs = {
13
13
  "sonarjs/array-callback-without-return": "error",
14
14
  "sonarjs/array-constructor": "error",
15
15
  "sonarjs/assertions-in-tests": "error",
16
- "sonarjs/aws-apigateway-public-api": "error",
17
- "sonarjs/aws-ec2-rds-dms-public": "error",
18
- "sonarjs/aws-ec2-unencrypted-ebs-volume": "error",
19
- "sonarjs/aws-efs-unencrypted": "error",
20
- "sonarjs/aws-iam-all-privileges": "error",
21
- "sonarjs/aws-iam-all-resources-accessible": "error",
22
- "sonarjs/aws-iam-privilege-escalation": "error",
23
- "sonarjs/aws-iam-public-access": "error",
24
- "sonarjs/aws-opensearchservice-domain": "error",
25
- "sonarjs/aws-rds-unencrypted-databases": "error",
26
- "sonarjs/aws-s3-bucket-granted-access": "error",
27
- "sonarjs/aws-s3-bucket-insecure-http": "error",
28
- "sonarjs/aws-s3-bucket-public-access": "error",
29
- "sonarjs/aws-s3-bucket-versioning": "error",
30
- "sonarjs/aws-sagemaker-unencrypted-notebook": "error",
31
- "sonarjs/aws-sns-unencrypted-topics": "error",
32
- "sonarjs/aws-sqs-unencrypted-queue": "error",
33
16
  "sonarjs/bitwise-operators": "error",
34
17
  "sonarjs/block-scoped-var": "error",
35
18
  "sonarjs/bool-param-default": "error",