Skip to content

Commit f2898a0

Browse files
committed
Add eslint
1 parent b9910df commit f2898a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+919
-810
lines changed

.github/workflows/static.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy static content to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ["master"]
7+
branches: [master]
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
@@ -18,7 +18,7 @@ permissions:
1818
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1919
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2020
concurrency:
21-
group: "pages"
21+
group: pages
2222
cancel-in-progress: false
2323

2424
jobs:
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/upload-pages-artifact@v1
3838
with:
3939
# Upload entire repository
40-
path: './dist'
40+
path: ./dist
4141
- name: Deploy to GitHub Pages
4242
id: deployment
4343
uses: actions/deploy-pages@v2

eslint.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu({
4+
ignores: ['**/*.md', '**/*.md/*.*', 'dist/', 'public/', '**/dist/**/', 'node_modules', '**/node_modules/**', 'node_modules/', '**/node_modules/**/', 'patches/', '**/patches/**/', 'types/', '**/types/**/', 'cache/', '**/cache/**/', '!packages/.vitepress', '!packages/.vitepress/**', '!.eslintrc.js', '!.eslintrc.js/**', '!rollup.config.js', '!rollup.config.js/**', '!.test', '!**/.test/**', '.temp', '**/.temp/**'],
5+
}, {
6+
rules: {
7+
'vue/no-deprecated-functional-template': 'off',
8+
'vue/one-component-per-file': 'off',
9+
'vue/no-template-shadow': 'off',
10+
'vue/require-prop-types': 'off',
11+
'vue/dot-location': 'off',
12+
'spaced-comment': ['error', 'always', { exceptions: ['#__PURE__'] }],
13+
'no-restricted-imports': [
14+
'error',
15+
{
16+
patterns: ['../**/core', '../**/vue3'],
17+
},
18+
],
19+
'vue/eqeqeq': 'off',
20+
'vue/space-unary-ops': 'off',
21+
'vue/comma-dangle': ['error', 'only-multiline'],
22+
'node/no-callback-literal': 'off',
23+
'import/namespace': 'off',
24+
'eqeqeq': 'off',
25+
'import/default': 'off',
26+
'import/no-named-as-default': 'off',
27+
'import/no-named-as-default-member': 'off',
28+
'curly': ['error', 'multi-line'],
29+
'max-statements-per-line': ['error', {
30+
max: 1,
31+
}],
32+
},
33+
}, {
34+
files: ['demo.vue', 'demo.client.vue', 'scripts/*.ts', '**/*.test.ts'],
35+
rules: {
36+
'no-alert': 'off',
37+
'no-console': 'off',
38+
'no-undef': 'off',
39+
'no-unused-vars': 'off',
40+
'no-restricted-imports': 'off',
41+
'@typescript-eslint/no-unused-vars': 'off',
42+
'@typescript-eslint/no-redeclare': 'off',
43+
'unused-imports/no-unused-vars': 'off',
44+
},
45+
})

package.json

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
11
{
22
"name": "@widget-js/hotspot",
3+
"type": "module",
34
"version": "0.1.1",
4-
"license": "MIT",
5-
"author": "Widget JS",
65
"private": true,
6+
"author": "Widget JS",
7+
"license": "MIT",
78
"scripts": {
89
"serve": "vite",
910
"build": "vite build",
1011
"build:local": "vite build --mode offline",
1112
"preview": "vite preview",
1213
"remote": "widget dependencies -t remote && pnpm install",
1314
"local": "widget dependencies -t local && pnpm install",
14-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
15-
"format": "prettier --write src/ "
16-
},
17-
"type": "module",
18-
"pnpm": {
19-
"peerDependencyRules": {
20-
"ignoreMissing": [
21-
"react",
22-
"react-dom",
23-
"rollup",
24-
"@types/react"
25-
]
26-
}
15+
"lint": "eslint --cache .",
16+
"lint:fix": "eslint --cache . --fix"
2717
},
2818
"dependencies": {
2919
"@vueuse/core": "^9.4.0",
@@ -40,6 +30,7 @@
4030
"vue-router": "^4.0.3"
4131
},
4232
"devDependencies": {
33+
"@antfu/eslint-config": "^2.6.1",
4334
"@types/color": "^3.0.3",
4435
"@types/lodash": "^4.14.186",
4536
"@typescript-eslint/eslint-plugin": "^6.0.0",
@@ -55,12 +46,14 @@
5546
"@widget-js/cli": "^1.1.11",
5647
"@widget-js/vite-plugin-widget": "^1.2.2",
5748
"css-loader": "^6.7.2",
58-
"eslint": "^8.26.0",
49+
"eslint": "8.48.0",
5950
"eslint-plugin-vue": "^9.15.1",
60-
"lint-staged": "^13.0.3",
51+
"lint-staged": "^13.2.2",
6152
"prettier": "^2.8.4",
6253
"sass": "^1.56.0",
6354
"sass-loader": "^12.0.0",
55+
"simple-git": "^3.22.0",
56+
"simple-git-hooks": "^2.9.0",
6457
"style-loader": "^3.3.1",
6558
"tsconfig-paths-webpack-plugin": "^4.0.0",
6659
"typescript": "^5.2.2",
@@ -69,5 +62,23 @@
6962
"vite": "^4.4.11",
7063
"vue-loader": "^16.8.3",
7164
"vue-tsc": "^1.0.11"
65+
},
66+
"pnpm": {
67+
"peerDependencyRules": {
68+
"ignoreMissing": [
69+
"react",
70+
"react-dom",
71+
"rollup",
72+
"@types/react"
73+
]
74+
}
75+
},
76+
"simple-git-hooks": {
77+
"pre-commit": "eslint --cache --fix"
78+
},
79+
"lint-staged": {
80+
"*.{js,ts,tsx,vue,md}": [
81+
"eslint --cache --fix"
82+
]
7283
}
73-
}
84+
}

