Skip to content

Commit d4c2ae8

Browse files
committed
fix: use eslint to format source code
1 parent 66758d4 commit d4c2ae8

26 files changed

Lines changed: 231 additions & 220 deletions

README-zh.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pnpm add @vue/composition-api
6060
#### 注册为全局组件
6161

6262
```ts
63-
import {createApp} from 'vue'
63+
import { createApp } from 'vue'
6464
import CodeDiff from 'v-code-diff'
6565

6666
app
@@ -71,12 +71,12 @@ app
7171
然后
7272

7373
```vue
74-
7574
<template>
7675
<code-diff
77-
:old-string="'12345'"
78-
:new-string="'3456'"
79-
output-format="side-by-side"/>
76+
old-string="12345"
77+
new-string="3456"
78+
output-format="side-by-side"
79+
/>
8080
</template>
8181
```
8282

@@ -89,10 +89,10 @@ app
8989
#### 注册为全局组件
9090

9191
```ts
92-
import Vue from 'vue';
93-
import CodeDiff from 'v-code-diff';
92+
import Vue from 'vue'
93+
import CodeDiff from 'v-code-diff'
9494

95-
Vue.use(CodeDiff);
95+
Vue.use(CodeDiff)
9696
```
9797

9898
#### 单独引入

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pnpm add @vue/composition-api
6060
#### Register globally
6161

6262
```ts
63-
import {createApp} from 'vue'
63+
import { createApp } from 'vue'
6464
import CodeDiff from 'v-code-diff'
6565

6666
app
@@ -71,12 +71,12 @@ app
7171
then
7272

7373
```vue
74-
7574
<template>
7675
<code-diff
77-
:old-string="'12345'"
78-
:new-string="'3456'"
79-
output-format="side-by-side"/>
76+
old-string="12345"
77+
new-string="3456"
78+
output-format="side-by-side"
79+
/>
8080
</template>
8181
```
8282

@@ -89,10 +89,10 @@ Not recommended, but the relevant capabilities are retained to facilitate migrat
8989
#### Register globally
9090

9191
```ts
92-
import Vue from 'vue';
92+
import Vue from 'vue'
9393
import CodeDiff from 'v-code-diff'
9494

95-
Vue.use(CodeDiff);
95+
Vue.use(CodeDiff)
9696
```
9797

9898
#### Register locally

demo/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ if (localStorage.getItem('oldString'))
2222
if (localStorage.getItem('newString'))
2323
newString.value = localStorage.getItem('newString')
2424
25-
const resetText = () => {
25+
function resetText() {
2626
localStorage.removeItem('oldString')
2727
localStorage.removeItem('newString')
2828
oldString.value = oldShortText.value
2929
newString.value = newShortText.value
3030
}
31-
const clearText = () => {
31+
function clearText() {
3232
localStorage.removeItem('oldString')
3333
localStorage.removeItem('newString')
3434
oldString.value = ''

demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"gh-pages": "^5.0.0"
1212
},
1313
"devDependencies": {
14-
"vite": "^4.4.4",
1514
"@vitejs/plugin-vue": "^4.0.0",
16-
"unplugin-vue-components": "^0.23.0"
15+
"unplugin-vue-components": "^0.23.0",
16+
"vite": "^4.4.4"
1717
}
1818
}

example/npm/vue3_vite/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"vue": "^3.3.2",
12-
"v-code-diff": "^1.4.0"
11+
"v-code-diff": "^1.4.0",
12+
"vue": "^3.3.2"
1313
},
1414
"devDependencies": {
1515
"@vitejs/plugin-vue": "^4.2.3",

example/npm/vue3_vite/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
</script>
33

44
<template>
5-
<CodeDiff old-string="123" new-string="456"></CodeDiff>
5+
<CodeDiff old-string="123" new-string="456" />
66
</template>
77

88
<style scoped>

example/npm/vue3_vite/src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createApp } from 'vue'
2-
import App from './App.vue'
32
import CodeDiff from 'v-code-diff'
3+
import App from './App.vue'
44

55
createApp(App).use(CodeDiff).mount('#app')
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fileURLToPath, URL } from 'node:url'
1+
import { URL, fileURLToPath } from 'node:url'
22

33
import { defineConfig } from 'vite'
44
import vue from '@vitejs/plugin-vue'
@@ -8,7 +8,7 @@ export default defineConfig({
88
plugins: [vue()],
99
resolve: {
1010
alias: {
11-
'@': fileURLToPath(new URL('./src', import.meta.url))
12-
}
13-
}
11+
'@': fileURLToPath(new URL('./src', import.meta.url)),
12+
},
13+
},
1414
})

package.json

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "v-code-diff",
33
"version": "1.5.1",
44
"description": "template component for vue-demi, can dev and build",
5-
"main": "dist/index.cjs",
6-
"module": "dist/index.es.js",
7-
"types": "./types/index.d.ts",
85
"exports": {
96
".": {
10-
"import": "./dist/index.es.js",
11-
"require": "./dist/index.cjs.js"
7+
"require": "./dist/index.cjs.js",
8+
"import": "./dist/index.es.js"
129
}
1310
},
11+
"main": "dist/index.cjs",
12+
"module": "dist/index.es.js",
13+
"types": "./types/index.d.ts",
1414
"files": [
1515
"scripts",
1616
"dist",
@@ -31,20 +31,12 @@
3131
"dev:2.7": "vue-demi-switch 2.7 vue2 && pnpm --filter vue2.7-playground dev",
3232
"dev:3": "vue-demi-switch 3 vue3 && pnpm --filter vue3-playground dev",
3333
"dev:demo": "vue-demi-switch 3 vue3 && pnpm --filter demo dev",
34-
"lint:fix": "eslint . --ext .vue,.js,.jsx,.ts,.tsx --fix --ignore-path .gitignore",
34+
"lint": "eslint .",
35+
"lint:fix": "eslint . --ext .vue,.js,.jsx,.ts,.tsx,json --fix --ignore-path .gitignore",
3536
"postinstall": "node scripts/postinstall.js",
3637
"prepublishOnly": "npm run build",
3738
"release": "bumpp --commit --no-push --tag && npm publish"
3839
},
39-
"author": "Shimada666<649940882@qq.com>",
40-
"license": "MIT",
41-
"bugs": {
42-
"url": "https://github.com/Shimada666/v-code-diff/issues"
43-
},
44-
"repository": {
45-
"type": "git",
46-
"url": "git+https://github.com/Shimada666/v-code-diff.git"
47-
},
4840
"peerDependencies": {
4941
"@vue/composition-api": "^1.4.9",
5042
"vue": "^2.6.0 || >=3.0.0"
@@ -66,7 +58,7 @@
6658
"@types/diff-match-patch": "^1.0.32",
6759
"@types/node": "^18.11.18",
6860
"bumpp": "^8.2.1",
69-
"eslint": "^8.31.0",
61+
"eslint": "^8.45.0",
7062
"npm-run-all": "^4.1.5",
7163
"rimraf": "^3.0.2",
7264
"sass": "^1.63.6",

0 commit comments

Comments
 (0)