mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-15 11:55:49 +08:00
chore: ESLint Flat Config (#834)
* chore: eslint flat config * chore: format * update according to review * chore: remove prettier config and format * fix: move handler to script to bypass eslint * chore: config eslint for lang=js block * docs: add surrounding empty lines for code block * chore: also minify css in csp build * chore: publint
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import commentMark from "comment-mark";
|
||||
import { commentMark } from "comment-mark";
|
||||
import { getPackageMeta, resolvePath } from "./utils.mjs";
|
||||
|
||||
const { name, version } = getPackageMeta();
|
||||
@ -9,13 +9,13 @@ const CDN_PREFIX = "https://cdn.jsdelivr.net/npm/";
|
||||
const DEP_VERSIONS = {
|
||||
vue: "3.5.13",
|
||||
echarts: "5.5.1",
|
||||
[name]: version
|
||||
[name]: version,
|
||||
};
|
||||
|
||||
function getScripts() {
|
||||
const deps = ["vue", "echarts", name];
|
||||
return deps
|
||||
.map(dep => {
|
||||
.map((dep) => {
|
||||
const [, name] = dep.match(/^(.+?)(?:@.+)?$/) || [];
|
||||
return `<script src="${CDN_PREFIX}${name}@${DEP_VERSIONS[dep]}"></script>`;
|
||||
})
|
||||
@ -23,22 +23,22 @@ function getScripts() {
|
||||
}
|
||||
|
||||
function getCodeBlock(code) {
|
||||
return "```html\n" + code + "\n```";
|
||||
return "\n```html\n" + code + "\n```\n";
|
||||
}
|
||||
|
||||
const README_FILES = ["README.md", "README.zh-Hans.md"].map(name =>
|
||||
resolvePath(import.meta.url, "..", name)
|
||||
const README_FILES = ["README.md", "README.zh-Hans.md"].map((name) =>
|
||||
resolvePath(import.meta.url, "..", name),
|
||||
);
|
||||
|
||||
README_FILES.forEach(file => {
|
||||
README_FILES.forEach((file) => {
|
||||
const content = readFileSync(file, "utf8");
|
||||
|
||||
writeFileSync(
|
||||
file,
|
||||
commentMark(content, {
|
||||
vue3Scripts: getCodeBlock(getScripts())
|
||||
vue3Scripts: getCodeBlock(getScripts()),
|
||||
}),
|
||||
"utf8"
|
||||
"utf8",
|
||||
);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user