@jiakun-zhao/eslint-config 4.0.4 → 4.0.8

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: TQHhqClWf45w96ekaecKHJx7rl7Dlt9vWYW8Bpb9sM0 */
8
8
 
9
9
 
10
10
 
@@ -1175,6 +1175,11 @@ interface RuleOptions {
1175
1175
  * @deprecated
1176
1176
  */
1177
1177
  'max-statements-per-line'?: Linter.RuleEntry<MaxStatementsPerLine>
1178
+ /**
1179
+ * Fix astro multi top level element indent
1180
+ * @see https://example.com/astro-multi-top-level-element-indent
1181
+ */
1182
+ 'mine/astro-multi-top-level-element-indent'?: Linter.RuleEntry<[]>
1178
1183
  /**
1179
1184
  * Enforce no blank before astro element
1180
1185
  * @see https://example.com/no-blank-before-astro-element
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: TQHhqClWf45w96ekaecKHJx7rl7Dlt9vWYW8Bpb9sM0 */
8
8
 
9
9
 
10
10
 
@@ -1175,6 +1175,11 @@ interface RuleOptions {
1175
1175
  * @deprecated
1176
1176
  */
1177
1177
  'max-statements-per-line'?: Linter.RuleEntry<MaxStatementsPerLine>
1178
+ /**
1179
+ * Fix astro multi top level element indent
1180
+ * @see https://example.com/astro-multi-top-level-element-indent
1181
+ */
1182
+ 'mine/astro-multi-top-level-element-indent'?: Linter.RuleEntry<[]>
1178
1183
  /**
1179
1184
  * Enforce no blank before astro element
1180
1185
  * @see https://example.com/no-blank-before-astro-element
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/astro-multi-top-level-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.8";
377
+
378
+ const name$3 = "astro-multi-top-level-element-indent";
379
+ const _astroMultiTopLevelElementIndent = createRule({
380
+ name: name$3,
381
+ meta: {
382
+ docs: {
383
+ description: "Fix astro multi top level element indent"
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;
@@ -448,7 +483,7 @@ const _noBlankInAstroFrontmatterEdge = createRule({
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
489
  loc: { start: left.loc.end, end: right.loc.start },
@@ -508,9 +543,10 @@ const _noSpaceInEmptyObject = createRule({
508
543
  });
509
544
 
510
545
  const rules = {
511
- [name]: _noSpaceInEmptyObject,
546
+ [name$3]: _astroMultiTopLevelElementIndent,
512
547
  [name$2]: _noBlankBeforeAstroElement,
513
- [name$1]: _noBlankInAstroFrontmatterEdge
548
+ [name$1]: _noBlankInAstroFrontmatterEdge,
549
+ [name]: _noSpaceInEmptyObject
514
550
  };
515
551
  const pluginMine = {
516
552
  meta: {
@@ -533,7 +569,7 @@ function mine() {
533
569
  }
534
570
 
535
571
  function overrides() {
536
- const configFileNames = ["eslint", "astro", "vite", "build", "uno", "unocss", "vitest"];
572
+ const configFileNames = ["eslint", "astro", "vite", "build", "nuxt", "unocss", "vitest"];
537
573
  const extensions = ["js", "mjs", "cjs", "ts", "mts", "cts"];
538
574
  return [
539
575
  {
@@ -566,10 +602,7 @@ function overrides() {
566
602
  ],
567
603
  rules: {
568
604
  "style/no-multiple-empty-lines": ["warn", { max: 0 }],
569
- "jsonc/sort-array-values": [
570
- "warn",
571
- { order: { type: "asc" }, pathPattern: "^files$" }
572
- ],
605
+ "jsonc/sort-array-values": ["warn", { order: { type: "asc" }, pathPattern: "^files$" }],
573
606
  "jsonc/sort-keys": [
574
607
  "warn",
575
608
  { order: packageJsonTopLevelOrder, pathPattern: "^$" },
@@ -705,7 +738,7 @@ function stylistic() {
705
738
  "style/jsx-closing-tag-location": "warn",
706
739
  "style/jsx-curly-brace-presence": "warn",
707
740
  "style/jsx-curly-newline": "warn",
708
- "style/jsx-curly-spacing": ["warn", { children: { when: "always" }, when: "never" }],
741
+ "style/jsx-curly-spacing": ["warn", { children: true, when: "never" }],
709
742
  "style/jsx-equals-spacing": "warn",
710
743
  "style/jsx-max-props-per-line": "off",
711
744
  "style/jsx-pascal-case": "warn",
@@ -923,7 +956,7 @@ async function vue() {
923
956
  ...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, cur) => ({ ...acc, ...cur }), {}),
924
957
  "vue/attribute-hyphenation": "warn",
925
958
  "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"] }],
926
- "vue/block-order": "warn",
959
+ "vue/block-order": ["warn", { order: ["script", "template", "style"] }],
927
960
  "vue/block-tag-newline": "warn",
928
961
  "vue/component-name-in-template-casing": "warn",
929
962
  "vue/component-options-name-casing": ["warn", "PascalCase"],
@@ -941,6 +974,7 @@ async function vue() {
941
974
  "vue/html-indent": ["warn", indent],
942
975
  "vue/html-quotes": "warn",
943
976
  "vue/html-self-closing": ["warn", { html: { component: "always", normal: "never", void: "never" }, math: "always", svg: "always" }],
977
+ "vue/multi-word-component-names": "off",
944
978
  "vue/mustache-interpolation-spacing": "warn",
945
979
  "vue/no-import-compiler-macros": "warn",
946
980
  "vue/no-multi-spaces": "warn",
@@ -961,7 +995,8 @@ async function vue() {
961
995
  "vue/require-typed-ref": "warn",
962
996
  "vue/slot-name-casing": ["warn", "kebab-case"],
963
997
  "vue/static-class-names-order": "warn",
964
- "vue/v-bind-style": ["wran", "shorthand", { sameNameShorthand: "always" }],
998
+ // 'vue/v-bind-style': ['warn', 'shorthand', { sameNameShorthand: 'always' }],
999
+ "vue/v-bind-style": "warn",
965
1000
  "vue/v-for-delimiter-style": ["warn", "of"],
966
1001
  "vue/v-on-event-hyphenation": "warn",
967
1002
  "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.4",
4
+ "version": "4.0.8",
5
5
  "description": "Jiakun Zhao's ESLint config.",
6
6
  "author": "Jiakun Zhao <hi@zhaojiakun.com>",
7
7
  "license": "MIT",
@@ -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"