Skip to content

Commit 1602a9c

Browse files
committed
feat: update eslint rules
1 parent 6d1c611 commit 1602a9c

File tree

11 files changed

+751
-289
lines changed

11 files changed

+751
-289
lines changed

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
{
2+
// Enable the ESlint flat config support
3+
"eslint.experimental.useFlatConfig": true,
4+
5+
// Disable the default formatter, use eslint instead
26
"prettier.enable": false,
37
"editor.formatOnSave": false,
8+
9+
// Auto fix
410
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": true,
6-
"source.organizeImports": false
11+
"source.fixAll.eslint": "explicit",
12+
"source.organizeImports": "never"
713
},
814

9-
// The following is optional.
10-
// It's better to put under project setting `.vscode/settings.json`
11-
// to avoid conflicts with working with different eslint configs
12-
// that does not support all formats.
15+
// Silent the stylistic rules in you IDE, but still auto fix them
16+
"eslint.rules.customizations": [
17+
{ "rule": "style/*", "severity": "off" },
18+
{ "rule": "prettier/*", "severity": "off" },
19+
{ "rule": "*-indent", "severity": "off" },
20+
{ "rule": "*-spacing", "severity": "off" },
21+
{ "rule": "*-spaces", "severity": "off" },
22+
{ "rule": "*-order", "severity": "off" },
23+
{ "rule": "*-dangle", "severity": "off" },
24+
{ "rule": "*-newline", "severity": "off" },
25+
{ "rule": "*quotes", "severity": "off" },
26+
{ "rule": "*semi", "severity": "off" }
27+
],
28+
29+
// Enable eslint for all supported languages
1330
"eslint.validate": [
1431
"javascript",
1532
"javascriptreact",

README-zh.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ pnpm add @vue/composition-api
6161
#### 注册为全局组件
6262

6363
```ts
64-
import { createApp } from "vue";
65-
import CodeDiff from "v-code-diff";
64+
import { createApp } from 'vue'
65+
import CodeDiff from 'v-code-diff'
6666

67-
app.use(CodeDiff).mount("#app");
67+
app.use(CodeDiff).mount('#app')
6868
```
6969

7070
然后
@@ -88,10 +88,10 @@ app.use(CodeDiff).mount("#app");
8888
#### 注册为全局组件
8989

9090
```ts
91-
import Vue from "vue";
92-
import CodeDiff from "v-code-diff";
91+
import Vue from 'vue'
92+
import CodeDiff from 'v-code-diff'
9393

94-
Vue.use(CodeDiff);
94+
Vue.use(CodeDiff)
9595
```
9696

9797
#### 单独引入

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ yarn add v-code-diff
4848
pnpm add v-code-diff
4949
```
5050

51-
Vue2 developers need install composition-api
51+
Vue2.6 developers need install composition-api
5252

5353
```shell
5454
pnpm add @vue/composition-api

env.d.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/// <reference types="vite/client" />
22

33
declare module '*.vue' {
4-
import type { DefineComponent } from 'vue'
5-
const component: DefineComponent<{}, {}, any>
6-
export default component
7-
}
4+
import type { DefineComponent } from 'vue'
5+
6+
// eslint-disable-next-line
7+
const component: DefineComponent<{}, {}, any>
8+
export default component
9+
}

eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu({
4+
ignores: ['dist', '**/dist/**', 'node_modules', '**/node_modules/**'],
5+
})

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
22
"name": "v-code-diff",
3+
"type": "module",
34
"version": "1.8.0",
45
"description": "template component for vue-demi, can dev and build",
56
"exports": {
67
".": {
78
"types": "./types/index.d.ts",
8-
"require": "./dist/index.cjs.js",
9-
"import": "./dist/index.es.js"
9+
"import": "./dist/index.es.js",
10+
"require": "./dist/index.cjs.js"
1011
}
1112
},
1213
"main": "dist/index.cjs",
1314
"module": "dist/index.es.js",
1415
"types": "./types/index.d.ts",
1516
"files": [
16-
"scripts",
17+
"LICENSE",
1718
"dist",
19+
"scripts",
1820
"src",
19-
"types",
20-
"LICENSE"
21+
"types"
2122
],
2223
"scripts": {
2324
"build": "npm run clean && run-s build:**",
@@ -55,10 +56,11 @@
5556
"vue-demi": "^0.14.6"
5657
},
5758
"devDependencies": {
58-
"@antfu/eslint-config": "^0.39.8",
59+
"@antfu/eslint-config": "^2.4.5",
5960
"@types/diff": "^5.0.0",
6061
"@types/diff-match-patch": "^1.0.32",
6162
"@types/node": "^18.11.18",
63+
"@unocss/eslint-plugin": "^0.58.0",
6264
"@vueuse/core": "^10.7.0",
6365
"bumpp": "^8.2.1",
6466
"eslint": "^8.55.0",

0 commit comments

Comments
 (0)