@kirklin/eslint-config 2.8.0 → 3.0.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/dist/index.js CHANGED
@@ -386,7 +386,7 @@ async function stylistic(options = {}) {
386
386
  "style/brace-style": ["error", "1tbs", { allowSingleLine: false }],
387
387
  "style/member-delimiter-style": ["error", { multiline: { delimiter: "semi" } }],
388
388
  ...lessOpinionated ? {
389
- curly: ["error", "multi-or-nest", "consistent"]
389
+ curly: ["error", "all"]
390
390
  } : {
391
391
  "curly": ["error", "all"],
392
392
  "kirklin/if-newline": "error",
@@ -705,6 +705,7 @@ async function imports(options = {}) {
705
705
  kirklin: default3
706
706
  },
707
707
  rules: {
708
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
708
709
  "import/first": "error",
709
710
  "import/no-duplicates": "error",
710
711
  "import/no-mutable-exports": "error",
@@ -893,7 +894,7 @@ async function javascript(options = {}) {
893
894
  }
894
895
  ],
895
896
  "prefer-const": [
896
- "error",
897
+ isInEditor ? "warn" : "error",
897
898
  {
898
899
  destructuring: "all",
899
900
  ignoreReadBeforeAssign: true
@@ -907,7 +908,7 @@ async function javascript(options = {}) {
907
908
  "prefer-template": "error",
908
909
  "symbol-description": "error",
909
910
  "unicode-bom": ["error", "never"],
910
- "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
911
+ "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
911
912
  "unused-imports/no-unused-vars": [
912
913
  "error",
913
914
  {
@@ -1202,6 +1203,12 @@ var RemixPackages = [
1202
1203
  "@remix-run/serve",
1203
1204
  "@remix-run/dev"
1204
1205
  ];
1206
+ var ReactRouterPackages = [
1207
+ "@react-router/node",
1208
+ "@react-router/react",
1209
+ "@react-router/serve",
1210
+ "@react-router/dev"
1211
+ ];
1205
1212
  var NextJsPackages = [
1206
1213
  "next"
1207
1214
  ];
@@ -1236,6 +1243,7 @@ async function react(options = {}) {
1236
1243
  ]);
1237
1244
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists3(i));
1238
1245
  const isUsingRemix = RemixPackages.some((i) => isPackageExists3(i));
1246
+ const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists3(i));
1239
1247
  const isUsingNext = NextJsPackages.some((i) => isPackageExists3(i));
1240
1248
  const plugins = pluginReact.configs.all.plugins;
1241
1249
  return [
@@ -1247,7 +1255,8 @@ async function react(options = {}) {
1247
1255
  "react-hooks": pluginReactHooks,
1248
1256
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1249
1257
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1250
- "react-refresh": pluginReactRefresh
1258
+ "react-refresh": pluginReactRefresh,
1259
+ "react-web-api": plugins["@eslint-react/web-api"]
1251
1260
  }
1252
1261
  },
1253
1262
  {
@@ -1298,7 +1307,7 @@ async function react(options = {}) {
1298
1307
  "viewport",
1299
1308
  "generateViewport"
1300
1309
  ] : [],
1301
- ...isUsingRemix ? [
1310
+ ...isUsingRemix || isUsingReactRouter ? [
1302
1311
  "meta",
1303
1312
  "links",
1304
1313
  "headers",
@@ -1308,27 +1317,37 @@ async function react(options = {}) {
1308
1317
  ]
1309
1318
  }
1310
1319
  ],
1320
+ // recommended rules from @eslint-react/web-api
1321
+ "react-web-api/no-leaked-event-listener": "warn",
1322
+ "react-web-api/no-leaked-interval": "warn",
1323
+ "react-web-api/no-leaked-resize-observer": "warn",
1324
+ "react-web-api/no-leaked-timeout": "warn",
1311
1325
  // recommended rules from @eslint-react
1312
1326
  "react/ensure-forward-ref-using-ref": "warn",
1327
+ "react/jsx-no-duplicate-props": "warn",
1328
+ "react/jsx-uses-vars": "warn",
1313
1329
  "react/no-access-state-in-setstate": "error",
1314
1330
  "react/no-array-index-key": "warn",
1315
1331
  "react/no-children-count": "warn",
1316
1332
  "react/no-children-for-each": "warn",
1317
1333
  "react/no-children-map": "warn",
1318
1334
  "react/no-children-only": "warn",
1319
- "react/no-children-prop": "warn",
1320
1335
  "react/no-children-to-array": "warn",
1321
1336
  "react/no-clone-element": "warn",
1322
1337
  "react/no-comment-textnodes": "warn",
1323
1338
  "react/no-component-will-mount": "error",
1324
1339
  "react/no-component-will-receive-props": "error",
1325
1340
  "react/no-component-will-update": "error",
1341
+ "react/no-context-provider": "warn",
1326
1342
  "react/no-create-ref": "error",
1343
+ "react/no-default-props": "error",
1327
1344
  "react/no-direct-mutation-state": "error",
1328
1345
  "react/no-duplicate-key": "error",
1329
- "react/no-implicit-key": "error",
1346
+ "react/no-forward-ref": "warn",
1347
+ "react/no-implicit-key": "warn",
1330
1348
  "react/no-missing-key": "error",
1331
- "react/no-nested-components": "warn",
1349
+ "react/no-nested-components": "error",
1350
+ "react/no-prop-types": "error",
1332
1351
  "react/no-redundant-should-component-update": "error",
1333
1352
  "react/no-set-state-in-component-did-mount": "warn",
1334
1353
  "react/no-set-state-in-component-did-update": "warn",
@@ -1337,11 +1356,10 @@ async function react(options = {}) {
1337
1356
  "react/no-unsafe-component-will-mount": "warn",
1338
1357
  "react/no-unsafe-component-will-receive-props": "warn",
1339
1358
  "react/no-unsafe-component-will-update": "warn",
1340
- "react/no-unstable-context-value": "error",
1341
- "react/no-unstable-default-props": "error",
1359
+ "react/no-unstable-context-value": "warn",
1360
+ "react/no-unstable-default-props": "warn",
1342
1361
  "react/no-unused-class-component-members": "warn",
1343
1362
  "react/no-unused-state": "warn",
1344
- "react/no-useless-fragment": "warn",
1345
1363
  "react/prefer-destructuring-assignment": "warn",
1346
1364
  "react/prefer-shorthand-boolean": "warn",
1347
1365
  "react/prefer-shorthand-fragment": "warn",
@@ -1829,7 +1847,7 @@ async function test(options = {}) {
1829
1847
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1830
1848
  "test/no-identical-title": "error",
1831
1849
  "test/no-import-node-test": "error",
1832
- "test/no-only-tests": isInEditor ? "off" : "error",
1850
+ "test/no-only-tests": isInEditor ? "warn" : "error",
1833
1851
  "test/prefer-hooks-in-order": "error",
1834
1852
  "test/prefer-lowercase-title": "error",
1835
1853
  // Disables
@@ -2014,6 +2032,7 @@ async function typescript(options = {}) {
2014
2032
  "ts/consistent-type-definitions": ["error", "interface"],
2015
2033
  "ts/consistent-type-imports": ["error", {
2016
2034
  disallowTypeAnnotations: false,
2035
+ fixStyle: "separate-type-imports",
2017
2036
  prefer: "type-imports"
2018
2037
  }],
2019
2038
  "ts/method-signature-style": ["error", "property"],
@@ -2405,7 +2424,7 @@ function kirklin(options = {}, ...userConfigs) {
2405
2424
  if (isInEditor == null) {
2406
2425
  isInEditor = isInEditorEnv();
2407
2426
  if (isInEditor) {
2408
- console.info("[@kirklin/eslint-config] Detected running in editor, some rules are disabled.");
2427
+ console.log("[@kirklin/eslint-config] Detected running in editor, some rules are disabled.");
2409
2428
  }
2410
2429
  }
2411
2430
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
@@ -2489,6 +2508,7 @@ function kirklin(options = {}, ...userConfigs) {
2489
2508
  }
2490
2509
  if (enableReact) {
2491
2510
  configs2.push(react({
2511
+ ...typescriptOptions,
2492
2512
  overrides: getOverrides(options, "react"),
2493
2513
  tsconfigPath
2494
2514
  }));
@@ -2580,6 +2600,15 @@ function kirklin(options = {}, ...userConfigs) {
2580
2600
  if (autoRenamePlugins) {
2581
2601
  composer = composer.renamePlugins(defaultPluginRenaming);
2582
2602
  }
2603
+ if (isInEditor) {
2604
+ composer = composer.disableRulesFix([
2605
+ "unused-imports/no-unused-imports",
2606
+ "test/no-only-tests",
2607
+ "prefer-const"
2608
+ ], {
2609
+ builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules)
2610
+ });
2611
+ }
2583
2612
  return composer;
2584
2613
  }
2585
2614
  function resolveSubOptions(options, key) {
@@ -2594,7 +2623,7 @@ function getOverrides(options, key) {
2594
2623
  }
2595
2624
 
2596
2625
  // src/index.ts
2597
- var src_default = kirklin;
2626
+ var index_default = kirklin;
2598
2627
  export {
2599
2628
  GLOB_ALL_SRC,
2600
2629
  GLOB_ASTRO,
@@ -2631,7 +2660,7 @@ export {
2631
2660
  combine,
2632
2661
  command,
2633
2662
  comments,
2634
- src_default as default,
2663
+ index_default as default,
2635
2664
  defaultPluginRenaming,
2636
2665
  disables,
2637
2666
  ensurePackages,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kirklin/eslint-config",
3
3
  "type": "module",
4
- "version": "2.8.0",
4
+ "version": "3.0.0",
5
5
  "description": "Kirk Lin's ESLint config",
6
6
  "author": "Kirk Lin (https://github.com/kirklin/)",
7
7
  "license": "MIT",
@@ -11,10 +11,7 @@
11
11
  "eslint-config"
12
12
  ],
13
13
  "exports": {
14
- ".": {
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.cjs"
17
- }
14
+ ".": "./dist/index.js"
18
15
  },
19
16
  "main": "./dist/index.js",
20
17
  "types": "./dist/index.d.ts",
@@ -24,7 +21,7 @@
24
21
  "dist"
25
22
  ],
26
23
  "peerDependencies": {
27
- "@eslint-react/eslint-plugin": "^1.5.8",
24
+ "@eslint-react/eslint-plugin": "^1.19.0",
28
25
  "@prettier/plugin-xml": "^3.4.1",
29
26
  "@unocss/eslint-plugin": ">=0.50.0",
30
27
  "astro-eslint-parser": "^1.0.2",
@@ -81,35 +78,35 @@
81
78
  }
82
79
  },
83
80
  "dependencies": {
84
- "@antfu/install-pkg": "^0.5.0",
85
- "@clack/prompts": "^0.8.2",
81
+ "@antfu/install-pkg": "^1.0.0",
82
+ "@clack/prompts": "^0.10.0",
86
83
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
87
- "@eslint/markdown": "^6.2.1",
88
- "@stylistic/eslint-plugin": "^2.11.0",
89
- "@typescript-eslint/eslint-plugin": "^8.16.0",
90
- "@typescript-eslint/parser": "^8.16.0",
91
- "@vitest/eslint-plugin": "^1.1.12",
92
- "eslint-config-flat-gitignore": "^0.3.0",
93
- "eslint-flat-config-utils": "^0.4.0",
94
- "eslint-merge-processors": "^0.1.0",
95
- "eslint-plugin-command": "^0.2.6",
96
- "eslint-plugin-import-x": "^4.4.3",
97
- "eslint-plugin-jsdoc": "^50.6.0",
98
- "eslint-plugin-jsonc": "^2.18.2",
99
- "eslint-plugin-kirklin": "^1.5.0",
100
- "eslint-plugin-n": "^17.14.0",
84
+ "@eslint/markdown": "^6.2.2",
85
+ "@stylistic/eslint-plugin": "^3.1.0",
86
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
87
+ "@typescript-eslint/parser": "^8.23.0",
88
+ "@vitest/eslint-plugin": "^1.1.26",
89
+ "eslint-config-flat-gitignore": "^2.0.0",
90
+ "eslint-flat-config-utils": "^2.0.1",
91
+ "eslint-merge-processors": "^2.0.0",
92
+ "eslint-plugin-command": "^3.0.0",
93
+ "eslint-plugin-import-x": "^4.6.1",
94
+ "eslint-plugin-jsdoc": "^50.6.3",
95
+ "eslint-plugin-jsonc": "^2.19.1",
96
+ "eslint-plugin-kirklin": "^2.0.0",
97
+ "eslint-plugin-n": "^17.15.1",
101
98
  "eslint-plugin-no-only-tests": "^3.3.0",
102
- "eslint-plugin-perfectionist": "^4.1.2",
99
+ "eslint-plugin-perfectionist": "^4.8.0",
103
100
  "eslint-plugin-regexp": "^2.7.0",
104
- "eslint-plugin-toml": "^0.11.1",
101
+ "eslint-plugin-toml": "^0.12.0",
105
102
  "eslint-plugin-unicorn": "^56.0.1",
106
103
  "eslint-plugin-unused-imports": "^4.1.4",
107
- "eslint-plugin-vue": "^9.31.0",
108
- "eslint-plugin-yml": "^1.15.0",
109
- "eslint-processor-vue-blocks": "^0.1.2",
110
- "globals": "^15.12.0",
104
+ "eslint-plugin-vue": "^9.32.0",
105
+ "eslint-plugin-yml": "^1.16.0",
106
+ "eslint-processor-vue-blocks": "^2.0.0",
107
+ "globals": "^15.14.0",
111
108
  "jsonc-eslint-parser": "^2.4.0",
112
- "local-pkg": "^0.5.1",
109
+ "local-pkg": "^1.0.0",
113
110
  "parse-gitignore": "^2.0.0",
114
111
  "picocolors": "^1.1.1",
115
112
  "toml-eslint-parser": "^0.10.0",
@@ -118,66 +115,65 @@
118
115
  "yargs": "^17.7.2"
119
116
  },
120
117
  "devDependencies": {
121
- "@antfu/ni": "^0.23.1",
122
- "@eslint-react/eslint-plugin": "^1.17.1",
123
- "@eslint/config-inspector": "^0.5.6",
118
+ "@antfu/ni": "^23.3.1",
119
+ "@eslint-react/eslint-plugin": "^1.26.2",
120
+ "@eslint/config-inspector": "^1.0.0",
124
121
  "@prettier/plugin-xml": "^3.4.1",
125
- "@stylistic/eslint-plugin-migrate": "^2.11.0",
122
+ "@stylistic/eslint-plugin-migrate": "^3.1.0",
126
123
  "@types/fs-extra": "^11.0.4",
127
- "@types/node": "^22.10.1",
124
+ "@types/node": "^22.13.1",
128
125
  "@types/prompts": "^2.4.9",
129
126
  "@types/yargs": "^17.0.33",
130
- "@unocss/eslint-plugin": "^0.64.1",
131
- "astro-eslint-parser": "^1.1.0",
132
- "bumpp": "^9.8.1",
133
- "eslint": "^9.15.0",
127
+ "@unocss/eslint-plugin": "^65.4.3",
128
+ "astro-eslint-parser": "^1.2.1",
129
+ "bumpp": "^10.0.2",
130
+ "eslint": "^9.20.0",
134
131
  "eslint-plugin-astro": "^1.3.1",
135
- "eslint-plugin-format": "^0.1.2",
136
- "eslint-plugin-react-hooks": "^5.0.0",
137
- "eslint-plugin-react-refresh": "^0.4.14",
138
- "eslint-plugin-solid": "^0.14.4",
139
- "eslint-plugin-svelte": "^2.46.0",
140
- "eslint-typegen": "^0.3.2",
141
- "esno": "^4.8.0",
142
- "execa": "^9.5.1",
143
- "fast-glob": "^3.3.2",
144
- "fs-extra": "^11.2.0",
145
- "jiti": "^2.4.0",
146
- "lint-staged": "^15.2.10",
132
+ "eslint-plugin-format": "^1.0.1",
133
+ "eslint-plugin-react-hooks": "^5.1.0",
134
+ "eslint-plugin-react-refresh": "^0.4.18",
135
+ "eslint-plugin-solid": "^0.14.5",
136
+ "eslint-plugin-svelte": "^2.46.1",
137
+ "eslint-typegen": "^1.0.0",
138
+ "execa": "^9.5.2",
139
+ "fast-glob": "^3.3.3",
140
+ "fs-extra": "^11.3.0",
141
+ "jiti": "^2.4.2",
142
+ "lint-staged": "^15.4.3",
147
143
  "prettier-plugin-astro": "^0.14.1",
148
144
  "prettier-plugin-slidev": "^1.0.5",
149
145
  "rimraf": "^6.0.1",
150
146
  "simple-git-hooks": "^2.11.1",
151
- "svelte": "^5.2.10",
147
+ "svelte": "^5.19.9",
152
148
  "svelte-eslint-parser": "^0.43.0",
153
- "tsup": "^8.3.5",
149
+ "tsup": "^8.3.6",
154
150
  "tsx": "^4.19.2",
155
- "typescript": "^5.7.2",
156
- "vitest": "^2.1.6",
151
+ "typescript": "^5.7.3",
152
+ "vitest": "^3.0.5",
157
153
  "vue": "^3.5.13",
158
- "@kirklin/eslint-config": "2.8.0"
154
+ "@kirklin/eslint-config": "3.0.0"
159
155
  },
160
156
  "resolutions": {
161
157
  "@eslint-community/eslint-utils": "^4.4.1",
162
- "@typescript-eslint/utils": "^8.16.0",
163
- "eslint": "^9.15.0",
158
+ "@typescript-eslint/utils": "^8.23.0",
159
+ "eslint": "^9.20.0",
164
160
  "tsx": "^4.19.2"
165
161
  },
166
162
  "simple-git-hooks": {
167
163
  "pre-commit": "npx lint-staged"
168
164
  },
169
165
  "lint-staged": {
170
- "*": "eslint --flag unstable_ts_config --fix"
166
+ "*": "eslint --fix"
171
167
  },
172
168
  "scripts": {
173
- "build": "nr typegen && tsup --format esm,cjs --clean --dts",
174
- "stub": "tsup --format esm",
169
+ "build": "nr typegen && tsup --clean --dts",
170
+ "stub": "tsup",
175
171
  "dev": "npx @eslint/config-inspector --config eslint.config.ts",
176
172
  "build:inspector": "pnpm build && npx @eslint/config-inspector build",
177
- "watch": "tsup --format esm,cjs --watch",
178
- "lint": "eslint --flag unstable_ts_config .",
179
- "lint:fix": "eslint --flag unstable_ts_config . --fix",
180
- "typegen": "esno scripts/typegen.ts",
173
+ "watch": "tsup --watch",
174
+ "lint": "eslint .",
175
+ "lint:fix": "eslint . --fix",
176
+ "typegen": "tsx scripts/typegen.ts",
181
177
  "release": "bumpp && pnpm publish",
182
178
  "test": "vitest",
183
179
  "typecheck": "tsc --noEmit"