Skip to content

Commit dedb214

Browse files
committed
style: Formatted code
1 parent 9a744e4 commit dedb214

File tree

29 files changed

+641
-702
lines changed

29 files changed

+641
-702
lines changed

build/plugins/custom/InjectCss.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const fileRegex = /\.(css)$/;
66

77
const injectCode = (code: string) =>
88
`function styleInject(css,ref){if(ref===void 0){ref={}}var insertAt=ref.insertAt;if(!css||typeof document==="undefined"){return}var head=document.head||document.getElementsByTagName("head")[0];var style=document.createElement("style");style.type="text/css";if(insertAt==="top"){if(head.firstChild){head.insertBefore(style,head.firstChild)}else{head.appendChild(style)}}else{head.appendChild(style)}if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}};styleInject(\`${code}\`)`;
9-
const template = `console.warn("__INJECT__")`;
9+
const template = 'console.warn("__INJECT__")';
1010

1111
let viteConfig: ResolvedConfig;
1212
const css: string[] = [];
@@ -25,7 +25,7 @@ const libInjectCss = (): PluginOption => {
2525
if (fileRegex.test(id)) {
2626
css.push(code);
2727
return {
28-
code: "",
28+
code: ""
2929
};
3030
}
3131
if (
@@ -34,7 +34,7 @@ const libInjectCss = (): PluginOption => {
3434
) {
3535
return {
3636
code: `${code}
37-
${template}`,
37+
${template}`
3838
};
3939
}
4040
return null;
@@ -49,7 +49,7 @@ const libInjectCss = (): PluginOption => {
4949

5050
try {
5151
let data: string = fs.readFileSync(filePath, {
52-
encoding: "utf8",
52+
encoding: "utf8"
5353
});
5454

5555
if (data.includes(template)) {
@@ -61,7 +61,7 @@ const libInjectCss = (): PluginOption => {
6161
console.error(e);
6262
}
6363
}
64-
},
64+
}
6565
};
6666
};
6767

build/plugins/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export default [
1616
eslintrc: {
1717
enabled: true, // Default `false`
1818
filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
19-
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
20-
},
19+
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
20+
}
2121
// Generate corresponding .eslintrc-auto-import.json file.
2222
// eslint globals Docs - https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals
2323
}),
@@ -27,20 +27,20 @@ export default [
2727
eslint: {
2828
lintCommand: 'eslint "./packages/**/*.{ts,tsx,vue}"',
2929
dev: {
30-
logLevel: ["error"],
31-
},
32-
},
30+
logLevel: ["error"]
31+
}
32+
}
3333
}),
3434
dts(),
3535
libInjectCss(),
3636
Pages({
3737
dirs: [
3838
{
3939
dir: "playground/demo",
40-
baseRoute: "demo",
41-
},
40+
baseRoute: "demo"
41+
}
4242
],
43-
exclude: ["playground/demo/index.vue"],
43+
exclude: ["playground/demo/index.vue"]
4444
}),
45-
WindiCSS(),
45+
WindiCSS()
4646
];

docs/demo/home.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
</template>
66

77
<script lang="ts" setup>
8-
import { ref } from "vue"
9-
import type { EditorConfiguration } from "codemirror"
10-
import Codemirror from "../../packages/index"
8+
import { ref } from "vue";
9+
import type { EditorConfiguration } from "codemirror";
10+
import Codemirror from "../../packages/index";
1111
1212
// language
13-
import "codemirror/mode/javascript/javascript.js"
13+
import "codemirror/mode/javascript/javascript.js";
1414
1515
const code = ref(
1616
`var arr = [3, 10, 6, 2];
@@ -24,9 +24,9 @@ for (var i = 0; i < arr.length - 1; i++) {
2424
}
2525
}
2626
console.log(arr)`
27-
)
27+
);
2828
2929
const cmOptions: EditorConfiguration = {
3030
mode: "text/javascript"
31-
}
31+
};
3232
</script>

docs/demo/index.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,34 @@
1212
</template>
1313

1414
<script setup lang="ts">
15-
import { ref, onMounted } from "vue"
16-
import { Editor } from "codemirror"
17-
import Codemirror from "../../packages/index"
15+
import { ref, onMounted } from "vue";
16+
import { Editor } from "codemirror";
17+
import Codemirror from "../../packages/index";
1818
1919
// language
20-
import "codemirror/mode/javascript/javascript.js"
20+
import "codemirror/mode/javascript/javascript.js";
2121
2222
// theme
2323
// import "codemirror/theme/dracula.css"
2424
25-
const isMounted = ref(false)
25+
const isMounted = ref(false);
2626
2727
const code = ref(`var i = 0;
2828
for (; i < 9; i++) {
2929
console.log(i);
3030
// more statements
3131
}
32-
`)
32+
`);
3333
3434
const onChange = (val: string, cm: Editor) => {
35-
console.log(val, cm)
36-
}
35+
console.log(val, cm);
36+
};
3737
3838
const cmOptions = {
3939
mode: "text/javascript",
4040
theme: "default"
41-
}
41+
};
4242
onMounted(() => {
43-
isMounted.value = true
44-
})
43+
isMounted.value = true;
44+
});
4545
</script>

