@jiakun-zhao/eslint-config 4.0.5 → 4.0.9

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
@@ -134,7 +134,7 @@ function createRule(rule) {
134
134
  async function astro() {
135
135
  const pluginAstro = await findDynamicPlugin("eslint-plugin-astro");
136
136
  return pluginAstro && createSharedAstroConfig(pluginAstro, {
137
- "mine/multi-root-element-indent": "warn",
137
+ "mine/astro-multi-top-level-element-indent": "warn",
138
138
  "mine/no-blank-before-astro-element": "warn",
139
139
  "mine/no-blank-in-astro-frontmatter-edge": "warn"
140
140
  });
@@ -373,14 +373,14 @@ function jsonc() {
373
373
  ];
374
374
  }
375
375
 
376
- const version = "4.0.5";
376
+ const version = "4.0.9";
377
377
 
378
- const name$3 = "multi-root-element-indent";
379
- const _multiRootElementIndent = createRule({
378
+ const name$3 = "astro-multi-top-level-element-indent";
379
+ const _astroMultiTopLevelElementIndent = createRule({
380
380
  name: name$3,
381
381
  meta: {
382
382
  docs: {
383
- description: "Fix astro multi root element index"
383
+ description: "Fix astro multi top level element indent"
384
384
  },
385
385
  schema: [],
386
386
  type: "layout",
@@ -393,7 +393,7 @@ const _multiRootElementIndent = createRule({
393
393
  return {
394
394
  AstroFragment(node) {
395
395
  const children = node.children.filter((it) => it.type === "JSXElement" && it.loc.start.column !== 0);
396
- if (!children.length)
396
+ if (children.length === 0)
397
397
  return;
398
398
  context.report({
399
399
  loc: { line: 0, column: 0 },
@@ -440,13 +440,13 @@ const _noBlankBeforeAstroElement = createRule({
440
440
  if (!token && !isDocumentStart(node)) {
441
441
  context.report({
442
442
  fix: (fixer) => fixer.removeRange([0, node.range[0]]),
443
- loc: { line: 0, column: 0 },
443
+ loc: { start: { line: 1, column: 0 }, end: node.loc.start },
444
444
  messageId: "unexpectedBlank"
445
445
  });
446
446
  } else if (token && token.value === "---" && (!isLineStart(node) || numOfLines(token, node) !== 2)) {
447
447
  context.report({
448
448
  fix: (fixer) => fixer.replaceTextRange([token.range[1], node.range[0]], "\n\n"),
449
- loc: { line: 0, column: 0 },
449
+ loc: { start: token.loc.end, end: node.loc.start },
450
450
  messageId: "unexpectedBlank"
451
451
  });
452
452
  }
@@ -476,7 +476,7 @@ const _noBlankInAstroFrontmatterEdge = createRule({
476
476
  if (first && first.value === "---" && next && next.loc.start.line !== 2) {
477
477
  context.report({
478
478
  fix: (fixer) => fixer.replaceTextRange([3, next.range[0]], "\n"),
479
- loc: { line: 0, column: 0 },
479
+ loc: { start: { line: 1, column: 0 }, end: next.loc.start },
480
480
  messageId: "unexpectedBlank"
481
481
  });
482
482
  }
@@ -486,7 +486,7 @@ const _noBlankInAstroFrontmatterEdge = createRule({
486
486
  if (left && left.value !== "---" && right && right.value === "---" && numOfLines(left, right) !== 1) {
487
487
  context.report({
488
488
  fix: (fixer) => fixer.replaceTextRange([left.range[1], right.range[0]], "\n"),
489
- loc: { line: 0, column: 0 },
489
+ loc: { start: left.loc.end, end: right.loc.start },
490
490
  messageId: "unexpectedBlank"
491
491
  });
492
492
  }
@@ -512,7 +512,7 @@ const _noSpaceInEmptyObject = createRule({
512
512
  create(context) {
513
513
  return {
514
514
  ObjectExpression(node) {
515
- if (node.properties.length)
515
+ if (node.properties.length > 0)
516
516
  return;
517
517
  const code = context.sourceCode.getText(node);
518
518
  const replaceValue = "{}";
@@ -520,12 +520,12 @@ const _noSpaceInEmptyObject = createRule({
520
520
  context.report({
521
521
  fix: (fixer) => fixer.replaceText(node, replaceValue),
522
522
  messageId: "unexpectedSpace",
523
- loc: { line: 0, column: 0 }
523
+ node
524
524
  });
525
525
  }
526
526
  },
527
527
  ExportNamedDeclaration(node) {
528
- if (node.declaration || node.specifiers.length) {
528
+ if (node.declaration || node.specifiers.length > 0) {
529
529
  return;
530
530
  }
531
531
  const code = context.sourceCode.getText(node);
@@ -534,7 +534,7 @@ const _noSpaceInEmptyObject = createRule({
534
534
  context.report({
535
535
  fix: (fixer) => fixer.replaceText(node, replaceValue),
536
536
  messageId: "unexpectedSpace",
537
- loc: { line: 0, column: 0 }
537
+ node
538
538
  });
539
539
  }
540
540
  }
@@ -543,10 +543,10 @@ const _noSpaceInEmptyObject = createRule({
543
543
  });
544
544
 
545
545
  const rules = {
546
- [name]: _noSpaceInEmptyObject,
546
+ [name$3]: _astroMultiTopLevelElementIndent,
547
547
  [name$2]: _noBlankBeforeAstroElement,
548
548
  [name$1]: _noBlankInAstroFrontmatterEdge,
549
- [name$3]: _multiRootElementIndent
549
+ [name]: _noSpaceInEmptyObject
550
550
  };
551
551
  const pluginMine = {
552
552
  meta: {
@@ -563,20 +563,21 @@ function mine() {
563
563
  mine: pluginMine
564
564
  },
565
565
  rules: {
566
- "mine/no-space-in-empty-block": "warn"
566
+ // use unicorn/empty-brace-spaces
567
+ // 'mine/no-space-in-empty-block': 'warn',
567
568
  }
568
569
  };
569
570
  }
570
571
 
571
572
  function overrides() {
572
- const configFileNames = ["eslint", "astro", "vite", "build", "uno", "unocss", "vitest"];
573
+ const configFileNames = ["eslint", "astro", "vite", "build", "nuxt", "unocss", "vitest"];
573
574
  const extensions = ["js", "mjs", "cjs", "ts", "mts", "cts"];
574
575
  return [
575
576
  {
576
577
  name: "override/sort-config-files",
577
578
  files: [
578
579
  ...configFileNames.reduce(
579
- (acc, cur) => acc.concat(...extensions.map((ext) => `${cur}.config.${ext}`)),
580
+ (acc, cur) => [...acc, ...extensions.map((ext) => `${cur}.config.${ext}`)],
580
581
  []
581
582
  )
582
583
  ],
@@ -602,10 +603,7 @@ function overrides() {
602
603
  ],
603
604
  rules: {
604
605
  "style/no-multiple-empty-lines": ["warn", { max: 0 }],
605
- "jsonc/sort-array-values": [
606
- "warn",
607
- { order: { type: "asc" }, pathPattern: "^files$" }
608
- ],
606
+ "jsonc/sort-array-values": ["warn", { order: { type: "asc" }, pathPattern: "^files$" }],
609
607
  "jsonc/sort-keys": [
610
608
  "warn",
611
609
  { order: packageJsonTopLevelOrder, pathPattern: "^$" },
@@ -633,7 +631,8 @@ function perfectionist() {
633
631
  type: "natural"
634
632
  }],
635
633
  "perfectionist/sort-named-exports": ["warn", { order: "asc", type: "natural" }],
636
- "perfectionist/sort-named-imports": ["warn", { order: "asc", type: "natural" }]
634
+ // 'perfectionist/sort-named-imports': ['warn', { order: 'asc', type: 'natural' }],
635
+ "sort-imports": ["warn", { ignoreCase: false, ignoreDeclarationSort: true, ignoreMemberSort: false }]
637
636
  }
638
637
  };
639
638
  }
@@ -741,7 +740,7 @@ function stylistic() {
741
740
  "style/jsx-closing-tag-location": "warn",
742
741
  "style/jsx-curly-brace-presence": "warn",
743
742
  "style/jsx-curly-newline": "warn",
744
- "style/jsx-curly-spacing": ["warn", { children: { when: "always" }, when: "never" }],
743
+ "style/jsx-curly-spacing": ["warn", { children: true, when: "never" }],
745
744
  "style/jsx-equals-spacing": "warn",
746
745
  "style/jsx-max-props-per-line": "off",
747
746
  "style/jsx-pascal-case": "warn",
@@ -959,7 +958,7 @@ async function vue() {
959
958
  ...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, cur) => ({ ...acc, ...cur }), {}),
960
959
  "vue/attribute-hyphenation": "warn",
961
960
  "vue/attributes-order": ["warn", { alphabetical: true, order: ["UNIQUE", "DEFINITION", "CONDITIONALS", "LIST_RENDERING", "GLOBAL", "RENDER_MODIFIERS", "SLOT", "TWO_WAY_BINDING", "OTHER_DIRECTIVES", "CONTENT", "ATTR_SHORTHAND_BOOL", "ATTR_STATIC", "ATTR_DYNAMIC", "EVENTS"] }],
962
- "vue/block-order": "warn",
961
+ "vue/block-order": ["warn", { order: ["script", "template", "style"] }],
963
962
  "vue/block-tag-newline": "warn",
964
963
  "vue/component-name-in-template-casing": "warn",
965
964
  "vue/component-options-name-casing": ["warn", "PascalCase"],
@@ -977,6 +976,7 @@ async function vue() {
977
976
  "vue/html-indent": ["warn", indent],
978
977
  "vue/html-quotes": "warn",
979
978
  "vue/html-self-closing": ["warn", { html: { component: "always", normal: "never", void: "never" }, math: "always", svg: "always" }],
979
+ "vue/multi-word-component-names": "off",
980
980
  "vue/mustache-interpolation-spacing": "warn",
981
981
  "vue/no-import-compiler-macros": "warn",
982
982
  "vue/no-multi-spaces": "warn",
@@ -997,7 +997,8 @@ async function vue() {
997
997
  "vue/require-typed-ref": "warn",
998
998
  "vue/slot-name-casing": ["warn", "kebab-case"],
999
999
  "vue/static-class-names-order": "warn",
1000
- "vue/v-bind-style": ["wran", "shorthand", { sameNameShorthand: "always" }],
1000
+ // 'vue/v-bind-style': ['warn', 'shorthand', { sameNameShorthand: 'always' }],
1001
+ "vue/v-bind-style": "warn",
1001
1002
  "vue/v-for-delimiter-style": ["warn", "of"],
1002
1003
  "vue/v-on-event-hyphenation": "warn",
1003
1004
  "vue/v-on-handler-style": "warn",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jiakun-zhao/eslint-config",
3
3
  "type": "module",
4
- "version": "4.0.5",
4
+ "version": "4.0.9",
5
5
  "description": "Jiakun Zhao's ESLint config.",
6
6
  "author": "Jiakun Zhao <hi@zhaojiakun.com>",
7
7
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "@types/node": "^22.14.1",
57
57
  "@typescript-eslint/types": "^8.30.1",
58
58
  "bumpp": "^10.1.0",
59
- "eslint": "^9.24.0",
59
+ "eslint": "^9.25.0",
60
60
  "eslint-plugin-astro": "^1.3.1",
61
61
  "eslint-plugin-vue": "^10.0.0",
62
62
  "eslint-typegen": "^2.1.0",
@@ -69,7 +69,7 @@
69
69
  "scripts": {
70
70
  "build": "unbuild",
71
71
  "dev": "config-inspector --open=false",
72
- "release": "pnpm typegen && bumpp && pnpm publish && npx cnpm sync @jiakun-zhao/eslint-config",
72
+ "release": "bumpp && pnpm publish && npx cnpm sync @jiakun-zhao/eslint-config",
73
73
  "stub": "unbuild --stub",
74
74
  "test": "vitest",
75
75
  "typegen": "tsx ./scripts/typegen.ts"