@dvukovic/style-guide 0.14.0 → 0.14.2

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 (123) hide show
  1. package/package.json +5 -3
  2. package/src/eslint/index.js +0 -1
  3. package/dist/scripts/changelog-report.d.ts +0 -1
  4. package/dist/scripts/changelog-report.types.d.ts +0 -28
  5. package/dist/src/eslint/configs/aws.test.d.ts +0 -1
  6. package/dist/src/eslint/configs/core.test.d.ts +0 -1
  7. package/dist/src/eslint/configs/jest.test.d.ts +0 -1
  8. package/dist/src/eslint/configs/mobx.test.d.ts +0 -1
  9. package/dist/src/eslint/configs/next.test.d.ts +0 -1
  10. package/dist/src/eslint/configs/node.test.d.ts +0 -1
  11. package/dist/src/eslint/configs/package-json.test.d.ts +0 -1
  12. package/dist/src/eslint/configs/playwright.test.d.ts +0 -1
  13. package/dist/src/eslint/configs/react.test.d.ts +0 -1
  14. package/dist/src/eslint/configs/storybook.test.d.ts +0 -1
  15. package/dist/src/eslint/configs/typescript-strict.test.d.ts +0 -1
  16. package/dist/src/eslint/configs/typescript.test.d.ts +0 -1
  17. package/dist/src/eslint/configs/vitest.test.d.ts +0 -1
  18. package/dist/src/eslint/plugins/eslint.test.d.ts +0 -1
  19. package/dist/src/eslint/plugins/validate-rules.test.d.ts +0 -1
  20. package/dist/src/eslint/rules/document-todos/document-todos.test.d.ts +0 -1
  21. package/dist/src/eslint/rules/no-commented-out-code/no-commented-out-code.test.d.ts +0 -1
  22. package/dist/src/eslint/rules/no-restricted-dependencies/no-restricted-dependencies.test.d.ts +0 -1
  23. package/dist/src/eslint/rules/no-t/no-t.test.d.ts +0 -1
  24. package/dist/src/eslint/rules/require-properties/require-properties.test.d.ts +0 -1
  25. package/dist/src/eslint/rules/valid-engines-node/valid-engines-node.test.d.ts +0 -1
  26. package/dist/src/prettier/configs/core.test.d.ts +0 -1
  27. package/dist/src/stylelint/configs/core.test.d.ts +0 -1
  28. package/src/eslint/configs/aws.test.js +0 -17
  29. package/src/eslint/configs/core.test.js +0 -23
  30. package/src/eslint/configs/jest.test.js +0 -17
  31. package/src/eslint/configs/mobx.test.js +0 -17
  32. package/src/eslint/configs/next.test.js +0 -17
  33. package/src/eslint/configs/node.test.js +0 -17
  34. package/src/eslint/configs/package-json.test.js +0 -154
  35. package/src/eslint/configs/playwright.test.js +0 -17
  36. package/src/eslint/configs/react.test.js +0 -17
  37. package/src/eslint/configs/storybook.test.js +0 -17
  38. package/src/eslint/configs/typescript-strict.test.js +0 -19
  39. package/src/eslint/configs/typescript.test.js +0 -19
  40. package/src/eslint/configs/vitest.test.js +0 -17
  41. package/src/eslint/plugins/eslint.test.js +0 -42
  42. package/src/eslint/plugins/validate-rules.test.js +0 -68
  43. package/src/eslint/rules/document-todos/document-todos.test.js +0 -174
  44. package/src/eslint/rules/no-commented-out-code/no-commented-out-code.test.js +0 -89
  45. package/src/eslint/rules/no-restricted-dependencies/no-restricted-dependencies.test.js +0 -237
  46. package/src/eslint/rules/no-t/no-t.test.js +0 -85
  47. package/src/eslint/rules/require-properties/require-properties.test.js +0 -164
  48. package/src/eslint/rules/valid-engines-node/valid-engines-node.test.js +0 -154
  49. package/src/prettier/configs/core.test.js +0 -24
  50. package/src/stylelint/configs/core.test.js +0 -24
  51. /package/dist/{src/cli → cli}/generators/cspell.d.ts +0 -0
  52. /package/dist/{src/cli → cli}/generators/eslint.d.ts +0 -0
  53. /package/dist/{src/cli → cli}/generators/knip.d.ts +0 -0
  54. /package/dist/{src/cli → cli}/generators/prettier.d.ts +0 -0
  55. /package/dist/{src/cli → cli}/generators/scripts.d.ts +0 -0
  56. /package/dist/{src/cli → cli}/generators/stylelint.d.ts +0 -0
  57. /package/dist/{src/cli → cli}/index.d.ts +0 -0
  58. /package/dist/{src/cli → cli}/init.d.ts +0 -0
  59. /package/dist/{src/cli → cli}/prompts.d.ts +0 -0
  60. /package/dist/{src/cspell → cspell}/configs/core.d.ts +0 -0
  61. /package/dist/{src/cspell → cspell}/index.d.ts +0 -0
  62. /package/dist/{src/eslint → eslint}/configs/aws.d.ts +0 -0
  63. /package/dist/{src/eslint → eslint}/configs/core.d.ts +0 -0
  64. /package/dist/{src/eslint → eslint}/configs/jest.d.ts +0 -0
  65. /package/dist/{src/eslint → eslint}/configs/mobx.d.ts +0 -0
  66. /package/dist/{src/eslint → eslint}/configs/next.d.ts +0 -0
  67. /package/dist/{src/eslint → eslint}/configs/node.d.ts +0 -0
  68. /package/dist/{src/eslint → eslint}/configs/package-json.d.ts +0 -0
  69. /package/dist/{src/eslint → eslint}/configs/playwright.d.ts +0 -0
  70. /package/dist/{src/eslint → eslint}/configs/react.d.ts +0 -0
  71. /package/dist/{src/eslint → eslint}/configs/storybook.d.ts +0 -0
  72. /package/dist/{src/eslint → eslint}/configs/typescript-strict.d.ts +0 -0
  73. /package/dist/{src/eslint → eslint}/configs/typescript.d.ts +0 -0
  74. /package/dist/{src/eslint → eslint}/configs/vitest.d.ts +0 -0
  75. /package/dist/{src/eslint → eslint}/index.d.ts +0 -0
  76. /package/dist/{src/eslint → eslint}/plugins/baseline.d.ts +0 -0
  77. /package/dist/{src/eslint → eslint}/plugins/dvukovic.d.ts +0 -0
  78. /package/dist/{src/eslint → eslint}/plugins/eslint-comments.d.ts +0 -0
  79. /package/dist/{src/eslint → eslint}/plugins/eslint.d.ts +0 -0
  80. /package/dist/{src/eslint → eslint}/plugins/import-x.d.ts +0 -0
  81. /package/dist/{src/eslint → eslint}/plugins/jest.d.ts +0 -0
  82. /package/dist/{src/eslint → eslint}/plugins/mobx.d.ts +0 -0
  83. /package/dist/{src/eslint → eslint}/plugins/n.d.ts +0 -0
  84. /package/dist/{src/eslint → eslint}/plugins/next.d.ts +0 -0
  85. /package/dist/{src/eslint → eslint}/plugins/package-json.d.ts +0 -0
  86. /package/dist/{src/eslint → eslint}/plugins/playwright.d.ts +0 -0
  87. /package/dist/{src/eslint → eslint}/plugins/promise.d.ts +0 -0
  88. /package/dist/{src/eslint → eslint}/plugins/react-hooks.d.ts +0 -0
  89. /package/dist/{src/eslint → eslint}/plugins/react.d.ts +0 -0
  90. /package/dist/{src/eslint → eslint}/plugins/rimac.d.ts +0 -0
  91. /package/dist/{src/eslint → eslint}/plugins/security-node.d.ts +0 -0
  92. /package/dist/{src/eslint → eslint}/plugins/simple-import-sort.d.ts +0 -0
  93. /package/dist/{src/eslint → eslint}/plugins/sonarjs-aws.d.ts +0 -0
  94. /package/dist/{src/eslint → eslint}/plugins/sonarjs.d.ts +0 -0
  95. /package/dist/{src/eslint → eslint}/plugins/sort-destructure-keys.d.ts +0 -0
  96. /package/dist/{src/eslint → eslint}/plugins/sort-keys-fix.d.ts +0 -0
  97. /package/dist/{src/eslint → eslint}/plugins/storybook.d.ts +0 -0
  98. /package/dist/{src/eslint → eslint}/plugins/stylistic.d.ts +0 -0
  99. /package/dist/{src/eslint → eslint}/plugins/typescript-eslint.d.ts +0 -0
  100. /package/dist/{src/eslint → eslint}/plugins/typescript-sort-keys.d.ts +0 -0
  101. /package/dist/{src/eslint → eslint}/plugins/unicorn.d.ts +0 -0
  102. /package/dist/{src/eslint → eslint}/plugins/unused-imports.d.ts +0 -0
  103. /package/dist/{src/eslint → eslint}/plugins/validate-rules.d.ts +0 -0
  104. /package/dist/{src/eslint → eslint}/plugins/vitest.d.ts +0 -0
  105. /package/dist/{src/eslint → eslint}/rules/document-todos/document-todos.d.ts +0 -0
  106. /package/dist/{src/eslint → eslint}/rules/no-commented-out-code/no-commented-out-code.d.ts +0 -0
  107. /package/dist/{src/eslint → eslint}/rules/no-commented-out-code/no-commented-out-code.utils.d.ts +0 -0
  108. /package/dist/{src/eslint → eslint}/rules/no-restricted-dependencies/no-restricted-dependencies.d.ts +0 -0
  109. /package/dist/{src/eslint → eslint}/rules/no-t/no-t.d.ts +0 -0
  110. /package/dist/{src/eslint → eslint}/rules/require-properties/require-properties.d.ts +0 -0
  111. /package/dist/{src/eslint → eslint}/rules/valid-engines-node/valid-engines-node.d.ts +0 -0
  112. /package/dist/{src/knip → knip}/configs/core.d.ts +0 -0
  113. /package/dist/{src/knip → knip}/index.d.ts +0 -0
  114. /package/dist/{src/prettier → prettier}/configs/core.d.ts +0 -0
  115. /package/dist/{src/prettier → prettier}/index.d.ts +0 -0
  116. /package/dist/{src/prettier → prettier}/plugins/embed.d.ts +0 -0
  117. /package/dist/{src/prettier → prettier}/plugins/prettier.d.ts +0 -0
  118. /package/dist/{src/prettier → prettier}/plugins/sql.d.ts +0 -0
  119. /package/dist/{src/stylelint → stylelint}/configs/core.d.ts +0 -0
  120. /package/dist/{src/stylelint → stylelint}/index.d.ts +0 -0
  121. /package/dist/{src/stylelint → stylelint}/plugins/no-unused-selectors.d.ts +0 -0
  122. /package/dist/{src/stylelint → stylelint}/plugins/order.d.ts +0 -0
  123. /package/dist/{src/stylelint → stylelint}/plugins/stylelint.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvukovic/style-guide",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "My own style guide",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,10 +43,12 @@
