@flint.fyi/vue 0.1.4 → 0.3.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.
@@ -1,11 +1,22 @@
1
- import { ruleCreator } from "./ruleCreator.js";
2
- import * as vue from "@vue/compiler-dom";
3
- import ts from "typescript";
1
+ import { RuleCreator, createPlugin } from "@flint.fyi/core";
2
+ import { ts } from "@flint.fyi/ts";
3
+ import * as vue$1 from "@vue/compiler-dom";
4
+ import ts$1 from "typescript";
4
5
  import { nullThrows } from "@flint.fyi/utils";
5
6
  import { reportSourceCode } from "@flint.fyi/volar-language";
6
7
  import { vueLanguage } from "@flint.fyi/vue-language";
8
+ //#endregion
7
9
  //#region src/rules/vForKeys.ts
8
- var vForKeys_default = ruleCreator.createRule(vueLanguage, {
10
+ var vForKeys_default = new RuleCreator({
11
+ docs: (ruleId) => `https://flint.fyi/rules/vue/${ruleId.toLowerCase()}`,
12
+ pluginId: "vue",
13
+ presets: [
14
+ "logical",
15
+ "logicalStrict",
16
+ "stylistic",
17
+ "stylisticStrict"
18
+ ]
19
+ }).createRule(vueLanguage, {
9
20
  about: {
10
21
  description: "Reports v-for directives without a valid key binding.",
11
22
  id: "vForKeys",
@@ -38,7 +49,7 @@ var vForKeys_default = ruleCreator.createRule(vueLanguage, {
38
49
  const toGeneratedLocationOrThrow = (sourceLocation) => {
39
50
  return nullThrows(toGeneratedLocation(sourceLocation), "Unable to map source location to generated location");
40
51
  };
41
- const templateBlock = sfc.children.find((c) => c.type === vue.NodeTypes.ELEMENT && c.tag === "template");
52
+ const templateBlock = sfc.children.find((c) => c.type === vue$1.NodeTypes.ELEMENT && c.tag === "template");
42
53
  if (templateBlock == null) return {};
43
54
  const propValueRange = (propValue) => {
44
55
  const strip = propValue.loc.source === propValue.content ? 0 : 1;
@@ -58,7 +69,7 @@ var vForKeys_default = ruleCreator.createRule(vueLanguage, {
58
69
  });
59
70
  return;
60
71
  }
61
- if (keyProp.type === vue.NodeTypes.ATTRIBUTE) {
72
+ if (keyProp.type === vue$1.NodeTypes.ATTRIBUTE) {
62
73
  if (keyProp.value == null) return;
63
74
  reportSourceCode(context, {
64
75
  message: "staticKey",
@@ -101,7 +112,7 @@ var vForKeys_default = ruleCreator.createRule(vueLanguage, {
101
112
  const currentBegin = current.getStart(node);
102
113
  const currentEnd = current.getEnd();
103
114
  if (currentBegin > valueRange.end || currentEnd <= valueRange.begin) return false;
104
- if (currentBegin >= valueRange.begin && currentEnd <= valueRange.end && ts.isIdentifier(current)) {
115
+ if (currentBegin >= valueRange.begin && currentEnd <= valueRange.end && ts$1.isIdentifier(current)) {
105
116
  const symbol = services.typeChecker.getSymbolAtLocation(current);
106
117
  if (symbol?.valueDeclaration == null) return false;
107
118
  const declStart = symbol.valueDeclaration.getStart(node);
@@ -116,15 +127,15 @@ var vForKeys_default = ruleCreator.createRule(vueLanguage, {
116
127
  });
117
128
  };
118
129
  function visitTag(node) {
119
- if (node.type === vue.NodeTypes.ELEMENT) {
130
+ if (node.type === vue$1.NodeTypes.ELEMENT) {
120
131
  let forDirective = null;
121
132
  let forParseResult = null;
122
133
  let keyProp = null;
123
- for (const prop of node.props) if (prop.type === vue.NodeTypes.DIRECTIVE && prop.name === "for" && prop.forParseResult != null) {
134
+ for (const prop of node.props) if (prop.type === vue$1.NodeTypes.DIRECTIVE && prop.name === "for" && prop.forParseResult != null) {
124
135
  forDirective = prop;
125
136
  forParseResult = prop.forParseResult;
126
- } else if (prop.type === vue.NodeTypes.DIRECTIVE && prop.name === "bind" && vue.isStaticArgOf(prop.arg, "key")) keyProp = prop;
127
- else if (prop.type === vue.NodeTypes.ATTRIBUTE && prop.name === "key") keyProp = prop;
137
+ } else if (prop.type === vue$1.NodeTypes.DIRECTIVE && prop.name === "bind" && vue$1.isStaticArgOf(prop.arg, "key")) keyProp = prop;
138
+ else if (prop.type === vue$1.NodeTypes.ATTRIBUTE && prop.name === "key") keyProp = prop;
128
139
  if (forDirective != null && forParseResult != null) checkFor(forDirective, forParseResult, keyProp);
129
140
  for (const child of node.children) visitTag(child);
130
141
  }
@@ -134,4 +145,11 @@ var vForKeys_default = ruleCreator.createRule(vueLanguage, {
134
145
  }
135
146
  });
136
147
  //#endregion
137
- export { vForKeys_default as default };
148
+ //#region src/plugin.ts
149
+ const vue = createPlugin({
150
+ files: { all: [ts.files.all, "**/*.vue"] },
151
+ name: "Vue.js",
152
+ rules: [vForKeys_default]
153
+ });
154
+ //#endregion
155
+ export { vue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flint.fyi/vue",
3
- "version": "0.1.4",
3
+ "version": "0.3.0",
4
4
  "description": "[Experimental] Vue.js language plugin for Flint.",
5
5
  "homepage": "https://flint.fyi/rules/vue",
6
6
  "repository": {
@@ -16,29 +16,30 @@
16
16
  "sideEffects": false,
17
17
  "type": "module",
18
18
  "exports": {
19
- ".": "./lib/index.js"
19
+ ".": "./dist/index.mjs"
20
20
  },
21
21
  "files": [
22
- "lib/"
22
+ "dist/"
23
23
  ],
24
24
  "dependencies": {
25
25
  "@vue/compiler-dom": "^3.5.0",
26
26
  "typescript": "^5.9.0 || ^6.0.0",
27
- "@flint.fyi/core": "^0.23.3",
28
- "@flint.fyi/ts": "^0.21.0",
29
- "@flint.fyi/utils": "^0.14.1",
30
- "@flint.fyi/vue-language": "^0.1.2",
31
- "@flint.fyi/volar-language": "^0.1.4"
27
+ "@flint.fyi/ts": "^0.23.0",
28
+ "@flint.fyi/core": "^0.25.0",
29
+ "@flint.fyi/volar-language": "^0.3.0",
30
+ "@flint.fyi/utils": "^0.16.0",
31
+ "@flint.fyi/vue-language": "^0.3.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "tsdown": "0.22.3",
35
35
  "vitest": "4.1.0",
36
36
  "vue": "3.5.30",
37
- "@flint.fyi/typescript-language": "^0.18.4",
38
- "@flint.fyi/rule-tester": "^0.16.4"
37
+ "@flint.fyi/build": "^0.1.0",
38
+ "@flint.fyi/rule-tester": "^0.18.0",
39
+ "@flint.fyi/typescript-language": "^0.20.0"
39
40
  },
40
41
  "engines": {
41
- "node": ">=24.0.0"
42
+ "node": ">=26.1.0"
42
43
  },
43
44
  "publishConfig": {
44
45
  "access": "public"
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { vue } from "./plugin.js";
2
- export { vue };
package/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- import { vue } from "./plugin.js";
2
- export { vue };
package/lib/plugin.js DELETED
@@ -1,11 +0,0 @@
1
- import vForKeys_default from "./rules/vForKeys.js";
2
- import { createPlugin } from "@flint.fyi/core";
3
- import { ts } from "@flint.fyi/ts";
4
- //#region src/plugin.ts
5
- const vue = createPlugin({
6
- files: { all: [ts.files.all, "**/*.vue"] },
7
- name: "Vue.js",
8
- rules: [vForKeys_default]
9
- });
10
- //#endregion
11
- export { vue };
@@ -1,2 +0,0 @@
1
- import { RuleCreator } from "@flint.fyi/core";
2
- export declare const ruleCreator: RuleCreator<"logical" | "logicalStrict" | "stylistic" | "stylisticStrict", import("@flint.fyi/core").RuleAbout<"logical" | "logicalStrict" | "stylistic" | "stylisticStrict">>;
@@ -1,14 +0,0 @@
1
- import { RuleCreator } from "@flint.fyi/core";
2
- //#region src/rules/ruleCreator.ts
3
- const ruleCreator = new RuleCreator({
4
- docs: (ruleId) => `https://flint.fyi/rules/vue/${ruleId.toLowerCase()}`,
5
- pluginId: "vue",
6
- presets: [
7
- "logical",
8
- "logicalStrict",
9
- "stylistic",
10
- "stylisticStrict"
11
- ]
12
- });
13
- //#endregion
14
- export { ruleCreator };
@@ -1,9 +0,0 @@
1
- declare const _default: import("@flint.fyi/core").Rule<{
2
- readonly description: "Reports v-for directives without a valid key binding.";
3
- readonly id: "vForKeys";
4
- readonly presets: readonly ["logical"];
5
- } & {
6
- readonly pluginId: string;
7
- readonly url: string;
8
- }, "invalidKey" | "missingKey" | "staticKey", undefined>;
9
- export default _default;
File without changes