@jiakun-zhao/eslint-config 4.0.4 → 4.0.5

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.d.mts CHANGED
@@ -4,7 +4,7 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
4
4
 
5
5
  /* This file is generated by eslint-typegen, for augmenting rules types in ESLint */
6
6
  /* You might want to include this file in tsconfig.json but excluded from git */
7
- /* eslint-typegen-hash: -AUfUQM0_NDYtGZWthHGIFC1_sS_ud0xf_XNyTI_F-8 */
7
+ /* eslint-typegen-hash: pO9sA--WvvRHzqH6TbTpaT9k2jd5AX31nrPjLR7oOHs */
8
8
 
9
9
 
10
10
 
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
4
4
 
5
5
  /* This file is generated by eslint-typegen, for augmenting rules types in ESLint */
6
6
  /* You might want to include this file in tsconfig.json but excluded from git */
7
- /* eslint-typegen-hash: -AUfUQM0_NDYtGZWthHGIFC1_sS_ud0xf_XNyTI_F-8 */
7
+ /* eslint-typegen-hash: pO9sA--WvvRHzqH6TbTpaT9k2jd5AX31nrPjLR7oOHs */
8
8
 
9
9
 
10
10
 
package/dist/index.mjs CHANGED
@@ -134,6 +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
138
  "mine/no-blank-before-astro-element": "warn",
138
139
  "mine/no-blank-in-astro-frontmatter-edge": "warn"
139
140
  });
@@ -372,7 +373,41 @@ function jsonc() {
372
373
  ];
373
374
  }
374
375
 
375
- const version = "4.0.4";
376
+ const version = "4.0.5";
377
+
378
+ const name$3 = "multi-root-element-indent";
379
+ const _multiRootElementIndent = createRule({
380
+ name: name$3,
381
+ meta: {
382
+ docs: {
383
+ description: "Fix astro multi root element index"
384
+ },
385
+ schema: [],
386
+ type: "layout",
387
+ fixable: "whitespace",
388
+ messages: {
389
+ unexpectedSpace: "Unexpected Space"
390
+ }
391
+ },
392
+ create(context) {
393
+ return {
394
+ AstroFragment(node) {
395
+ const children = node.children.filter((it) => it.type === "JSXElement" && it.loc.start.column !== 0);
396
+ if (!children.length)
397
+ return;
398
+ context.report({
399
+ loc: { line: 0, column: 0 },
400
+ messageId: "unexpectedSpace",
401
+ fix(fixer) {
402
+ return children.map((it) => {
403
+ return fixer.removeRange([it.range[0] - it.loc.start.column, it.range[0]]);
404
+ });
405
+ }
406
+ });
407
+ }
408
+ };
409
+ }
410
+ });
376
411
 
377
412
  function isDocumentStart(node) {
378
413
  return node.range[0] === 0;
@@ -405,13 +440,13 @@ const _noBlankBeforeAstroElement = createRule({
405
440
  if (!token && !isDocumentStart(node)) {
406
441
  context.report({
407
442
  fix: (fixer) => fixer.removeRange([0, node.range[0]]),
408
- loc: { start: { line: 1, column: 0 }, end: node.loc.start },
443
+ loc: { line: 0, column: 0 },
409
444
  messageId: "unexpectedBlank"
410
445
  });
411
446
  } else if (token && token.value === "---" && (!isLineStart(node) || numOfLines(token, node) !== 2)) {
412
447
  context.report({
413
448
  fix: (fixer) => fixer.replaceTextRange([token.range[1], node.range[0]], "\n\n"),
414
- loc: { start: token.loc.end, end: node.loc.start },
449
+ loc: { line: 0, column: 0 },
415
450
  messageId: "unexpectedBlank"
416
451
  });
417
452
  }
@@ -441,17 +476,17 @@ const _noBlankInAstroFrontmatterEdge = createRule({
441
476
  if (first && first.value === "---" && next && next.loc.start.line !== 2) {
442
477
  context.report({
443
478
  fix: (fixer) => fixer.replaceTextRange([3, next.range[0]], "\n"),
444
- loc: { start: { line: 1, column: 0 }, end: next.loc.start },
479
+ loc: { line: 0, column: 0 },
445
480
  messageId: "unexpectedBlank"
446
481
  });
447
482
  }
448
483
  },
449
484
  AstroFragment(node) {
450
485
  const [left, right] = context.sourceCode.getTokensBefore(node, { count: 2 });
451
- if (right && right.value === "---" && left && left.value !== "---" && numOfLines(left, right) !== 1) {
486
+ if (left && left.value !== "---" && right && right.value === "---" && numOfLines(left, right) !== 1) {
452
487
  context.report({
453
488
  fix: (fixer) => fixer.replaceTextRange([left.range[1], right.range[0]], "\n"),
454
- loc: { start: left.loc.end, end: right.loc.start },
489
+ loc: { line: 0, column: 0 },
455
490
  messageId: "unexpectedBlank"
456
491
  });
457
492
  }
@@ -485,7 +520,7 @@ const _noSpaceInEmptyObject = createRule({
485
520
  context.report({
486
521
  fix: (fixer) => fixer.replaceText(node, replaceValue),
487
522
  messageId: "unexpectedSpace",
488
- node
523
+ loc: { line: 0, column: 0 }
489
524
  });
490
525
  }
491
526
  },
@@ -499,7 +534,7 @@ const _noSpaceInEmptyObject = createRule({
499
534
  context.report({
500
535
  fix: (fixer) => fixer.replaceText(node, replaceValue),
501
536
  messageId: "unexpectedSpace",
502
- node
537
+ loc: { line: 0, column: 0 }
503
538
  });
504
539
  }
505
540
  }
@@ -510,7 +545,8 @@ const _noSpaceInEmptyObject = createRule({
510
545
  const rules = {
511
546
  [name]: _noSpaceInEmptyObject,
512
547
  [name$2]: _noBlankBeforeAstroElement,
513
- [name$1]: _noBlankInAstroFrontmatterEdge
548
+ [name$1]: _noBlankInAstroFrontmatterEdge,
549
+ [name$3]: _multiRootElementIndent
514
550
  };
515
551
  const pluginMine = {
516
552
  meta: {
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.4",
4
+ "version": "4.0.5",
5
5
  "description": "Jiakun Zhao's ESLint config.",
6
6
  "author": "Jiakun Zhao <hi@zhaojiakun.com>",
7
7
  "license": "MIT",