@vue-jsx/eslint 3.3.0-beta.0 → 3.3.0-rc.1

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +12 -14
  2. package/dist/index.js +42 -40
  3. package/package.json +21 -20
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import * as _$_typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
2
- import { ClassicConfig, Linter } from "@typescript-eslint/utils/ts-eslint";
3
-
1
+ import { FlatConfig, Linter } from "@typescript-eslint/utils/ts-eslint";
4
2
  //#region src/rules/jsx-sort-props/types.d.ts
5
3
  interface JsxSortPropsSchema0 {
6
4
  callbacksLast?: boolean;
@@ -25,24 +23,24 @@ type MessageIds = 'define-style' | 'define-style-syntax-error';
25
23
  //#endregion
26
24
  //#region src/rules/index.d.ts
27
25
  declare const ruleOptions: {
28
- 'jsx-sort-props': _$_typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds$1, JsxSortPropsRuleOptions, unknown, _$_typescript_eslint_utils_ts_eslint0.RuleListener>;
29
- 'define-style': _$_typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds, DefineStyleRuleOptions, unknown, _$_typescript_eslint_utils_ts_eslint0.RuleListener>;
26
+ 'jsx-sort-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds$1, JsxSortPropsRuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
27
+ 'define-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, DefineStyleRuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
30
28
  };
31
29
  interface RuleOptions {
32
- 'vue-jsx-vapor/jsx-sort-props': JsxSortPropsRuleOptions;
33
- 'vue-jsx-vapor/define-style': DefineStyleRuleOptions;
30
+ 'vue-jsx/jsx-sort-props': JsxSortPropsRuleOptions;
31
+ 'vue-jsx/define-style': DefineStyleRuleOptions;
34
32
  }
35
- type Rules = Partial<{ [K in keyof RuleOptions]: Linter.Severity | [Linter.Severity, ...RuleOptions[K]] }>;
33
+ type Rules = Partial<{ [K in keyof RuleOptions]: Linter.Severity | [Linter.Severity, ...RuleOptions[K]]; }>;
36
34
  //#endregion
37
35
  //#region src/index.d.ts
38
- declare const plugins: {
39
- 'vue-jsx-vapor': {
36
+ export declare const plugins: {
37
+ 'vue-jsx': {
40
38
  rules: {
41
- 'jsx-sort-props': _$_typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds$1, JsxSortPropsRuleOptions, unknown, _$_typescript_eslint_utils_ts_eslint0.RuleListener>;
42
- 'define-style': _$_typescript_eslint_utils_ts_eslint0.RuleModule<MessageIds, DefineStyleRuleOptions, unknown, _$_typescript_eslint_utils_ts_eslint0.RuleListener>;
39
+ 'jsx-sort-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds$1, JsxSortPropsRuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
40
+ 'define-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, DefineStyleRuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
43
41
  };
44
42
  };
45
43
  };
46
- declare const config: (options: ClassicConfig.Config) => Record<string, unknown>;
44
+ declare const config: (options?: FlatConfig.Config) => FlatConfig.Config;
47
45
  //#endregion
48
- export { type Rules, config as default, plugins, ruleOptions as rules };
46
+ export { type Rules, config as default, ruleOptions as rules };
package/dist/index.js CHANGED
@@ -214,52 +214,54 @@ function getGroupsOfSortableAttributes(attributes, context) {
214
214
  groupCount += 1;
215
215
  sortableAttributeGroups[groupCount - 1] = [];
216
216
  }
217
- if (!attrIsSpread) if (comment.length === 0) {
218
- attributeMap.set(attribute, {
219
- end: attribute.range[1],
220
- hasComment: false
221
- });
222
- addtoSortableAttributeGroups(attribute);
223
- } else {
224
- const firstComment = comment[0];
225
- const commentline = firstComment.loc.start.line;
226
- if (comment.length === 1) {
227
- if (attributeline + 1 === commentline && nextAttribute) {
228
- attributeMap.set(attribute, {
229
- end: nextAttribute.range[1],
230
- hasComment: true
231
- });
232
- addtoSortableAttributeGroups(attribute);
233
- i += 1;
234
- } else if (attributeline === commentline) {
235
- if (firstComment.type === "Block" && nextAttribute) {
217
+ if (!attrIsSpread) {
218
+ if (comment.length === 0) {
219
+ attributeMap.set(attribute, {
220
+ end: attribute.range[1],
221
+ hasComment: false
222
+ });
223
+ addtoSortableAttributeGroups(attribute);
224
+ } else {
225
+ const firstComment = comment[0];
226
+ const commentline = firstComment.loc.start.line;
227
+ if (comment.length === 1) {
228
+ if (attributeline + 1 === commentline && nextAttribute) {
236
229
  attributeMap.set(attribute, {
237
230
  end: nextAttribute.range[1],
238
231
  hasComment: true
239
232
  });
233
+ addtoSortableAttributeGroups(attribute);
240
234
  i += 1;
241
- } else if (firstComment.type === "Block") attributeMap.set(attribute, {
242
- end: firstComment.range[1],
235
+ } else if (attributeline === commentline) {
236
+ if (firstComment.type === "Block" && nextAttribute) {
237
+ attributeMap.set(attribute, {
238
+ end: nextAttribute.range[1],
239
+ hasComment: true
240
+ });
241
+ i += 1;
242
+ } else if (firstComment.type === "Block") attributeMap.set(attribute, {
243
+ end: firstComment.range[1],
244
+ hasComment: true
245
+ });
246
+ else attributeMap.set(attribute, {
247
+ end: firstComment.range[1],
248
+ hasComment: false
249
+ });
250
+ addtoSortableAttributeGroups(attribute);
251
+ }
252
+ } else if (comment.length > 1 && attributeline + 1 === comment[1].loc.start.line && nextAttribute) {
253
+ const commentNextAttribute = sourceCode.getCommentsAfter(nextAttribute);
254
+ attributeMap.set(attribute, {
255
+ end: nextAttribute.range[1],
243
256
  hasComment: true
244
257
  });
245
- else attributeMap.set(attribute, {
246
- end: firstComment.range[1],
247
- hasComment: false
258
+ if (commentNextAttribute.length === 1 && nextAttribute.loc.start.line === commentNextAttribute[0].loc.start.line) attributeMap.set(attribute, {
259
+ end: commentNextAttribute[0].range[1],
260
+ hasComment: true
248
261
  });
249
262
  addtoSortableAttributeGroups(attribute);
263
+ i += 1;
250
264
  }
251
- } else if (comment.length > 1 && attributeline + 1 === comment[1].loc.start.line && nextAttribute) {
252
- const commentNextAttribute = sourceCode.getCommentsAfter(nextAttribute);
253
- attributeMap.set(attribute, {
254
- end: nextAttribute.range[1],
255
- hasComment: true
256
- });
257
- if (commentNextAttribute.length === 1 && nextAttribute.loc.start.line === commentNextAttribute[0].loc.start.line) attributeMap.set(attribute, {
258
- end: commentNextAttribute[0].range[1],
259
- hasComment: true
260
- });
261
- addtoSortableAttributeGroups(attribute);
262
- i += 1;
263
265
  }
264
266
  }
265
267
  }
@@ -490,14 +492,14 @@ const ruleOptions = {
490
492
  };
491
493
  //#endregion
492
494
  //#region src/index.ts
493
- const plugins = { "vue-jsx-vapor": { rules: ruleOptions } };
495
+ const plugins = { "vue-jsx": { rules: ruleOptions } };
494
496
  const config = ({ rules = {}, ...options } = {}) => ({
495
- name: "vue-jsx-vapor",
497
+ name: "vue-jsx",
496
498
  plugins,
497
499
  rules: {
498
500
  "style/jsx-sort-props": "off",
499
501
  "react/jsx-sort-props": "off",
500
- "vue-jsx-vapor/jsx-sort-props": rules["vue-jsx-vapor/jsx-sort-props"] || ["warn", {
502
+ "vue-jsx/jsx-sort-props": rules["vue-jsx/jsx-sort-props"] || ["warn", {
501
503
  callbacksLast: true,
502
504
  shorthandFirst: true,
503
505
  reservedFirst: [
@@ -516,7 +518,7 @@ const config = ({ rules = {}, ...options } = {}) => ({
516
518
  "v-html"
517
519
  ]
518
520
  }],
519
- "vue-jsx-vapor/define-style": rules["vue-jsx-vapor/define-style"] || "warn"
521
+ "vue-jsx/define-style": rules["vue-jsx/define-style"] || "warn"
520
522
  },
521
523
  ...options
522
524
  });
package/package.json CHANGED
@@ -1,43 +1,44 @@
1
1
  {
2
2
  "name": "@vue-jsx/eslint",
3
- "type": "module",
4
- "version": "3.3.0-beta.0",
3
+ "version": "3.3.0-rc.1",
5
4
  "description": "Vue JSX ESLint Plugin",
6
- "license": "MIT",
5
+ "keywords": [
6
+ "eslint",
7
+ "jsx",
8
+ "vapor",
9
+ "vue"
10
+ ],
7
11
  "homepage": "https://github.com/vuejs/vue-jsx-vapor#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/vuejs/vue-jsx-vapor/issues"
14
+ },
15
+ "license": "MIT",
8
16
  "repository": {
9
17
  "type": "git",
10
18
  "url": "git+https://github.com/vuejs/vue-jsx-vapor.git"
11
19
  },
12
- "bugs": {
13
- "url": "https://github.com/vuejs/vue-jsx-vapor/issues"
14
- },
15
- "keywords": [
16
- "vue",
17
- "jsx",
18
- "vapor",
19
- "eslint"
20
+ "files": [
21
+ "dist"
20
22
  ],
23
+ "type": "module",
24
+ "main": "dist/index.js",
25
+ "types": "dist/index.d.ts",
21
26
  "exports": {
22
27
  ".": "./dist/index.js",
23
28
  "./*": "./*"
24
29
  },
25
- "main": "dist/index.js",
26
- "types": "dist/index.d.ts",
27
- "files": [
28
- "dist"
29
- ],
30
30
  "dependencies": {
31
31
  "@prettier/sync": "^0.6.1",
32
32
  "@typescript-eslint/utils": "^8.59.1"
33
33
  },
34
34
  "devDependencies": {
35
- "eslint-vitest-rule-tester": "^3.1.0"
35
+ "eslint-vitest-rule-tester": "^3.1.0",
36
+ "vitest": "4.1.11"
36
37
  },
37
38
  "scripts": {
38
- "build": "tsdown",
39
- "dev": "DEV=true tsdown",
39
+ "build": "vp pack",
40
+ "dev": "DEV=true vp pack",
40
41
  "release": "bumpp && npm publish",
41
- "test": "vitest"
42
+ "test": "vp test"
42
43
  }
43
44
  }