Skip to content

Commit d1bf0f8

Browse files
committed
refactor(lint): f2elint
1 parent c7bb04c commit d1bf0f8

13 files changed

+4395
-2718
lines changed

.editorconfig

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
# http://editorconfig.org
21
root = true
32

43
[*]
54
indent_style = space
65
indent_size = 2
76
end_of_line = lf
7+
max_line_length = 100
88
charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
11-
12-
[*.md]
13-
trim_trailing_whitespace = false
14-
15-
[Makefile]
16-
indent_style = tab
11+
quote_type = single

.eslintrc.js

-27
This file was deleted.

.husky/commit-msg

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
1+
#!/usr/bin/env sh
32

4-
npx commitlint --edit $1
3+
PATH=$(pwd)/.node/bin:$(pwd)/node_modules/.bin:$PATH commitlint --edit ${1}

.husky/pre-commit

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
32

4-
npm run pretty
3+
PATH=$(pwd)/.node/bin:$(pwd)/node_modules/.bin:$PATH lint-staged

.prettierignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.ci
2+
build
3+
coverage
4+
dist
5+
es
6+
lib
7+
node_modules
8+
package-lock.json
9+
pnpm-lock.yaml
10+
yarn.lock
11+
*.min.js
12+
*.min.css

config/config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export default {
3838
manifest: {},
3939
hash: true,
4040
alias: {
41-
ahooks: process.cwd() + '/packages/hooks/src/index.ts',
42-
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
41+
ahooks: `${process.cwd()}/packages/hooks/src/index.ts`,
42+
'@ahooksjs/use-url-state': `${process.cwd()}/packages/use-url-state/src/index.ts`,
4343
},
4444
resolve: {
4545
includes: ['docs', 'packages/hooks/src', 'packages/use-url-state'],

eslint.config.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { react } from 'eslint-config-ali';
2+
import prettier from 'eslint-plugin-prettier/recommended';
3+
4+
export default [...react, prettier];

example/taro/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

package.json

+66-52
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,96 @@
11
{
22
"name": "ahooks",
33
"private": true,
4-
"packageManager": "[email protected]",
5-
"engines": {
6-
"pnpm": ">=7 <10"
7-
},
84
"repository": {
95
"type": "git",
106
"url": "git+https://github.com/alibaba/hooks.git"
117
},
128
"scripts": {
13-
"init": "pnpm install && pnpm run build",
14-
"start": "pnpm run dev",
15-
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && dumi dev",
16-
"clean-dist": "rimraf 'packages/*/{lib,es,node_modules,dist}'",
17-
"clean": "pnpm run clean-dist && rimraf node_modules",
189
"build": "pnpm -r --filter=./packages/* run build",
19-
"test": "jest",
10+
"build:doc": "dumi build",
11+
"clean": "pnpm run clean-dist && rimraf node_modules",
12+
"clean-dist": "rimraf 'packages/*/{lib,es,node_modules,dist}'",
2013
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
21-
"lint": "eslint --ignore-pattern **/__tests__/* --ignore-pattern **/demo/* \"packages/*/src/**/*.{ts,tsx}\" --cache",
14+
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && dumi dev",
15+
"init": "pnpm install && pnpm run build",
16+
"preinstall": "npx only-allow pnpm",
17+
"lint": "eslint .",
18+
"lint:fix": "prettier --write . && eslint --fix .",
19+
"prepare": "husky",
2220
"pretty": "biome format --fix --staged",
23-
"build:doc": "dumi build",
24-
"pub:doc-surge": "surge ./dist --domain ahooks.js.org",
25-
"pub:doc-gitee": "cd ./dist && rm -rf .git && touch .spa && touch .nojekyll && git init && git remote add origin [email protected]:ahooks/ahooks.git && git add -A && git commit -m \"publish docs\" && git push origin main -f && echo https://gitee.com/ahooks/ahooks/pages",
26-
"pub:doc": "pnpm run build:doc && pnpm run pub:doc-surge && pnpm run pub:doc-gitee",
2721
"pub": "pnpm run build && pnpm -r --filter=./packages/* publish",
2822
"pub:beta": "pnpm run build && pnpm -r --filter=./packages/* publish --tag beta",
29-
"preinstall": "npx only-allow pnpm",
30-
"prepare": "husky install",
23+
"pub:doc": "pnpm run build:doc && pnpm run pub:doc-surge && pnpm run pub:doc-gitee",
24+
"pub:doc-gitee": "cd ./dist && rm -rf .git && touch .spa && touch .nojekyll && git init && git remote add origin [email protected]:ahooks/ahooks.git && git add -A && git commit -m \"publish docs\" && git push origin main -f && echo https://gitee.com/ahooks/ahooks/pages",
25+
"pub:doc-surge": "surge ./dist --domain ahooks.js.org",
26+
"start": "pnpm run dev",
27+
"test": "jest",
3128
"test:strict": "cross-env REACT_MODE=strict jest"
3229
},
30+
"commitlint": {
31+
"extends": [
32+
"ali"
33+
]
34+
},
35+
"lint-staged": {
36+
"*.{cjs,cts,js,jsx,mjs,mts,ts,tsx,vue}": "eslint --fix",
37+
"*.{cjs,css,cts,html,js,json,jsx,less,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}": "prettier --write"
38+
},
39+
"prettier": "prettier-config-ali",
3340
"devDependencies": {
34-
"@ant-design/icons": "^5.3.0",
35-
"@babel/cli": "^7.10.1",
36-
"@babel/core": "^7.10.2",
37-
"@babel/plugin-transform-runtime": "^7.19.6",
38-
"@biomejs/biome": "^1.8.3",
39-
"@commitlint/cli": "^17.1.2",
40-
"@commitlint/config-conventional": "^17.1.0",
41-
"@testing-library/jest-dom": "^5.16.5",
41+
"@ant-design/icons": "^5.6.1",
42+
"@babel/cli": "^7.26.4",
43+
"@babel/core": "^7.26.9",
44+
"@babel/plugin-transform-runtime": "^7.26.9",
45+
"@biomejs/biome": "^1.9.4",
46+
"@commitlint/cli": "^19.7.1",
47+
"@commitlint/config-conventional": "^17.8.1",
48+
"@testing-library/jest-dom": "^5.17.0",
4249
"@testing-library/react": "^13.4.0",
43-
"@types/jest": "^29.4.0",
44-
"@types/mockjs": "^1.0.7",
45-
"@types/react-router": "^5.1.19",
46-
"@umijs/fabric": "^2.1.0",
47-
"antd": "^5.14.2",
48-
"babel-plugin-import": "^1.12.0",
50+
"@types/jest": "^29.5.14",
51+
"@types/mockjs": "^1.0.10",
52+
"@types/react-router": "^5.1.20",
53+
"@umijs/fabric": "^2.14.1",
54+
"antd": "^5.24.2",
55+
"babel-plugin-import": "^1.13.8",
56+
"commitlint-config-ali": "^1.1.0",
4957
"coveralls": "^3.1.1",
5058
"cross-env": "^7.0.3",
5159
"del": "^5.1.0",
52-
"dumi": "^1.1.48",
53-
"eslint": "^8.56.0",
54-
"eslint-plugin-react-hooks": "^4.6.0",
55-
"fast-glob": "^3.2.11",
56-
"fs-extra": "^10.0.1",
60+
"dumi": "^1.1.54",
61+
"eslint": "^9.21.0",
62+
"eslint-config-ali": "^16.1.1",
63+
"eslint-config-prettier": "^10.0.2",
64+
"eslint-plugin-prettier": "^5.2.3",
65+
"fast-glob": "^3.3.3",
66+
"fs-extra": "^10.1.0",
5767
"gray-matter": "^4.0.3",
5868
"gulp": "^4.0.2",
5969
"gulp-babel": "^8.0.0",
60-
"gulp-typescript": "^6.0.0-alpha.1",
61-
"husky": "^8.0.0",
62-
"jest": "^29.4.1",
63-
"jest-environment-jsdom": "^29.4.1",
64-
"jest-localstorage-mock": "^2.4.18",
70+
"gulp-typescript": "6.0.0-alpha.1",
71+
"husky": "^9.1.7",
72+
"jest": "^29.7.0",
73+
"jest-environment-jsdom": "^29.7.0",
74+
"jest-localstorage-mock": "^2.4.26",
75+
"lint-staged": "^15.4.3",
6576
"mockjs": "^1.1.0",
66-
"react": "^18.2.0",
67-
"react-dom": "^18.2.0",
68-
"react-drag-listview": "^0.1.6",
69-
"react-router": "^6.4.2",
70-
"react-shadow": "^19.0.3",
77+
"prettier": "^3.5.3",
78+
"prettier-config-ali": "^1.3.2",
79+
"react": "^18.3.1",
80+
"react-dom": "^18.3.1",
81+
"react-drag-listview": "^0.1.9",
82+
"react-router": "^6.30.0",
83+
"react-shadow": "^19.1.0",
7184
"rimraf": "^3.0.2",
72-
"surge": "^0.21.3",
73-
"ts-jest": "^29.1.1",
74-
"typescript": "^5.1.3",
75-
"webpack": "^5.90.3",
85+
"surge": "^0.21.7",
86+
"ts-jest": "^29.2.6",
87+
"typescript": "^5.8.2",
88+
"webpack": "^5.98.0",
7689
"webpack-cli": "^5.1.4",
7790
"webpack-merge": "^4.2.2"
7891
},
79-
"commitlint": {
80-
"extends": ["@commitlint/config-conventional"]
92+
"packageManager": "[email protected]",
93+
"engines": {
94+
"pnpm": ">=10 <11"
8195
}
8296
}

0 commit comments

Comments
 (0)