Skip to content

Commit

Permalink
refactor: eslint, prettier and move build script to tools folder
Browse files Browse the repository at this point in the history
  • Loading branch information
zjffun committed Sep 22, 2024
1 parent 57d04bf commit 7b0b6e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (process.env.NODE_ENV === "development") {
-webkit-focus-ring-color auto 1px
) !important;
}
</style>`
</style>`,
);

/* --- open --- */
Expand Down Expand Up @@ -90,7 +90,7 @@ if (process.env.NODE_ENV === "development") {
.then((url) => {
if (!url) {
console.error(
"[vue-click-to-component] url is empty, please check __VUE_CLICK_TO_COMPONENT_URL_FUNCTION__"
"[vue-click-to-component] url is empty, please check __VUE_CLICK_TO_COMPONENT_URL_FUNCTION__",
);
return;
}
Expand All @@ -105,7 +105,7 @@ if (process.env.NODE_ENV === "development") {
});
}
},
true
true,
);

/* --- set target --- */
Expand All @@ -118,7 +118,7 @@ if (process.env.NODE_ENV === "development") {
setTarget(e.target);
}
},
true
true,
);

/* --- clean target --- */
Expand All @@ -129,14 +129,14 @@ if (process.env.NODE_ENV === "development") {
cleanTarget();
}
},
true
true,
);

window.addEventListener(
"blur",
() => {
cleanTarget();
},
true
true,
);
}
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ export default tseslint.config(
"@typescript-eslint/no-require-imports": "off",
},
},

);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
],
"scripts": {
"prepublishOnly": "yarn build",
"build": "rimraf dist && tsc && node ./build/client-force-enable.mjs",
"build": "rimraf dist && tsc && node ./tools/client-force-enable.mjs",
"eslint-fix": "eslint --fix .",
"prettier-fix": "prettier --write .",
"registry-fix": "replace-lockfile-registry --registry https://registry.npmjs.org/",
Expand Down
4 changes: 2 additions & 2 deletions src/getSourceWithSourceCodeLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getSourceWithSourceCodeLocation({
while (allNodes.length > nodeIndex) {
allNodes = allNodes.concat(
allNodes[nodeIndex]?.childNodes || [],
allNodes[nodeIndex]?.content?.childNodes || []
allNodes[nodeIndex]?.content?.childNodes || [],
);

nodeIndex++;
Expand Down Expand Up @@ -48,7 +48,7 @@ function getSourceWithSourceCodeLocation({
})
.sort(
(a, b) =>
b.sourceCodeLocation.startOffset - a.sourceCodeLocation.startOffset
b.sourceCodeLocation.startOffset - a.sourceCodeLocation.startOffset,
);

let result = source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const client = fs.readFileSync(resolve("../client.js"), "utf8");

const clientForceEnable = client.replace(
'process.env.NODE_ENV === "development"',
"true"
"true",
);

fs.writeFileSync(resolve("../client-force-enable.js"), clientForceEnable);

fs.copyFileSync(
resolve("../client.d.ts"),
resolve("../client-force-enable.d.ts")
resolve("../client-force-enable.d.ts"),
);

0 comments on commit 7b0b6e4

Please sign in to comment.