@antfu/eslint-config 2.12.2 → 2.13.1

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.1",
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
  },
@@ -138,8 +142,8 @@ var package_default = {
138
142
  "@antfu/install-pkg": "^0.3.2",
139
143
  "@clack/prompts": "^0.7.0",
140
144
  "@stylistic/eslint-plugin": "^1.7.0",
141
- "@typescript-eslint/eslint-plugin": "^7.5.0",
142
- "@typescript-eslint/parser": "^7.5.0",
145
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
146
+ "@typescript-eslint/parser": "^7.6.0",
143
147
  "eslint-config-flat-gitignore": "^0.1.5",
144
148
  "eslint-flat-config-utils": "^0.2.1",
145
149
  "eslint-merge-processors": "^0.1.0",
@@ -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.1.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
- "eslint-plugin-vitest": "^0.4.1",
159
- "eslint-plugin-vue": "^9.24.0",
162
+ "eslint-plugin-vitest": "^0.5.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",
@@ -173,24 +177,25 @@ var package_default = {
173
177
  "@antfu/eslint-config": "workspace:*",
174
178
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
175
179
  "@antfu/ni": "^0.21.12",
176
- "@eslint/config-inspector": "^0.4.1",
180
+ "@eslint/config-inspector": "^0.4.4",
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.6",
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
- "eslint-typegen": "^0.2.0",
198
+ "eslint-typegen": "^0.2.1",
194
199
  esno: "^4.7.0",
195
200
  execa: "^8.0.1",
196
201
  "fast-glob": "^3.3.2",
@@ -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.1",
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.1",
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
  },
@@ -109,8 +113,8 @@ var package_default = {
109
113
  "@antfu/install-pkg": "^0.3.2",
110
114
  "@clack/prompts": "^0.7.0",
111
115
  "@stylistic/eslint-plugin": "^1.7.0",
112
- "@typescript-eslint/eslint-plugin": "^7.5.0",
113
- "@typescript-eslint/parser": "^7.5.0",
116
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
117
+ "@typescript-eslint/parser": "^7.6.0",
114
118
  "eslint-config-flat-gitignore": "^0.1.5",
115
119
  "eslint-flat-config-utils": "^0.2.1",
116
120
  "eslint-merge-processors": "^0.1.0",
@@ -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.1.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
- "eslint-plugin-vitest": "^0.4.1",
130
- "eslint-plugin-vue": "^9.24.0",
133
+ "eslint-plugin-vitest": "^0.5.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",
@@ -144,24 +148,25 @@ var package_default = {
144
148
  "@antfu/eslint-config": "workspace:*",
145
149
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
146
150
  "@antfu/ni": "^0.21.12",
147
- "@eslint/config-inspector": "^0.4.1",
151
+ "@eslint/config-inspector": "^0.4.4",
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.6",
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
- "eslint-typegen": "^0.2.0",
169
+ "eslint-typegen": "^0.2.1",
165
170
  esno: "^4.7.0",
166
171
  execa: "^8.0.1",
167
172
  "fast-glob": "^3.3.2",
@@ -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.1",
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,
@@ -451,7 +452,13 @@ async function javascript(options = {}) {
451
452
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
452
453
  "unused-imports/no-unused-vars": [
453
454
  "error",
454
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
455
+ {
456
+ args: "after-used",
457
+ argsIgnorePattern: "^_",
458
+ ignoreRestSiblings: true,
459
+ vars: "all",
460
+ varsIgnorePattern: "^_"
461
+ }
455
462
  ],
456
463
  "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
457
464
  "valid-typeof": ["error", { requireStringLiterals: true }],
@@ -2078,6 +2085,82 @@ async function astro(options = {}) {
2078
2085
  ];
2079
2086
  }
2080
2087
 
2088
+ // src/configs/solid.ts
2089
+ async function solid(options = {}) {
2090
+ const {
2091
+ files = [GLOB_JSX, GLOB_TSX],
2092
+ overrides = {},
2093
+ typescript: typescript2 = true
2094
+ } = options;
2095
+ await ensurePackages([
2096
+ "eslint-plugin-solid"
2097
+ ]);
2098
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2099
+ const isTypeAware = !!tsconfigPath;
2100
+ const [
2101
+ pluginSolid,
2102
+ parserTs
2103
+ ] = await Promise.all([
2104
+ interopDefault(import("eslint-plugin-solid")),
2105
+ interopDefault(import("@typescript-eslint/parser"))
2106
+ ]);
2107
+ return [
2108
+ {
2109
+ name: "antfu/solid/setup",
2110
+ plugins: {
2111
+ solid: pluginSolid
2112
+ }
2113
+ },
2114
+ {
2115
+ files,
2116
+ languageOptions: {
2117
+ parser: parserTs,
2118
+ parserOptions: {
2119
+ ecmaFeatures: {
2120
+ jsx: true
2121
+ },
2122
+ ...isTypeAware ? { project: tsconfigPath } : {}
2123
+ },
2124
+ sourceType: "module"
2125
+ },
2126
+ name: "antfu/solid/rules",
2127
+ rules: {
2128
+ // reactivity
2129
+ "solid/components-return-once": "warn",
2130
+ "solid/event-handlers": ["error", {
2131
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
2132
+ ignoreCase: false,
2133
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
2134
+ warnOnSpread: false
2135
+ }],
2136
+ // these rules are mostly style suggestions
2137
+ "solid/imports": "error",
2138
+ // identifier usage is important
2139
+ "solid/jsx-no-duplicate-props": "error",
2140
+ "solid/jsx-no-script-url": "error",
2141
+ "solid/jsx-no-undef": "error",
2142
+ "solid/jsx-uses-vars": "error",
2143
+ "solid/no-destructure": "error",
2144
+ // security problems
2145
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
2146
+ "solid/no-react-deps": "error",
2147
+ "solid/no-react-specific-props": "error",
2148
+ "solid/no-unknown-namespaces": "error",
2149
+ "solid/prefer-for": "error",
2150
+ "solid/reactivity": "warn",
2151
+ "solid/self-closing-comp": "error",
2152
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
2153
+ ...typescript2 ? {
2154
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
2155
+ "solid/no-unknown-namespaces": "off"
2156
+ } : {},
2157
+ // overrides
2158
+ ...overrides
2159
+ }
2160
+ }
2161
+ ];
2162
+ }
2163
+
2081
2164
  // src/factory.ts
2082
2165
  var flatConfigProps = [
2083
2166
  "name",
@@ -2112,6 +2195,7 @@ function antfu(options = {}, ...userConfigs) {
2112
2195
  gitignore: enableGitignore = true,
2113
2196
  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
2197
  react: enableReact = false,
2198
+ solid: enableSolid = false,
2115
2199
  svelte: enableSvelte = false,
2116
2200
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2117
2201
  unocss: enableUnoCSS = false,
@@ -2182,6 +2266,13 @@ function antfu(options = {}, ...userConfigs) {
2182
2266
  typescript: !!enableTypeScript
2183
2267
  }));
2184
2268
  }
2269
+ if (enableSolid) {
2270
+ configs.push(solid({
2271
+ overrides: getOverrides(options, "solid"),
2272
+ tsconfigPath: getOverrides(options, "typescript").tsconfigPath,
2273
+ typescript: !!enableTypeScript
2274
+ }));
2275
+ }
2185
2276
  if (enableSvelte) {
2186
2277
  configs.push(svelte({
2187
2278
  overrides: getOverrides(options, "svelte"),
@@ -2321,6 +2412,7 @@ var src_default = antfu;
2321
2412
  renamePluginInConfigs,
2322
2413
  renameRules,
2323
2414
  resolveSubOptions,
2415
+ solid,
2324
2416
  sortPackageJson,
2325
2417
  sortTsconfig,
2326
2418
  stylistic,