public/cn.widgetjs.widgets.hotspot.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
]
5858
},
5959
{
60-
"name": "ccn.widgetjs.widgets.hotspot.weibo",
60+
"name": "cn.widgetjs.widgets.hotspot.bilibili",
6161
"title": {
62-
"zh-CN": "微博热搜"
62+
"zh-CN": "bilibili热搜"
6363
},
6464
"description": {
65-
"zh-CN": "微博热搜"
65+
"zh-CN": "看看年轻人在B站搜什么"
6666
},
6767
"keywords": [
6868
"recommend"
@@ -80,25 +80,25 @@
8080
"movable": true,
8181
"singleton": false,
8282
"resizable": true,
83-
"path": "/widget/weibo",
83+
"path": "/widget/bilibili",
8484
"meta": {},
8585
"backgroundThrottling": true,
86-
"previewImage": "/images/weibo_hot_search.png",
86+
"previewImage": "/images/bilibili_hot_search.png",
8787
"supportDeployMode": 17,
8888
"routes": [
8989
{
90-
"url": "/widget/weibo",
90+
"url": "/widget/bilibili",
9191
"name": "index"
9292
}
9393
]
9494
},
9595
{
96-
"name": "cn.widgetjs.widgets.hotspot.douyin",
96+
"name": "cn.widgetjs.widgets.hotspot.bangumi",
9797
"title": {
98-
"zh-CN": "抖音热榜"
98+
"zh-CN": "B站新番时间表"
9999
},
100100
"description": {
101-
"zh-CN": "抖音热榜"
101+
"zh-CN": "追番小助手"
102102
},
103103
"keywords": [
104104
"recommend"
@@ -107,34 +107,34 @@
107107
"permissions": [],
108108
"lang": "zh-CN",
109109
"width": 4,
110-
"height": 3,
110+
"height": 4,
111111
"maxWidth": 6,
112112
"webviewTag": false,
113-
"maxHeight": 6,
113+
"maxHeight": 4,
114114
"minWidth": 4,
115-
"minHeight": 3,
115+
"minHeight": 4,
116116
"movable": true,
117117
"singleton": false,
118118
"resizable": true,
119-
"path": "/widget/douyin",
119+
"path": "/widget/bangumi",
120120
"meta": {},
121121
"backgroundThrottling": true,
122-
"previewImage": "/images/preview_douyin.png",
122+
"previewImage": "/images/preview_bangumi.png",
123123
"supportDeployMode": 17,
124124
"routes": [
125125
{
126-
"url": "/widget/douyin",
126+
"url": "/widget/bangumi",
127127
"name": "index"
128128
}
129129
]
130130
},
131131
{
132-
"name": "cn.widgetjs.widgets.hotspot.bilibili",
132+
"name": "ccn.widgetjs.widgets.hotspot.weibo",
133133
"title": {
134-
"zh-CN": "bilibili热搜"
134+
"zh-CN": "微博热搜"
135135
},
136136
"description": {
137-
"zh-CN": "看看年轻人在B站搜什么"
137+
"zh-CN": "微博热搜"
138138
},
139139
"keywords": [
140140
"recommend"
@@ -152,25 +152,25 @@
152152
"movable": true,
153153
"singleton": false,
154154
"resizable": true,
155-
"path": "/widget/bilibili",
155+
"path": "/widget/weibo",
156156
"meta": {},
157157
"backgroundThrottling": true,
158-
"previewImage": "/images/bilibili_hot_search.png",
158+
"previewImage": "/images/weibo_hot_search.png",
159159
"supportDeployMode": 17,
160160
"routes": [
161161
{
162-
"url": "/widget/bilibili",
162+
"url": "/widget/weibo",
163163
"name": "index"
164164
}
165165
]
166166
},
167167
{
168-
"name": "cn.widgetjs.widgets.hotspot.bangumi",
168+
"name": "cn.widgetjs.widgets.hotspot.douyin",
169169
"title": {
170-
"zh-CN": "B站新番时间表"
170+
"zh-CN": "抖音热榜"
171171
},
172172
"description": {
173-
"zh-CN": "追番小助手"
173+
"zh-CN": "抖音热榜"
174174
},
175175
"keywords": [
176176
"recommend"
@@ -179,23 +179,23 @@
179179
"permissions": [],
180180
"lang": "zh-CN",
181181
"width": 4,
182-
"height": 4,
182+
"height": 3,
183183
"maxWidth": 6,
184184
"webviewTag": false,
185-
"maxHeight": 4,
185+
"maxHeight": 6,
186186
"minWidth": 4,
187-
"minHeight": 4,
187+
"minHeight": 3,
188188
"movable": true,
189189
"singleton": false,
190190
"resizable": true,
191-
"path": "/widget/bangumi",
191+
"path": "/widget/douyin",
192192
"meta": {},
193193
"backgroundThrottling": true,
194-
"previewImage": "/images/preview_bangumi.png",
194+
"previewImage": "/images/preview_douyin.png",
195195
"supportDeployMode": 17,
196196
"routes": [
197197
{
198-
"url": "/widget/bangumi",
198+
"url": "/widget/douyin",
199199
"name": "index"
200200
}
201201
]

0 commit comments

Comments
 (0)