43
43
  "src/knip",
44
44
  "src/package-json",
45
45
  "src/prettier",
46
- "src/stylelint"
46
+ "src/stylelint",
47
+ "!**/*.test.js",
48
+ "!**/*.test.ts"
47
49
  ],
48
50
  "scripts": {
49
- "build": "tsc",
51
+ "build": "tsc --project tsconfig.build.json",
50
52
  "lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:stylelint && yarn lint:cspell && yarn lint:knip",
51
53
  "lint:cspell": "cspell --no-progress --no-summary --unique '**'",
52
54
  "lint:eslint": "eslint . --cache --concurrency=auto",
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { defineConfig, globalIgnores } from "eslint/config"
3
2
 
4
3
  /**
@@ -1 +0,0 @@
1
- export {};
@@ -1,28 +0,0 @@
1
- export type OutdatedPackageType = {
2
- current: string;
3
- latest: string;
4
- name: string;
5
- };
6
- export type NpmRegistryResponseType = {
7
- repository?: {
8
- url?: string;
9
- };
10
- };
11
- export type GitHubReleaseType = {
12
- body: string;
13
- name: string;
14
- published_at: string;
15
- tag_name: string;
16
- };
17
- export type PackageChangelogType = {
18
- changelog: string;
19
- current: string;
20
- latest: string;
21
- name: string;
22
- };
23
- export type NpmOutdatedEntryType = {
24
- current: string;
25
- latest: string;
26
- wanted: string;
27
- };
28
- export type NpmOutdatedOutputType = Record<string, NpmOutdatedEntryType>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
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
- })
@@ -1,23 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { coreConfig } from "./core.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: coreConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("core", () => {
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
-
18
- test("detects violations", async () => {
19
- const results = await eslint.lintText("var x = 1\n", { filePath: "test.js" })
20
-
21
- expect(results[0]?.errorCount).toBeGreaterThan(0)
22
- })
23
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { jestConfig } from "./jest.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: jestConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("jest", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.test.js" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { mobxConfig } from "./mobx.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: mobxConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("mobx", () => {
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
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { nextConfig } from "./next.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: nextConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("next", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.tsx" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { nodeConfig } from "./node.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: nodeConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("node", () => {
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
- })
@@ -1,154 +0,0 @@
1
- import { ESLint } from "eslint"
2
- import { defineConfig } from "eslint/config"
3
-
4
- import { packageJsonConfigs, packageJsonWorkspace } from "./package-json.js"
5
-
6
- const eslint = new ESLint({
7
- overrideConfig: [...packageJsonConfigs, { files: ["**/package.json"] }],
8
- overrideConfigFile: true,
9
- })
10
-
11
- describe("package-json", () => {
12
- test("loads without errors", async () => {
13
- const validPackageJson = JSON.stringify(
14
- {
15
- author: "Test Author",
16
- description: "A test package",
17
- engines: {
18
- node: ">=20.0.0",
19
- },
20
- license: "MIT",
21
- name: "test-package",
22
- repository: {
23
- type: "git",
24
- url: "https://github.com/test/test",
25
- },
26
- version: "1.0.0",
27
- },
28
- null,
29
- 4,
30
- )
31
-
32
- const results = await eslint.lintText(validPackageJson, { filePath: "package.json" })
33
-
34
- expect(results).toBeDefined()
35
- expect(results[0]?.fatalErrorCount).toBe(0)
36
- })
37
-
38
- test("detects missing required fields", async () => {
39
- const invalidPackageJson = JSON.stringify(
40
- {
41
- name: "test-package",
42
- },
43
- null,
44
- 4,
45
- )
46
-
47
- const results = await eslint.lintText(invalidPackageJson, { filePath: "package.json" })
48
-
49
- expect(results[0]?.errorCount).toBeGreaterThan(0)
50
- })
51
- })
52
-
53
- describe("packageJsonWorkspace", () => {
54
- test("returns array of two configs", () => {
55
- const configs = packageJsonWorkspace()
56
-
57
- expect(configs).toHaveLength(2)
58
- })
59
-
60
- test("root config targets package.json", () => {
61
- const configs = packageJsonWorkspace()
62
-
63
- expect(configs[0].files).toEqual(["package.json"])
64
- })
65
-
66
- test("nested config targets default workspace patterns", () => {
67
- const configs = packageJsonWorkspace()
68
-
69
- expect(configs[1].files).toEqual(["**/packages/**/package.json", "**/apps/**/package.json"])
70
- })
71
-
72
- test("nested config disables require-properties rule", () => {
73
- const configs = packageJsonWorkspace()
74
-
75
- expect(configs[1].rules).toEqual({
76
- "dvukovic/require-properties": "off",
77
- })
78
- })
79
-
80
- test("accepts custom workspace patterns", () => {
81
- const configs = packageJsonWorkspace({
82
- workspacePatterns: ["**/libs/**/package.json"],
83
- })
84
-
85
- expect(configs[1].files).toEqual(["**/libs/**/package.json"])
86
- })
87
-
88
- test("passes through extends to root config", () => {
89
- const customExtends = [{ rules: { "custom/rule": "error" } }]
90
- const configs = packageJsonWorkspace({ extends: customExtends })
91
-
92
- expect(configs[0].extends).toContain(customExtends[0])
93
- })
94
-
95
- test("root config requires volta.node", async () => {
96
- const workspaceEslint = new ESLint({
97
- overrideConfig: defineConfig(...packageJsonWorkspace()),
98
- overrideConfigFile: true,
99
- })
100
-
101
- const packageWithoutVolta = JSON.stringify(
102
- {
103
- author: "Test Author",
104
- description: "A test package",
105
- engines: { node: ">=24.0.0" },
106
- license: "MIT",
107
- name: "test-package",
108
- repository: { type: "git", url: "https://github.com/test/test" },
109
- version: "1.0.0",
110
- },
111
- null,
112
- 4,
113
- )
114
-
115
- const results = await workspaceEslint.lintText(packageWithoutVolta, {
116
- filePath: "package.json",
117
- })
118
-
119
- const hasVoltaError = results[0]?.messages.some((message) => {
120
- return message.ruleId === "dvukovic/require-properties"
121
- })
122
- expect(hasVoltaError).toBe(true)
123
- })
124
-
125
- test("nested config does not require volta.node", async () => {
126
- const workspaceEslint = new ESLint({
127
- overrideConfig: defineConfig(...packageJsonWorkspace()),
128
- overrideConfigFile: true,
129
- })
130
-
131
- const packageWithoutVolta = JSON.stringify(
132
- {
133
- author: "Test Author",
134
- description: "A test package",
135
- engines: { node: ">=24.0.0" },
136
- license: "MIT",
137
- name: "test-package",
138
- repository: { type: "git", url: "https://github.com/test/test" },
139
- version: "1.0.0",
140
- },
141
- null,
142
- 4,
143
- )
144
-
145
- const results = await workspaceEslint.lintText(packageWithoutVolta, {
146
- filePath: "packages/my-package/package.json",
147
- })
148
-
149
- const hasVoltaError = results[0]?.messages.some((message) => {
150
- return message.ruleId === "dvukovic/require-properties"
151
- })
152
- expect(hasVoltaError).toBe(false)
153
- })
154
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { playwrightConfig } from "./playwright.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: playwrightConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("playwright", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.spec.ts" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { reactConfig } from "./react.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: reactConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("react", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.tsx" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { storybookConfig } from "./storybook.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: storybookConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("storybook", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.stories.tsx" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,19 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { typescriptStrictConfig } from "./typescript-strict.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: typescriptStrictConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("typescript-strict", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x: number = 1\n", {
13
- filePath: "src/eslint/configs/typescript-strict.test.ts",
14
- })
15
-
16
- expect(results).toBeDefined()
17
- expect(results[0]?.fatalErrorCount).toBe(0)
18
- })
19
- })
@@ -1,19 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { typescriptConfig } from "./typescript.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: typescriptConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("typescript", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", {
13
- filePath: "src/eslint/configs/typescript.test.js",
14
- })
15
-
16
- expect(results).toBeDefined()
17
- expect(results[0]?.fatalErrorCount).toBe(0)
18
- })
19
- })
@@ -1,17 +0,0 @@
1
- import { ESLint } from "eslint"
2
-
3
- import { vitestConfig } from "./vitest.js"
4
-
5
- const eslint = new ESLint({
6
- overrideConfig: vitestConfig,
7
- overrideConfigFile: true,
8
- })
9
-
10
- describe("vitest", () => {
11
- test("loads without errors", async () => {
12
- const results = await eslint.lintText("const x = 1\n", { filePath: "test.test.ts" })
13
-
14
- expect(results).toBeDefined()
15
- expect(results[0]?.fatalErrorCount).toBe(0)
16
- })
17
- })
@@ -1,42 +0,0 @@
1
- import { ESLint } from "eslint"
2
- import tseslint from "typescript-eslint"
3
-
4
- import { eslint as base } from "./eslint.js"
5
-
6
- const eslint = new ESLint({
7
- overrideConfig: [
8
- {
9
- files: ["**/*.ts"],
10
- languageOptions: {
11
- parser: tseslint.parser,
12
- },
13
- },
14
- base,
15
- ],
16
- overrideConfigFile: true,
17
- })
18
-
19
- describe("eslint no-enum", () => {
20
- test("detects enum declarations", async () => {
21
- const code = `enum Status { Active, Inactive }\n`
22
- const results = await eslint.lintText(code, { filePath: "test.ts" })
23
-
24
- const enumErrors = results[0]?.messages.filter((message) => {
25
- return message.ruleId === "no-restricted-syntax"
26
- })
27
-
28
- expect(enumErrors?.length).toBe(1)
29
- expect(enumErrors?.[0]?.message).toContain("enum")
30
- })
31
-
32
- test("allows union types", async () => {
33
- const code = `type Status = "active" | "inactive"\n`
34
- const results = await eslint.lintText(code, { filePath: "test.ts" })
35
-
36
- const restrictedSyntaxErrors = results?.[0]?.messages.filter((message) => {
37
- return message.ruleId === "no-restricted-syntax"
38
- })
39
-
40
- expect(restrictedSyntaxErrors?.length).toBe(0)
41
- })
42
- })
@@ -1,68 +0,0 @@
1
- import { baseline } from "./baseline.js"
2
- import { dvukovic } from "./dvukovic.js"
3
- import { eslint } from "./eslint.js"
4
- import { eslintComments } from "./eslint-comments.js"
5
- import { importX } from "./import-x.js"
6
- import { jest } from "./jest.js"
7
- import { mobx } from "./mobx.js"
8
- import { nodeN } from "./n.js"
9
- import { next } from "./next.js"
10
- import { packageJson } from "./package-json.js"
11
- import { playwright } from "./playwright.js"
12
- import { promise } from "./promise.js"
13
- import { react } from "./react.js"
14
- import { reactHooks } from "./react-hooks.js"
15
- import { rimac } from "./rimac.js"
16
- import { securityNode } from "./security-node.js"
17
- import { simpleImportSort } from "./simple-import-sort.js"
18
- import { sonarjs } from "./sonarjs.js"
19
- import { sonarjsAws } from "./sonarjs-aws.js"
20
- import { sortDestructureKeys } from "./sort-destructure-keys.js"
21
- import { sortKeysFix } from "./sort-keys-fix.js"
22
- import { storybook } from "./storybook.js"
23
- import { stylistic } from "./stylistic.js"
24
- import { typescriptEslint } from "./typescript-eslint.js"
25
- import { typescriptSortKeys } from "./typescript-sort-keys.js"
26
- import { unicorn } from "./unicorn.js"
27
- import { unusedImports } from "./unused-imports.js"
28
- import { validatePluginRules } from "./validate-rules.js"
29
- import { vitest } from "./vitest.js"
30
-
31
- const allPlugins = {
32
- baseline,
33
- dvukovic,
34
- eslint,
35
- eslintComments,
36
- importX,
37
- jest,
38
- mobx,
39
- next,
40
- nodeN,
41
- packageJson,
42
- playwright,
43
- promise,
44
- react,
45
- reactHooks,
46
- rimac,
47
- securityNode,
48
- simpleImportSort,
49
- sonarjs,
50
- sonarjsAws,
51
- sortDestructureKeys,
52
- sortKeysFix,
53
- storybook,
54
- stylistic,
55
- typescriptEslint,
56
- typescriptSortKeys,
57
- unicorn,
58
- unusedImports,
59
- vitest,
60
- }
61
-
62
- describe("plugin rules", () => {
63
- for (const [name, config] of Object.entries(allPlugins)) {
64
- test(`${name} has no invalid rules`, () => {
65
- validatePluginRules(config)
66
- })
67
- }
68
- })