@luxass/eslint-config 4.2.5 → 4.2.7

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 (144) hide show
  1. package/README.md +35 -54
  2. package/dist/index.cjs +166 -479
  3. package/dist/index.d.cts +733 -12
  4. package/dist/index.d.ts +733 -12
  5. package/dist/{configs/index.cjs → index.js} +300 -542
  6. package/package.json +51 -86
  7. package/dist/chunk-4YBQZLPS.mjs +0 -68
  8. package/dist/chunk-4YT54JFZ.mjs +0 -48
  9. package/dist/chunk-5NK24IKQ.mjs +0 -26
  10. package/dist/chunk-6T7MXPCT.mjs +0 -17
  11. package/dist/chunk-7ODEIBF5.mjs +0 -144
  12. package/dist/chunk-AQRBQAKE.mjs +0 -48
  13. package/dist/chunk-DAJA5AV3.mjs +0 -29
  14. package/dist/chunk-DCOLHWHC.mjs +0 -269
  15. package/dist/chunk-DVQQVCGF.mjs +0 -45
  16. package/dist/chunk-EHWA727G.mjs +0 -69
  17. package/dist/chunk-FNOIGW47.mjs +0 -104
  18. package/dist/chunk-KOXCJL3C.mjs +0 -109
  19. package/dist/chunk-MMSZW2UW.mjs +0 -92
  20. package/dist/chunk-MT5P5EKH.mjs +0 -207
  21. package/dist/chunk-O2BXTQHK.mjs +0 -117
  22. package/dist/chunk-QDSV5ONX.mjs +0 -93
  23. package/dist/chunk-QMGT2Z63.mjs +0 -57
  24. package/dist/chunk-RVSUTDCE.mjs +0 -57
  25. package/dist/chunk-SPD4DGYN.mjs +0 -274
  26. package/dist/chunk-UITQW3RA.mjs +0 -293
  27. package/dist/chunk-V57HXOSW.mjs +0 -81
  28. package/dist/chunk-WDSV2EFG.mjs +0 -7
  29. package/dist/chunk-WOBGA3K2.mjs +0 -63
  30. package/dist/chunk-WSQOWO67.mjs +0 -16
  31. package/dist/chunk-XBASVDU6.mjs +0 -215
  32. package/dist/chunk-XPKGXA67.mjs +0 -183
  33. package/dist/chunk-YGZJUKJC.mjs +0 -0
  34. package/dist/chunk-YO3IYQ2L.mjs +0 -220
  35. package/dist/configs/astro.cjs +0 -179
  36. package/dist/configs/astro.d.cts +0 -11
  37. package/dist/configs/astro.d.ts +0 -11
  38. package/dist/configs/astro.mjs +0 -8
  39. package/dist/configs/comments.cjs +0 -63
  40. package/dist/configs/comments.d.cts +0 -15
  41. package/dist/configs/comments.d.ts +0 -15
  42. package/dist/configs/comments.mjs +0 -6
  43. package/dist/configs/formatters.cjs +0 -274
  44. package/dist/configs/formatters.d.cts +0 -11
  45. package/dist/configs/formatters.d.ts +0 -11
  46. package/dist/configs/formatters.mjs +0 -9
  47. package/dist/configs/ignores.cjs +0 -96
  48. package/dist/configs/ignores.d.cts +0 -15
  49. package/dist/configs/ignores.d.ts +0 -15
  50. package/dist/configs/ignores.mjs +0 -7
  51. package/dist/configs/imports.cjs +0 -104
  52. package/dist/configs/imports.d.cts +0 -23
  53. package/dist/configs/imports.d.ts +0 -23
  54. package/dist/configs/imports.mjs +0 -7
  55. package/dist/configs/index.d.cts +0 -20
  56. package/dist/configs/index.d.ts +0 -20
  57. package/dist/configs/index.mjs +0 -104
  58. package/dist/configs/javascript.cjs +0 -324
  59. package/dist/configs/javascript.d.cts +0 -11
  60. package/dist/configs/javascript.d.ts +0 -11
  61. package/dist/configs/javascript.mjs +0 -7
  62. package/dist/configs/jsdoc.cjs +0 -85
  63. package/dist/configs/jsdoc.d.cts +0 -27
  64. package/dist/configs/jsdoc.d.ts +0 -27
  65. package/dist/configs/jsdoc.mjs +0 -7
  66. package/dist/configs/jsonc.cjs +0 -155
  67. package/dist/configs/jsonc.d.cts +0 -11
  68. package/dist/configs/jsonc.d.ts +0 -11
  69. package/dist/configs/jsonc.mjs +0 -8
  70. package/dist/configs/markdown.cjs +0 -164
  71. package/dist/configs/markdown.d.cts +0 -35
  72. package/dist/configs/markdown.d.ts +0 -35
  73. package/dist/configs/markdown.mjs +0 -8
  74. package/dist/configs/nextjs.cjs +0 -180
  75. package/dist/configs/nextjs.d.cts +0 -11
  76. package/dist/configs/nextjs.d.ts +0 -11
  77. package/dist/configs/nextjs.mjs +0 -8
  78. package/dist/configs/node.cjs +0 -60
  79. package/dist/configs/node.d.cts +0 -15
  80. package/dist/configs/node.d.ts +0 -15
  81. package/dist/configs/node.mjs +0 -6
  82. package/dist/configs/perfectionist.cjs +0 -51
  83. package/dist/configs/perfectionist.d.cts +0 -20
  84. package/dist/configs/perfectionist.d.ts +0 -20
  85. package/dist/configs/perfectionist.mjs +0 -6
  86. package/dist/configs/react.cjs +0 -379
  87. package/dist/configs/react.d.cts +0 -11
  88. package/dist/configs/react.d.ts +0 -11
  89. package/dist/configs/react.mjs +0 -8
  90. package/dist/configs/solid.cjs +0 -360
  91. package/dist/configs/solid.d.cts +0 -11
  92. package/dist/configs/solid.d.ts +0 -11
  93. package/dist/configs/solid.mjs +0 -8
  94. package/dist/configs/sort.cjs +0 -240
  95. package/dist/configs/sort.d.cts +0 -26
  96. package/dist/configs/sort.d.ts +0 -26
  97. package/dist/configs/sort.mjs +0 -8
  98. package/dist/configs/stylistic.cjs +0 -98
  99. package/dist/configs/stylistic.d.cts +0 -11
  100. package/dist/configs/stylistic.d.ts +0 -11
  101. package/dist/configs/stylistic.mjs +0 -9
  102. package/dist/configs/tailwindcss.cjs +0 -148
  103. package/dist/configs/tailwindcss.d.cts +0 -11
  104. package/dist/configs/tailwindcss.d.ts +0 -11
  105. package/dist/configs/tailwindcss.mjs +0 -8
  106. package/dist/configs/test.cjs +0 -206
  107. package/dist/configs/test.d.cts +0 -11
  108. package/dist/configs/test.d.ts +0 -11
  109. package/dist/configs/test.mjs +0 -9
  110. package/dist/configs/toml.cjs +0 -131
  111. package/dist/configs/toml.d.cts +0 -11
  112. package/dist/configs/toml.d.ts +0 -11
  113. package/dist/configs/toml.mjs +0 -8
  114. package/dist/configs/typescript.cjs +0 -291
  115. package/dist/configs/typescript.d.cts +0 -11
  116. package/dist/configs/typescript.d.ts +0 -11
  117. package/dist/configs/typescript.mjs +0 -8
  118. package/dist/configs/unicorn.cjs +0 -91
  119. package/dist/configs/unicorn.d.cts +0 -15
  120. package/dist/configs/unicorn.d.ts +0 -15
  121. package/dist/configs/unicorn.mjs +0 -6
  122. package/dist/configs/unocss.cjs +0 -133
  123. package/dist/configs/unocss.d.cts +0 -11
  124. package/dist/configs/unocss.d.ts +0 -11
  125. package/dist/configs/unocss.mjs +0 -8
  126. package/dist/configs/vue.cjs +0 -293
  127. package/dist/configs/vue.d.cts +0 -11
  128. package/dist/configs/vue.d.ts +0 -11
  129. package/dist/configs/vue.mjs +0 -8
  130. package/dist/configs/yaml.cjs +0 -143
  131. package/dist/configs/yaml.d.cts +0 -11
  132. package/dist/configs/yaml.d.ts +0 -11
  133. package/dist/configs/yaml.mjs +0 -8
  134. package/dist/custom-rules/utils.cjs +0 -31
  135. package/dist/custom-rules/utils.d.cts +0 -6
  136. package/dist/custom-rules/utils.d.ts +0 -6
  137. package/dist/custom-rules/utils.mjs +0 -6
  138. package/dist/globs.cjs +0 -158
  139. package/dist/globs.d.cts +0 -28
  140. package/dist/globs.d.ts +0 -28
  141. package/dist/globs.mjs +0 -56
  142. package/dist/index.mjs +0 -284
  143. package/dist/types-HqEzZfQU.d.cts +0 -668
  144. package/dist/types-HqEzZfQU.d.ts +0 -668
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "4.2.5",
3
+ "version": "4.2.7",
4
4
  "description": "ESLint config for @luxass",
