@antfu/eslint-config 2.12.2 → 2.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 CHANGED
@@ -12,7 +12,7 @@
12
12
  - [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
13
13
  - Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
14
14
  - Respects `.gitignore` by default
15
- - Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro) support
15
+ - Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support
16
16
  - Optional [formatters](#formatters) support for CSS, HTML, etc.
17
17
  - **Style principle**: Minimal for reading, stable for diff, consistent
18
18
 
@@ -482,6 +482,25 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
482
482
  npm i -D eslint-plugin-astro
483
483
  ```
484
484
 
485
+ #### Solid
486
+
487
+ To enable Solid support, you need to explicitly turn it on:
488
+
489
+ ```js
490
+ // eslint.config.js
491
+ import antfu from '@antfu/eslint-config'
492
+
493
+ export default antfu({
494
+ solid: true,
495
+ })
496
+ ```
497
+
498
+ Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
499
+
500
+ ```bash
501
+ npm i -D eslint-plugin-solid
502
+ ```
503
+
485
504
  #### UnoCSS
486
505
 
487
506
  To enable UnoCSS support, you need to explicitly turn it on:
package/dist/cli.cjs CHANGED
@@ -48,7 +48,7 @@ var import_picocolors = __toESM(require("picocolors"), 1);
48
48
  var package_default = {
49
49
  name: "@antfu/eslint-config",
50
50
  type: "module",
51
- version: "2.12.2",
51
+ version: "2.13.0",
52
52
  packageManager: "pnpm@8.15.6",
53
53
  description: "Anthony's ESLint config",
54
54
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -94,6 +94,7 @@ var package_default = {
94
94
  "eslint-plugin-react": "^7.33.2",
95
95
  "eslint-plugin-react-hooks": "^4.6.0",
96
96
  "eslint-plugin-react-refresh": "^0.4.4",
97
+ "eslint-plugin-solid": "^0.13.2",
97
98
  "eslint-plugin-svelte": ">=2.35.1",
98
99
  "prettier-plugin-astro": "^0.13.0",
99
100
  "prettier-plugin-slidev": "^1.0.5",
@@ -121,6 +122,9 @@ var package_default = {
121
122
  "eslint-plugin-react-refresh": {
122
123
  optional: true
123
124
  },
125
+ "eslint-plugin-solid": {
126
+ optional: true
127
+ },
124
128
  "eslint-plugin-svelte": {
125
129
  optional: true
126
130
  },
@@ -149,14 +153,14 @@ var package_default = {
149
153
  "eslint-plugin-jsdoc": "^48.2.3",
150
154
  "eslint-plugin-jsonc": "^2.15.0",
151
155
  "eslint-plugin-markdown": "^4.0.1",
152
- "eslint-plugin-n": "^16.6.2",
156
+ "eslint-plugin-n": "^17.0.0",
153
157
  "eslint-plugin-no-only-tests": "^3.1.0",
154
158
  "eslint-plugin-perfectionist": "^2.8.0",
155
159
  "eslint-plugin-toml": "^0.11.0",
156
160
  "eslint-plugin-unicorn": "^52.0.0",
157
161
  "eslint-plugin-unused-imports": "^3.1.0",
158
162
  "eslint-plugin-vitest": "^0.4.1",
159
- "eslint-plugin-vue": "^9.24.0",
163
+ "eslint-plugin-vue": "^9.24.1",
160
164
  "eslint-plugin-yml": "^1.14.0",
161
165
  "eslint-processor-vue-blocks": "^0.1.1",
162
166
  globals: "^15.0.0",
@@ -177,18 +181,19 @@ var package_default = {
177
181
  "@stylistic/eslint-plugin-migrate": "^1.7.0",
178
182
  "@types/eslint": "^8.56.7",
179
183
  "@types/fs-extra": "^11.0.4",
180
- "@types/node": "^20.12.4",
184
+ "@types/node": "^20.12.5",
181
185
  "@types/prompts": "^2.4.9",
182
186
  "@types/yargs": "^17.0.32",
183
187
  "@unocss/eslint-plugin": "^0.59.0",
184
- "astro-eslint-parser": "^0.16.3",
188
+ "astro-eslint-parser": "^0.17.0",
185
189
  bumpp: "^9.4.0",
186
190
  eslint: "^9.0.0",
187
- "eslint-plugin-astro": "^0.33.1",
191
+ "eslint-plugin-astro": "^0.34.0",
188
192
  "eslint-plugin-format": "^0.1.0",
189
193
  "eslint-plugin-react": "^7.34.1",
190
194
  "eslint-plugin-react-hooks": "^4.6.0",
191
195
  "eslint-plugin-react-refresh": "^0.4.6",
196
+ "eslint-plugin-solid": "^0.13.2",
192
197
  "eslint-plugin-svelte": "2.36.0-next.13",
193
198
  "eslint-typegen": "^0.2.0",
194
199
  esno: "^4.7.0",
@@ -201,7 +206,7 @@ var package_default = {
201
206
  rimraf: "^5.0.5",
202
207
  "simple-git-hooks": "^2.11.1",
203
208
  svelte: "^4.2.12",
204
- "svelte-eslint-parser": "^0.33.1",
209
+ "svelte-eslint-parser": "^0.34.0",
205
210
  tsup: "^8.0.2",
206
211
  typescript: "^5.4.4",
207
212
  vitest: "^1.4.0",
@@ -277,6 +282,10 @@ var frameworkOptions = [
277
282
  label: import_picocolors.default.magenta("Astro"),
278
283
  value: "astro"
279
284
  },
285
+ {
286
+ label: import_picocolors.default.cyan("Solid"),
287
+ value: "solid"
288
+ },
280
289
  {
281
290
  label: import_picocolors.default.blue("Slidev"),
282
291
  value: "slidev"
@@ -308,6 +317,9 @@ var dependenciesMap = {
308
317
  slidev: [
309
318
  "prettier-plugin-slidev"
310
319
  ],
320
+ solid: [
321
+ "eslint-plugin-solid"
322
+ ],
311
323
  svelte: [
312
324
  "eslint-plugin-svelte",
313
325
  "svelte-eslint-parser"
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import c from "picocolors";
19
19
  var package_default = {
20
20
  name: "@antfu/eslint-config",
21
21
  type: "module",
22
- version: "2.12.2",
22
+ version: "2.13.0",
23
23
  packageManager: "pnpm@8.15.6",
24
24
  description: "Anthony's ESLint config",
25
25
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -65,6 +65,7 @@ var package_default = {
65
65
  "eslint-plugin-react": "^7.33.2",
66
66
  "eslint-plugin-react-hooks": "^4.6.0",
67
67
  "eslint-plugin-react-refresh": "^0.4.4",
68
+ "eslint-plugin-solid": "^0.13.2",
68
69
  "eslint-plugin-svelte": ">=2.35.1",
69
70
  "prettier-plugin-astro": "^0.13.0",
70
71
  "prettier-plugin-slidev": "^1.0.5",
@@ -92,6 +93,9 @@ var package_default = {
92
93
  "eslint-plugin-react-refresh": {
93
94
  optional: true
94
95
  },
96
+ "eslint-plugin-solid": {
97
+ optional: true
98
+ },
95
99
  "eslint-plugin-svelte": {
96
100
  optional: true
97
101
  },
@@ -120,14 +124,14 @@ var package_default = {
120
124
  "eslint-plugin-jsdoc": "^48.2.3",
121
125
  "eslint-plugin-jsonc": "^2.15.0",
122
126
  "eslint-plugin-markdown": "^4.0.1",
123
- "eslint-plugin-n": "^16.6.2",
127
+ "eslint-plugin-n": "^17.0.0",
124
128
  "eslint-plugin-no-only-tests": "^3.1.0",
125
129
  "eslint-plugin-perfectionist": "^2.8.0",
126
130
  "eslint-plugin-toml": "^0.11.0",
127
131
  "eslint-plugin-unicorn": "^52.0.0",
128
132
  "eslint-plugin-unused-imports": "^3.1.0",
129
133
  "eslint-plugin-vitest": "^0.4.1",
130
- "eslint-plugin-vue": "^9.24.0",
134
+ "eslint-plugin-vue": "^9.24.1",
131
135
  "eslint-plugin-yml": "^1.14.0",
132
136
  "eslint-processor-vue-blocks": "^0.1.1",
133
137
  globals: "^15.0.0",
@@ -148,18 +152,19 @@ var package_default = {
148
152
  "@stylistic/eslint-plugin-migrate": "^1.7.0",
149
153
  "@types/eslint": "^8.56.7",
150
154
  "@types/fs-extra": "^11.0.4",
151
- "@types/node": "^20.12.4",
155
+ "@types/node": "^20.12.5",
152
156
  "@types/prompts": "^2.4.9",
153
157
  "@types/yargs": "^17.0.32",
154
158
  "@unocss/eslint-plugin": "^0.59.0",
155
- "astro-eslint-parser": "^0.16.3",
159
+ "astro-eslint-parser": "^0.17.0",
156
160
  bumpp: "^9.4.0",
157
161
  eslint: "^9.0.0",
158
- "eslint-plugin-astro": "^0.33.1",
162
+ "eslint-plugin-astro": "^0.34.0",
159
163
  "eslint-plugin-format": "^0.1.0",
160
164
  "eslint-plugin-react": "^7.34.1",
161
165
  "eslint-plugin-react-hooks": "^4.6.0",
162
166
  "eslint-plugin-react-refresh": "^0.4.6",
167
+ "eslint-plugin-solid": "^0.13.2",
163
168
  "eslint-plugin-svelte": "2.36.0-next.13",
164
169
  "eslint-typegen": "^0.2.0",
165
170
  esno: "^4.7.0",
@@ -172,7 +177,7 @@ var package_default = {
172
177
  rimraf: "^5.0.5",
173
178
  "simple-git-hooks": "^2.11.1",
174
179
  svelte: "^4.2.12",
175
- "svelte-eslint-parser": "^0.33.1",
180
+ "svelte-eslint-parser": "^0.34.0",
176
181
  tsup: "^8.0.2",
177
182
  typescript: "^5.4.4",
178
183
  vitest: "^1.4.0",
@@ -248,6 +253,10 @@ var frameworkOptions = [
248
253
  label: c.magenta("Astro"),
249
254
  value: "astro"
250
255
  },
256
+ {
257
+ label: c.cyan("Solid"),
258
+ value: "solid"
259
+ },
251
260
  {
252
261
  label: c.blue("Slidev"),
253
262
  value: "slidev"
@@ -279,6 +288,9 @@ var dependenciesMap = {
279
288
  slidev: [
280
289
  "prettier-plugin-slidev"
281
290
  ],
291
+ solid: [
292
+ "eslint-plugin-solid"
293
+ ],
282
294
  svelte: [
283
295
  "eslint-plugin-svelte",
284
296
  "svelte-eslint-parser"
package/dist/index.cjs CHANGED
@@ -81,6 +81,7 @@ __export(src_exports, {
81
81
  renamePluginInConfigs: () => renamePluginInConfigs,
82
82
  renameRules: () => renameRules,
83
83
  resolveSubOptions: () => resolveSubOptions,
84
+ solid: () => solid,
84
85
  sortPackageJson: () => sortPackageJson,
85
86
  sortTsconfig: () => sortTsconfig,
86
87
  stylistic: () => stylistic,
@@ -2078,6 +2079,82 @@ async function astro(options = {}) {
2078
2079
  ];
2079
2080
  }
2080
2081
 
2082
+ // src/configs/solid.ts
2083
+ async function solid(options = {}) {
2084
+ const {
2085
+ files = [GLOB_JSX, GLOB_TSX],
2086
+ overrides = {},
2087
+ typescript: typescript2 = true
2088
+ } = options;
2089
+ await ensurePackages([
2090
+ "eslint-plugin-solid"
2091
+ ]);
2092
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2093
+ const isTypeAware = !!tsconfigPath;
2094
+ const [
2095
+ pluginSolid,
2096
+ parserTs
2097
+ ] = await Promise.all([
2098
+ interopDefault(import("eslint-plugin-solid")),
2099
+ interopDefault(import("@typescript-eslint/parser"))
2100
+ ]);
2101
+ return [
2102
+ {
2103
+ name: "antfu/solid/setup",
2104
+ plugins: {
2105
+ solid: pluginSolid
2106
+ }
2107
+ },
2108
+ {
2109
+ files,
2110
+ languageOptions: {
2111
+ parser: parserTs,
2112
+ parserOptions: {
2113
+ ecmaFeatures: {
2114
+ jsx: true
2115
+ },
2116
+ ...isTypeAware ? { project: tsconfigPath } : {}
2117
+ },
2118
+ sourceType: "module"
2119
+ },
2120
+ name: "antfu/solid/rules",
2121
+ rules: {
2122
+ // reactivity
2123
+ "solid/components-return-once": "warn",
2124
+ "solid/event-handlers": ["error", {
2125
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
2126
+ ignoreCase: false,
2127
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
2128
+ warnOnSpread: false
2129
+ }],
2130
+ // these rules are mostly style suggestions
2131
+ "solid/imports": "error",
2132
+ // identifier usage is important
2133
+ "solid/jsx-no-duplicate-props": "error",
2134
+ "solid/jsx-no-script-url": "error",
2135
+ "solid/jsx-no-undef": "error",
2136
+ "solid/jsx-uses-vars": "error",
2137
+ "solid/no-destructure": "error",
2138
+ // security problems
2139
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
2140
+ "solid/no-react-deps": "error",
2141
+ "solid/no-react-specific-props": "error",
2142
+ "solid/no-unknown-namespaces": "error",
2143
+ "solid/prefer-for": "error",
2144
+ "solid/reactivity": "warn",
2145
+ "solid/self-closing-comp": "error",
2146
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
2147
+ ...typescript2 ? {
2148
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
2149
+ "solid/no-unknown-namespaces": "off"
2150
+ } : {},
2151
+ // overrides
2152
+ ...overrides
2153
+ }
2154
+ }
2155
+ ];
2156
+ }
2157
+
2081
2158
  // src/factory.ts
2082
2159
  var flatConfigProps = [
2083
2160
  "name",
@@ -2112,6 +2189,7 @@ function antfu(options = {}, ...userConfigs) {
2112
2189
  gitignore: enableGitignore = true,
2113
2190
  isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
2114
2191
  react: enableReact = false,
2192
+ solid: enableSolid = false,
2115
2193
  svelte: enableSvelte = false,
2116
2194
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2117
2195
  unocss: enableUnoCSS = false,
@@ -2182,6 +2260,13 @@ function antfu(options = {}, ...userConfigs) {
2182
2260
  typescript: !!enableTypeScript
2183
2261
  }));
2184
2262
  }
2263
+ if (enableSolid) {
2264
+ configs.push(solid({
2265
+ overrides: getOverrides(options, "solid"),
2266
+ tsconfigPath: getOverrides(options, "typescript").tsconfigPath,
2267
+ typescript: !!enableTypeScript
2268
+ }));
2269
+ }
2185
2270
  if (enableSvelte) {
2186
2271
  configs.push(svelte({
2187
2272
  overrides: getOverrides(options, "svelte"),
@@ -2321,6 +2406,7 @@ var src_default = antfu;
2321
2406
  renamePluginInConfigs,
2322
2407
  renameRules,
2323
2408
  resolveSubOptions,
2409
+ solid,
2324
2410
  sortPackageJson,
2325
2411
  sortTsconfig,
2326
2412
  stylistic,