diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000000..31354ec138 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit index 2205895642..d37daa075e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx --no-install pretty-quick --staged \ No newline at end of file +npx --no-install lint-staged diff --git a/package.json b/package.json index b15c98fe09..1c81b0c2ae 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "lint:style": "stylelint '{site,components}/**/*.less'", "pre-publish": "npm run test-all -- --skip-build", "prettier": "prettier -c --write **/*", - "pretty-quick": "pretty-quick", + "rome:format": "rome format --write .", "pub": "npm run version && antd-tools run pub", "prepublishOnly": "antd-tools run guard", "postpublish": "node ./scripts/post-script.js", @@ -245,6 +245,7 @@ "jsdom": "^20.0.0", "jsonml.js": "^0.1.0", "less-vars-to-js": "^1.3.0", + "lint-staged": "^13.0.3", "lz-string": "^1.4.4", "mini-css-extract-plugin": "^1.6.2", "mockdate": "^3.0.0", @@ -252,7 +253,6 @@ "prettier": "^2.3.2", "prettier-plugin-jsdoc": "^0.4.2", "pretty-format": "^29.0.0", - "pretty-quick": "^3.0.0", "qs": "^6.10.1", "rc-footer": "^0.6.6", "rc-tween-one": "^3.0.3", @@ -281,6 +281,7 @@ "remark-preset-lint-recommended": "^6.0.0", "remove-files-webpack-plugin": "1.5.0", "rimraf": "^3.0.0", + "rome": "^10.0.1", "scrollama": "^3.0.0", "semver": "^7.3.5", "simple-git": "^3.0.0", @@ -350,5 +351,8 @@ ], "tnpm": { "mode": "npm" + }, + "lint-staged": { + "*.{ts,tsx,js,json,less,md}": "rome format --write" } } diff --git a/rome.json b/rome.json new file mode 100644 index 0000000000..618edc3e25 --- /dev/null +++ b/rome.json @@ -0,0 +1,14 @@ +{ + "formatter": { + "enabled": true, + "ignore": ["./dist/*", "./es/**/*", "./lib/**/*", "_site/**/*"], + "indentStyle": "space", + "lineWidth": 100, + "indentSize": 2 + }, + "javascript": { + "formatter": { + "quoteStyle": "single" + } + } +} diff --git a/scripts/check-version-md.js b/scripts/check-version-md.js index cf9c8eafca..0af79fb994 100644 --- a/scripts/check-version-md.js +++ b/scripts/check-version-md.js @@ -57,7 +57,6 @@ if (changeLog) { console.log(chalk.blue('[check-version-md]: Check Passed')); console.log('\n'); process.exit(0); - return; } } console.log('\n');