5
5
  "type": "module",
6
6
  "author": {
@@ -8,7 +8,7 @@
8
8
  "email": "lucasnrgaard@gmail.com",
9
9
  "url": "https://luxass.dev"
10
10
  },
11
- "packageManager": "pnpm@8.14.1",
11
+ "packageManager": "pnpm@8.15.4",
12
12
  "license": "MIT",
13
13
  "repository": {
14
14
  "type": "git",
@@ -23,49 +23,12 @@
23
23
  ],
24
24
  "exports": {
25
25
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
- }
34
- },
35
- "./globs": {
36
- "import": {
37
- "types": "./dist/globs.d.ts",
38
- "default": "./dist/globs.mjs"
39
- },
40
- "require": {
41
- "types": "./dist/globs.d.cts",
42
- "default": "./dist/globs.cjs"
43
- }
44
- },
45
- "./configs": {
46
- "import": {
47
- "types": "./dist/configs/index.d.ts",
48
- "default": "./dist/configs/index.mjs"
49
- },
50
- "require": {
51
- "types": "./dist/configs/index.d.cts",
52
- "default": "./dist/configs/index.cjs"
53
- }
54
- },
55
- "./configs/*": {
56
- "import": {
57
- "types": "./dist/configs/*.d.ts",
58
- "default": "./dist/configs/*.mjs"
59
- },
60
- "require": {
61
- "types": "./dist/configs/*.d.cts",
62
- "default": "./dist/configs/*.cjs"
63
- }
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.cjs"
64
28
  },
