@vinicunca/eslint-config 4.5.0 → 4.7.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.mjs CHANGED
@@ -466,7 +466,7 @@ async function stylistic(options = {}) {
466
466
 
467
467
  //#endregion
468
468
  //#region src/configs/formatters.ts
469
- function mergePrettierOptions(options, overrides = {}) {
469
+ function mergePrettierOptions(options, overrides) {
470
470
  return {
471
471
  ...options,
472
472
  ...overrides,
@@ -911,8 +911,11 @@ async function javascript(options = {}) {
911
911
  async function jsdoc(options = {}) {
912
912
  const { stylistic: stylistic$1 = true } = options;
913
913
  return [{
914
+ name: "vinicunca/jsdoc/setup",
915
+ plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
916
+ }, {
917
+ files: [GLOB_SRC],
914
918
  name: "vinicunca/jsdoc/rules",
915
- plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
916
919
  rules: {
917
920
  "jsdoc/check-access": WARN,
918
921
  "jsdoc/check-alignment": WARN,
@@ -950,13 +953,12 @@ async function jsonc(options = {}) {
950
953
  GLOB_JSONC
951
954
  ], overrides = {}, stylistic: stylistic$1 = true } = options;
952
955
  const { indent = 2 } = e$2(stylistic$1) ? {} : stylistic$1;
953
- const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
954
956
  return [{
955
957
  name: "vinicunca/jsonc/setup",
956
- plugins: { jsonc: pluginJsonc }
958
+ plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
957
959
  }, {
958
960
  files,
959
- languageOptions: { parser: parserJsonc },
961
+ language: "jsonc/x",
960
962
  name: "vinicunca/jsonc/rules",
961
963
  rules: {
962
964
  "jsonc/no-bigint-literals": ERROR,
@@ -1050,7 +1052,7 @@ async function jsx(options = {}) {
1050
1052
  //#endregion
1051
1053
  //#region src/configs/markdown.ts
1052
1054
  async function markdown(options = {}) {
1053
- const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
1055
+ const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
1054
1056
  const markdown$1 = await interopDefault(import("@eslint/markdown"));
1055
1057
  return [
1056
1058
  {
@@ -1065,9 +1067,33 @@ async function markdown(options = {}) {
1065
1067
  },
1066
1068
  {
1067
1069
  files,
1068
- languageOptions: { parser: parserPlain },
1070
+ language: gfm ? "markdown/gfm" : "markdown/commonmark",
1069
1071
  name: "vinicunca/markdown/parser"
1070
1072
  },
1073
+ {
1074
+ files,
1075
+ name: "vinicunca/markdown/rules",
1076
+ rules: {
1077
+ ...markdown$1.configs.recommended.at(0)?.rules,
1078
+ "markdown/no-missing-label-refs": OFF,
1079
+ ...overridesMarkdown
1080
+ }
1081
+ },
1082
+ {
1083
+ files,
1084
+ name: "vinicunca/markdown/disables/markdown",
1085
+ rules: {
1086
+ "command/command": OFF,
1087
+ "no-irregular-whitespace": OFF,
1088
+ "perfectionist/sort-exports": OFF,
1089
+ "perfectionist/sort-imports": OFF,
1090
+ "regexp/no-legacy-features": OFF,
1091
+ "regexp/no-missing-g-flag": OFF,
1092
+ "regexp/no-useless-dollar-replacements": OFF,
1093
+ "regexp/no-useless-flag": OFF,
1094
+ "style/indent": OFF
1095
+ }
1096
+ },
1071
1097
  {
1072
1098
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
1073
1099
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
@@ -1212,17 +1238,16 @@ async function detectCatalogUsage() {
1212
1238
  return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1213
1239
  }
1214
1240
  async function pnpm(options) {
1215
- const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
1241
+ const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
1216
1242
  interopDefault(import("eslint-plugin-pnpm")),
1217
1243
  interopDefault(import("eslint-plugin-yml")),
1218
- interopDefault(import("yaml-eslint-parser")),
1219
- interopDefault(import("jsonc-eslint-parser"))
1244
+ interopDefault(import("yaml-eslint-parser"))
1220
1245
  ]);
1221
1246
  const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml: yaml$1 = true } = options;
1222
1247
  const configs$1 = [];
1223
1248
  if (json) configs$1.push({
1224
1249
  files: ["package.json", "**/package.json"],
1225
- languageOptions: { parser: jsoncParser },
1250
+ language: "jsonc/x",
1226
1251
  name: "vinicunca/pnpm/package-json",
1227
1252
  plugins: { pnpm: pluginPnpm },
1228
1253
  rules: {
@@ -1356,7 +1381,10 @@ async function react(options = {}) {
1356
1381
  "eslint-plugin-react-refresh"
1357
1382
  ]);
1358
1383
  const isTypeAware = !!tsconfigPath;
1359
- const typeAwareRules = { "react/no-leaked-conditional-rendering": WARN };
1384
+ const typeAwareRules = {
1385
+ "react/no-implicit-key": ERROR,
1386
+ "react/no-leaked-conditional-rendering": WARN
1387
+ };
1360
1388
  const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
1361
1389
  interopDefault(import("@eslint-react/eslint-plugin")),
1362
1390
  interopDefault(import("eslint-plugin-react-hooks")),
@@ -1377,6 +1405,7 @@ async function react(options = {}) {
1377
1405
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1378
1406
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1379
1407
  "react-refresh": pluginReactRefresh,
1408
+ "react-rsc": plugins["@eslint-react/rsc"],
1380
1409
  "react-web-api": plugins["@eslint-react/web-api"]
1381
1410
  }
1382
1411
  },
@@ -1403,8 +1432,17 @@ async function react(options = {}) {
1403
1432
  "react-dom/no-unsafe-target-blank": WARN,
1404
1433
  "react-dom/no-use-form-state": ERROR,
1405
1434
  "react-dom/no-void-elements-with-children": ERROR,
1435
+ "react-hooks-extra/no-direct-set-state-in-use-effect": WARN,
1406
1436
  "react-hooks/exhaustive-deps": WARN,
1407
1437
  "react-hooks/rules-of-hooks": ERROR,
1438
+ "react-naming-convention/context-name": WARN,
1439
+ "react-naming-convention/ref-name": WARN,
1440
+ "react-naming-convention/use-state": WARN,
1441
+ "react-rsc/function-definition": ERROR,
1442
+ "react-web-api/no-leaked-event-listener": WARN,
1443
+ "react-web-api/no-leaked-interval": WARN,
1444
+ "react-web-api/no-leaked-resize-observer": WARN,
1445
+ "react-web-api/no-leaked-timeout": WARN,
1408
1446
  "react/jsx-no-comment-textnodes": WARN,
1409
1447
  "react/jsx-no-duplicate-props": WARN,
1410
1448
  "react/jsx-uses-vars": WARN,
@@ -1423,9 +1461,7 @@ async function react(options = {}) {
1423
1461
  "react/no-create-ref": ERROR,
1424
1462
  "react/no-default-props": ERROR,
1425
1463
  "react/no-direct-mutation-state": ERROR,
1426
- "react/no-duplicate-key": WARN,
1427
1464
  "react/no-forward-ref": WARN,
1428
- "react/no-implicit-key": WARN,
1429
1465
  "react/no-missing-key": ERROR,
1430
1466
  "react/no-nested-component-definitions": ERROR,
1431
1467
  "react/no-prop-types": ERROR,
@@ -1444,6 +1480,7 @@ async function react(options = {}) {
1444
1480
  "react/no-unused-state": WARN,
1445
1481
  "react/no-use-context": WARN,
1446
1482
  "react/no-useless-forward-ref": WARN,
1483
+ "react/prefer-namespace-import": ERROR,
1447
1484
  "react/prefer-use-state-lazy-initialization": WARN,
1448
1485
  ...reactCompiler ? {
1449
1486
  "react-hooks/component-hook-factories": ERROR,
@@ -1462,7 +1499,6 @@ async function react(options = {}) {
1462
1499
  "react-hooks/unsupported-syntax": WARN,
1463
1500
  "react-hooks/use-memo": ERROR
1464
1501
  } : {},
1465
- "react-hooks-extra/no-direct-set-state-in-use-effect": WARN,
1466
1502
  "react-refresh/only-export-components": [WARN, {
1467
1503
  allowConstantExport: isAllowConstantExport,
1468
1504
  allowExportNames: [...isUsingNext ? [
@@ -1491,13 +1527,21 @@ async function react(options = {}) {
1491
1527
  "shouldRevalidate"
1492
1528
  ] : []]
1493
1529
  }],
1494
- "react-web-api/no-leaked-event-listener": WARN,
1495
- "react-web-api/no-leaked-interval": WARN,
1496
- "react-web-api/no-leaked-resize-observer": WARN,
1497
- "react-web-api/no-leaked-timeout": WARN,
1498
1530
  ...overrides
1499
1531
  }
1500
1532
  },
1533
+ {
1534
+ files: filesTypeAware,
1535
+ name: "vinicunca/react/typescript",
1536
+ rules: {
1537
+ "react-dom/no-string-style-prop": OFF,
1538
+ "react-dom/no-unknown-property": OFF,
1539
+ "react/jsx-no-duplicate-props": OFF,
1540
+ "react/jsx-no-undef": OFF,
1541
+ "react/jsx-uses-react": OFF,
1542
+ "react/jsx-uses-vars": OFF
1543
+ }
1544
+ },
1501
1545
  ...isTypeAware ? [{
1502
1546
  files: filesTypeAware,
1503
1547
  ignores: ignoresTypeAware,
@@ -2134,7 +2178,7 @@ async function typescript(options = {}) {
2134
2178
  }] : [],
2135
2179
  ...erasableOnly ? [{
2136
2180
  name: "antfu/typescript/erasable-syntax-only",
2137
- plugins: { "erasable-syntax-only": await interopDefault(import("./lib-DHxUIJ7x.mjs")) },
2181
+ plugins: { "erasable-syntax-only": await interopDefault(import("./lib-ok3LDcYL.mjs")) },
2138
2182
  rules: {
2139
2183
  "erasable-syntax-only/enums": ERROR,
2140
2184
  "erasable-syntax-only/import-aliases": ERROR,