docs/demo/log/fclog.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
</template>
44

55
<script>
6-
import { ref, defineComponent } from "vue"
7-
import Codemirror, { createLinkMark, createLog, createTitle } from "../../../packages/index"
6+
import { ref, defineComponent } from "vue";
7+
import Codemirror, { createLinkMark, createLog, createTitle } from "../../../packages/index";
88
99
export default defineComponent({
1010
components: { Codemirror },
@@ -19,15 +19,15 @@ ${createTitle("带有时间节点和输出类型的日志")}
1919
${createLog("info content", "info")}
2020
${createLog("warning content", "warning")}
2121
${createLog("error content", "error")}
22-
`)
22+
`);
2323
const cmOptions = {
2424
mode: "fclog"
25-
}
25+
};
2626
return {
2727
ref,
2828
code,
2929
cmOptions
30-
}
30+
};
3131
}
32-
})
32+
});
3333
</script>

docs/demo/log/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
</template>
44

55
<script>
6-
import { ref, defineComponent } from "vue"
7-
import Codemirror, { createLinkMark, createLogMark, createTitle } from "../../../packages/index"
6+
import { ref, defineComponent } from "vue";
7+
import Codemirror, { createLinkMark, createLogMark, createTitle } from "../../../packages/index";
88
99
export default defineComponent({
1010
components: { Codemirror },
@@ -31,11 +31,11 @@ at com.zhiweicloud.dataprocess.engine.FlinkEngine.readFlinkEngineConfig(FlinkEng
3131
at com.zhiweicloud.dataprocess.engine.FlinkEngine.buildFlinkStream(FlinkEngine.
3232
at com.zhiweicloud.dataprocess.engine.FlinkEngine.startFlinkEngine(FlinkEngine.
3333
at com.zhiweicloud.dataprocess.DataStreamMain.main(DataStreamMain.
34-
`)
34+
`);
3535
const cmOptions = {
3636
mode: "log",
3737
theme: "default"
38-
}
38+
};
3939
return {
4040
Codemirror,
4141
createLinkMark,
@@ -44,7 +44,7 @@ at com.zhiweicloud.dataprocess.DataStreamMain.main(DataStreamMain.
4444
ref,
4545
code,
4646
cmOptions
47-
}
47+
};
4848
}
49-
})
49+
});
5050
</script>

docs/demo/mergeDemo.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@
1010
</template>
1111

1212
<script>
13-
import { ref, defineComponent, onMounted, reactive } from "vue"
13+
import { ref, defineComponent, onMounted, reactive } from "vue";
1414
15-
import Codemirror from "../../packages/index"
15+
import Codemirror from "../../packages/index";
1616
17-
import "codemirror/mode/htmlmixed/htmlmixed.js"
17+
import "codemirror/mode/htmlmixed/htmlmixed.js";
1818
1919
export default defineComponent({
2020
components: {
2121
Codemirror
2222
},
2323
setup() {
24-
const isMounted = ref(false)
24+
const isMounted = ref(false);
2525
const code = ref(`<head>
2626
<title>codemirror-editor-vue</title>
2727
<meta data-n-head="ssr" charset="utf-8">
28-
</head>`)
28+
</head>`);
2929
const orig2 = ref(`<head>
3030
<title>test title</title>
3131
<meta data-n-head="ssr" charset="utf-8">
32-
</head>`)
32+
</head>`);
3333
onMounted(() => {
34-
isMounted.value = true
35-
})
34+
isMounted.value = true;
35+
});
3636
return {
3737
isMounted,
3838
onChange(val, cminstance) {
39-
console.log(val)
40-
console.log(cminstance)
39+
console.log(val);
40+
console.log(cminstance);
4141
},
4242
cmOptions: reactive({
4343
value: code,
@@ -49,7 +49,7 @@
4949
collapseIdentical: false,
5050
highlightDifferences: true
5151
})
52-
}
52+
};
5353
}
54-
})
54+
});
5555
</script>

packages/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import _CodeMirror from "./src/sourceLib";
66

77
interface CmComp {
88
cminstance: Editor;
9-
resize: (
10-
width?: string | number | null,
11-
height?: string | number | null
12-
) => void;
9+
resize: (width?: string | number | null, height?: string | number | null) => void;
1310
refresh: () => void;
1411
destroy: () => void;
1512
}

0 commit comments

Comments
 (0)