65
29
  "./package.json": "./package.json"
66
30
  },
67
- "main": "./dist/index.cjs",
68
- "module": "./dist/index.mjs",
31
+ "main": "./dist/index.js",
69
32
  "types": "./dist/index.d.ts",
70
33
  "files": [
71
34
  "dist"
@@ -74,7 +37,7 @@
74
37
  "node": ">=18.18.0"
75
38
  },
76
39
  "scripts": {
77
- "build": "tsup",
40
+ "build": "tsup --format esm,cjs --clean --dts",
78
41
  "dev": "tsup --watch",
79
42
  "lint": "eslint . --report-unused-disable-directives",
80
43
  "test": "vitest --run",
@@ -84,19 +47,26 @@
84
47
  "peerDependencies": {
85
48
  "@next/eslint-plugin-next": ">=14.0.0",
86
49
  "@unocss/eslint-plugin": ">=0.50.0",
50
+ "astro-eslint-parser": "^0.16.3",
87
51
  "eslint": ">=8.40.0",
52
+ "eslint-plugin-astro": "^0.31.4",
88
53
  "eslint-plugin-format": ">=0.1.0",
89
54
  "eslint-plugin-react": ">=7.33.2",
90
55
  "eslint-plugin-react-hooks": ">=4.6.0",
91
56
  "eslint-plugin-react-refresh": ">=0.4",
92
- "eslint-plugin-solid": ">=0.13.0",
93
57
  "eslint-plugin-tailwindcss": ">=3.13.0",
94
- "eslint-plugin-vuejs-accessibility": ">=2.2.0"
58
+ "prettier-plugin-astro": "^0.13.0"
95
59
  },
96
60
  "peerDependenciesMeta": {
97
61
  "@unocss/eslint-plugin": {
98
62
  "optional": true
99
63
  },
64
+ "astro-eslint-parser": {
65
+ "optional": true
66
+ },
67
+ "eslint-plugin-astro": {
68
+ "optional": true
69
+ },
100
70
  "eslint-plugin-format": {
101
71
  "optional": true
102
72
  },
@@ -109,16 +79,13 @@
109
79
  "eslint-plugin-react-refresh": {
110
80
  "optional": true
111
81
  },
112
- "@next/eslint-plugin-next": {
113
- "optional": true
114
- },
115
- "eslint-plugin-tailwindcss": {
82
+ "prettier-plugin-astro": {
116
83
  "optional": true
117
84
  },
118
- "eslint-plugin-vuejs-accessibility": {
85
+ "@next/eslint-plugin-next": {
119
86
  "optional": true
120
87
  },
121
- "eslint-plugin-solid": {
88
+ "eslint-plugin-tailwindcss": {
122
89
  "optional": true
123
90
  }
124
91
  },
@@ -126,65 +93,63 @@
126
93
  "@antfu/eslint-define-config": "^1.23.0-2",
127
94
  "@antfu/install-pkg": "^0.3.1",
128
95
  "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
129
- "@eslint-types/jsdoc": "^48.0.2",
130
- "@eslint-types/typescript-eslint": "^6.18.1",
131
- "@eslint-types/unicorn": "^50.0.1",
132
- "@stylistic/eslint-plugin": "^1.5.4",
133
- "@typescript-eslint/eslint-plugin": "^6.19.0",
134
- "@typescript-eslint/parser": "^6.19.0",
135
- "eslint-config-flat-gitignore": "^0.1.2",
96
+ "@eslint-types/jsdoc": "^48.2.0",
97
+ "@eslint-types/typescript-eslint": "^7.0.2",
98
+ "@eslint-types/unicorn": "^51.0.1",
99
+ "@stylistic/eslint-plugin": "^1.6.3",
100
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
101
+ "@typescript-eslint/parser": "^7.1.1",
102
+ "eslint-config-flat-gitignore": "^0.1.3",
136
103
  "eslint-merge-processors": "^0.1.0",
137
104
  "eslint-parser-plain": "^0.1.0",
138
- "eslint-plugin-antfu": "^2.1.1",
139
- "eslint-plugin-astro": "^0.31.3",
105
+ "eslint-plugin-antfu": "^2.1.2",
140
106
  "eslint-plugin-i": "^2.29.1",
141
- "eslint-plugin-jsdoc": "^48.0.2",
142
- "eslint-plugin-jsonc": "^2.12.2",
107
+ "eslint-plugin-jsdoc": "^48.2.1",
108
+ "eslint-plugin-jsonc": "^2.13.0",
143
109
  "eslint-plugin-jsx-a11y": "^6.8.0",
144
- "eslint-plugin-markdown": "^3.0.1",
110
+ "eslint-plugin-markdown": "^4.0.1",
145
111
  "eslint-plugin-n": "^16.6.2",
146
- "eslint-plugin-perfectionist": "^2.5.0",
147
112
  "eslint-plugin-sort-keys": "^2.3.5",
148
113
  "eslint-plugin-toml": "^0.9.2",
149
- "eslint-plugin-unicorn": "^50.0.1",
150
- "eslint-plugin-unused-imports": "^3.0.0",
151
- "eslint-plugin-vitest": "^0.3.20",
152
- "eslint-plugin-vue": "^9.20.1",
114
+ "eslint-plugin-unicorn": "^51.0.1",
115
+ "eslint-plugin-unused-imports": "^3.1.0",
116
+ "eslint-plugin-vitest": "^0.3.24",
117
+ "eslint-plugin-vue": "^9.22.0",
153
118
  "eslint-plugin-yml": "^1.12.2",
154
119
  "eslint-processor-vue-blocks": "^0.1.1",
155
- "globals": "^13.24.0",
120
+ "globals": "^14.0.0",
156
121
  "jsonc-eslint-parser": "^2.4.0",
157
122
  "local-pkg": "^0.5.0",
158
123
  "parse-gitignore": "^2.0.0",
159
124
  "prompts": "^2.4.2",
160
125
  "toml-eslint-parser": "^0.9.3",
161
- "vue-eslint-parser": "^9.4.0",
126
+ "vue-eslint-parser": "^9.4.2",
162
127
  "yaml-eslint-parser": "^1.2.2"
163
128
  },
164
129
  "devDependencies": {
165
130
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
166
- "@next/eslint-plugin-next": "^14.1.0",
167
- "@stylistic/eslint-plugin-migrate": "^1.5.4",
168
- "@types/eslint": "^8.56.2",
131
+ "@next/eslint-plugin-next": "^14.1.3",
132
+ "@stylistic/eslint-plugin-migrate": "^1.6.3",
133
+ "@types/eslint": "^8.56.5",
169
134
  "@types/estree": "^1.0.5",
170
135
  "@types/node": "^18.17.19",
171
136
  "@types/prompts": "^2.4.9",
172
- "@typescript-eslint/rule-tester": "^6.19.0",
173
- "@typescript-eslint/utils": "^6.19.0",
174
- "@unocss/eslint-plugin": "^0.58.3",
175
- "eslint": "^8.56.0",
137
+ "@typescript-eslint/rule-tester": "^7.1.1",
138
+ "@unocss/eslint-plugin": "^0.58.5",
139
+ "astro-eslint-parser": "^0.16.3",
140
+ "eslint": "^8.57.0",
141
+ "eslint-plugin-astro": "^0.31.4",
176
142
  "eslint-plugin-format": "^0.1.0",
177
- "eslint-plugin-react": "^7.33.2",
143
+ "eslint-plugin-react": "^7.34.0",
178
144
  "eslint-plugin-react-hooks": "^4.6.0",
179
145
  "eslint-plugin-react-refresh": "^0.4.5",
180
- "eslint-plugin-solid": "^0.13.1",
181
- "eslint-plugin-tailwindcss": "^3.14.0",
182
- "eslint-plugin-vuejs-accessibility": "^2.2.1",
183
- "lint-staged": "^15.2.0",
184
- "simple-git-hooks": "^2.9.0",
185
- "tsup": "^8.0.1",
186
- "typescript": "^5.3.3",
187
- "vitest": "^1.2.1"
146
+ "eslint-plugin-tailwindcss": "^3.14.3",
147
+ "lint-staged": "^15.2.2",
148
+ "prettier-plugin-astro": "^0.13.0",
149
+ "simple-git-hooks": "^2.10.0",
150
+ "tsup": "^8.0.2",
151
+ "typescript": "^5.4.2",
152
+ "vitest": "^1.3.1"
188
153
  },
189
154
  "simple-git-hooks": {
190
155
  "pre-commit": "pnpm lint-staged"
@@ -1,68 +0,0 @@
1
- // src/utils.ts
2
- import process from "node:process";
3
- import { isPackageExists } from "local-pkg";
4
- async function combine(...configs) {
5
- const resolved = await Promise.all(configs);
6
- return resolved.flat();
7
- }
8
- function renameRules(rules, from, to) {
9
- return Object.fromEntries(
10
- Object.entries(rules).map(([key, value]) => {
11
- if (key.startsWith(from)) {
12
- return [to + key.slice(from.length), value];
13
- }
14
- return [key, value];
15
- })
16
- );
17
- }
18
- function toArray(value) {
19
- return Array.isArray(value) ? value : [value];
20
- }
21
- async function interop(m) {
22
- const resolved = await m;
23
- return resolved.default || resolved;
24
- }
25
- async function ensure(packages) {
26
- if (process.env.CI || process.stdout.isTTY === false) {
27
- return;
28
- }
29
- ;
30
- const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
31
- if (nonExistingPackages.length === 0) {
32
- return;
33
- }
34
- ;
35
- const { default: prompts } = await import("prompts");
36
- const { result } = await prompts([
37
- {
38
- name: "result",
39
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
40
- type: "confirm"
41
- }
42
- ]);
43
- if (result) {
44
- await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, {
45
- dev: true
46
- }));
47
- }
48
- ;
49
- }
50
- function resolveSubOptions(options, key) {
51
- return typeof options[key] === "boolean" ? {} : options[key] || {};
52
- }
53
- function getOverrides(options, key) {
54
- const sub = resolveSubOptions(options, key);
55
- return {
56
- ..."overrides" in sub ? sub.overrides : {}
57
- };
58
- }
59
-
60
- export {
61
- combine,
62
- renameRules,
63
- toArray,
64
- interop,
65
- ensure,
66
- resolveSubOptions,
67
- getOverrides
68
- };
@@ -1,48 +0,0 @@
1
- import {
2
- GLOB_SRC_EXT
3
- } from "./chunk-KOXCJL3C.mjs";
4
-
5
- // src/configs/imports.ts
6
- import pluginImport from "eslint-plugin-i";
7
- import pluginAntfu from "eslint-plugin-antfu";
8
- async function imports(options = {}) {
9
- const {
10
- stylistic = true
11
- } = options;
12
- return [
13
- {
14
- name: "luxass:imports",
15
- plugins: {
16
- antfu: pluginAntfu,
17
- import: pluginImport
18
- },
19
- rules: {
20
- "antfu/import-dedupe": "error",
21
- "antfu/no-import-dist": "error",
22
- "antfu/no-import-node-modules-by-path": "error",
23
- "import/first": "error",
24
- "import/no-duplicates": "error",
25
- "import/no-mutable-exports": "error",
26
- "import/no-named-default": "error",
27
- "import/no-self-import": "error",
28
- "import/no-webpack-loader-syntax": "error",
29
- "import/order": "error",
30
- ...stylistic ? {
31
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
32
- } : {}
33
- }
34
- },
35
- {
36
- name: "luxass:imports:bin",
37
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
38
- rules: {
39
- "antfu/no-import-dist": "off",
40
- "antfu/no-import-node-modules-by-path": "off"
41
- }
42
- }
43
- ];
44
- }
45
-
46
- export {
47
- imports
48
- };
@@ -1,26 +0,0 @@
1
- // src/configs/node.ts
2
- import pluginNode from "eslint-plugin-n";
3
- function node() {
4
- return [
5
- {
6
- name: "luxass:node",
7
- plugins: {
8
- node: pluginNode
9
- },
10
- rules: {
11
- "node/handle-callback-err": ["error", "^(err|error)$"],
12
- "node/no-deprecated-api": "error",
13
- "node/no-exports-assign": "error",
14
- "node/no-new-require": "error",
15
- "node/no-path-concat": "error",
16
- "node/prefer-global/buffer": ["error", "never"],
17
- "node/prefer-global/process": ["error", "never"],
18
- "node/process-exit-as-throw": "error"
19
- }
20
- }
21
- ];
22
- }
23
-
24
- export {
25
- node
26
- };
@@ -1,17 +0,0 @@
1
- // src/configs/perfectionist.ts
2
- import pluginPerfectionist from "eslint-plugin-perfectionist";
3
- async function perfectionist() {
4
- return [
5
- {
6
- name: "luxass:perfectionist",
7
- plugins: {
8
- perfectionist: pluginPerfectionist
9
- },
10
- rules: {}
11
- }
12
- ];
13
- }
14
-
15
- export {
16
- perfectionist
17
- };
@@ -1,144 +0,0 @@
1
- import {
2
- createRule
3
- } from "./chunk-WDSV2EFG.mjs";
4
- import {
5
- interop
6
- } from "./chunk-4YBQZLPS.mjs";
7
- import {
8
- GLOB_TESTS
9
- } from "./chunk-KOXCJL3C.mjs";
10
-
11
- // src/custom-rules/no-only-tests/index.ts
12
- var DEFAULT_OPTIONS = {
13
- blocks: ["describe", "it", "test"],
14
- focus: ["only"]
15
- };
16
- function getPath(node, path = []) {
17
- if (node) {
18
- const nodeName = node.name || node.property && node.property.name;
19
- if (node.object) {
20
- return getPath(node.object, [
21
- nodeName,
22
- ...path
23
- ]);
24
- }
25
- if (node.callee)
26
- return getPath(node.callee, path);
27
- return [nodeName, ...path];
28
- }
29
- return path;
30
- }
31
- var noOnlyTests = createRule({
32
- name: "no-only-tests",
33
- create: (context, [options]) => {
34
- const {
35
- blocks = DEFAULT_OPTIONS.blocks,
36
- focus = DEFAULT_OPTIONS.focus
37
- } = options;
38
- const handler = {
39
- Identifier(node) {
40
- const parent = node.parent?.object;
41
- if (!parent)
42
- return;
43
- if (!focus.includes(node.name))
44
- return;
45
- const callPath = getPath(node.parent).join(".");
46
- const found = blocks.find((block) => {
47
- if (block.endsWith("*"))
48
- return callPath.startsWith(block.replace(/\*$/, ""));
49
- return callPath.startsWith(`${block}.`);
50
- });
51
- if (found) {
52
- context.report({
53
- data: { block: callPath.split(".")[0], focus: node.name },
54
- messageId: "notPermitted",
55
- node
56
- });
57
- }
58
- }
59
- };
60
- return handler;
61
- },
62
- defaultOptions: [{
63
- blocks: ["describe", "it", "test"],
64
- focus: ["only"]
65
- }],
66
- meta: {
67
- docs: {
68
- description: "disallow .only blocks in tests",
69
- recommended: "recommended"
70
- },
71
- messages: {
72
- notPermitted: "{{ block }}.{{ focus }} not permitted"
73
- },
74
- schema: [{
75
- additionalProperties: false,
76
- properties: {
77
- blocks: {
78
- items: {
79
- type: "string"
80
- },
81
- type: "array",
82
- uniqueItems: true
83
- },
84
- focus: {
85
- items: {
86
- type: "string"
87
- },
88
- type: "array",
89
- uniqueItems: true
90
- }
91
- },
92
- type: "object"
93
- }],
94
- type: "layout"
95
- }
96
- // i need to have this here, otherwise typechecking fails.
97
- });
98
-
99
- // src/configs/test.ts
100
- async function test(options = {}) {
101
- const {
102
- editor = false,
103
- files = GLOB_TESTS,
104
- overrides = {}
105
- } = options;
106
- const [
107
- pluginVitest
108
- ] = await Promise.all([
109
- interop(import("eslint-plugin-vitest"))
110
- ]);
111
- return [
112
- {
113
- name: "luxass:test:setup",
114
- plugins: {
115
- test: {
116
- ...pluginVitest,
117
- rules: {
118
- ...pluginVitest.rules,
119
- "no-only-tests": noOnlyTests
120
- }
121
- }
122
- }
123
- },
124
- {
125
- name: "luxass:test:rules",
126
- files,
127
- rules: {
128
- "test/consistent-test-it": [
129
- "error",
130
- { fn: "it", withinDescribe: "it" }
131
- ],
132
- "test/no-identical-title": "error",
133
- "test/no-only-tests": editor ? "off" : "error",
134
- "test/prefer-hooks-in-order": "error",
135
- "test/prefer-lowercase-title": "error",
136
- ...overrides
137
- }
138
- }
139
- ];
140
- }
141
-
142
- export {
143
- test
144
- };
@@ -1,48 +0,0 @@
1
- import {
2
- ensure,
3
- interop
4
- } from "./chunk-4YBQZLPS.mjs";
5
- import {
6
- GLOB_SRC
7
- } from "./chunk-KOXCJL3C.mjs";
8
-
9
- // src/configs/unocss.ts
10
- async function unocss(options = {}) {
11
- const {
12
- attributify = true,
13
- files = [GLOB_SRC],
14
- overrides,
15
- strict = false
16
- } = options;
17
- await ensure([
18
- "@unocss/eslint-plugin"
19
- ]);
20
- const [
21
- pluginUnoCSS
22
- ] = await Promise.all([
23
- interop(import("@unocss/eslint-plugin"))
24
- ]);
25
- return [
26
- {
27
- name: "luxass:unocss",
28
- files,
29
- plugins: {
30
- unocss: pluginUnoCSS
31
- },
32
- rules: {
33
- "unocss/order": "warn",
34
- ...attributify ? {
35
- "unocss/order-attributify": "warn"
36
- } : {},
37
- ...strict ? {
38
- "unocss/blocklist": "error"
39
- } : {},
40
- ...overrides
41
- }
42
- }
43
- ];
44
- }
45
-
46
- export {
47
- unocss
48
- };
@@ -1,29 +0,0 @@
1
- // src/configs/comments.ts
2
- import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
3
- async function comments() {
4
- return [
5
- {
6
- name: "luxass:eslint-comments",
7
- plugins: {
8
- "eslint-comments": eslintCommentsPlugin
9
- },
10
- rules: {
11
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
12
- "eslint-comments/disable-enable-pair": "error",
13
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-aggregating-enable.md
14
- "eslint-comments/no-aggregating-enable": "error",
15
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-duplicate-disable.md
16
- "eslint-comments/no-duplicate-disable": "error",
17
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unlimited-disable.md
18
- "eslint-comments/no-unlimited-disable": "error",
19
- // Deprecated in favor of official reportUnusedDisableDirectives
20
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/133
21
- "eslint-comments/no-unused-enable": "off"
22
- }
23
- }
24
- ];
25
- }
26
-
27
- export {
28
- comments
29
- };