diff --git a/packages/ui/lint-staged.config.js b/lint-staged.config.js similarity index 100% rename from packages/ui/lint-staged.config.js rename to lint-staged.config.js diff --git a/packages/core/lint-staged.config.js b/packages/core/lint-staged.config.js deleted file mode 100644 index 88166ed6d..000000000 --- a/packages/core/lint-staged.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '*.ts?(x)': ['eslint --cache --fix', () => 'tsc -p tsconfig.json --noEmit'], -}; diff --git a/packages/phrases/package.json b/packages/phrases/package.json index 4edaae1d7..704666145 100644 --- a/packages/phrases/package.json +++ b/packages/phrases/package.json @@ -16,6 +16,7 @@ }, "scripts": { "preinstall": "npx only-allow pnpm", + "precommit": "lint-staged", "build": "rm -rf lib/ && tsc", "lint": "eslint --ext .ts src", "prepack": "pnpm build" @@ -27,6 +28,7 @@ "@logto/eslint-config": "^0.1.0-rc.24", "@logto/ts-config": "^0.1.0-rc.24", "eslint": "^7.31.0", + "lint-staged": "^11.1.1", "prettier": "^2.3.2", "typescript": "^4.3.5" }, diff --git a/packages/schemas/package.json b/packages/schemas/package.json index edf7caf45..55984ea50 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -11,6 +11,7 @@ "private": true, "scripts": { "preinstall": "npx only-allow pnpm", + "precommit": "lint-staged", "generate": "ts-node src/gen/index.ts && eslint \"src/db-entries/**\" --fix", "build": "pnpm generate && rm -rf lib/ && tsc --p tsconfig.build.json", "lint": "eslint --ext .ts src", @@ -28,6 +29,7 @@ "@types/pluralize": "^0.0.29", "camelcase": "^6.2.0", "eslint": "^7.30.0", + "lint-staged": "^11.1.1", "lodash.uniq": "^4.5.0", "pluralize": "^8.0.0", "prettier": "^2.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5237d7a55..8cf25cdec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,12 +114,14 @@ importers: '@logto/eslint-config': ^0.1.0-rc.24 '@logto/ts-config': ^0.1.0-rc.24 eslint: ^7.31.0 + lint-staged: ^11.1.1 prettier: ^2.3.2 typescript: ^4.3.5 devDependencies: '@logto/eslint-config': 0.1.0-rc.24_2055f56ab8dafa07df5c7ad406c8a4ab '@logto/ts-config': 0.1.0-rc.24_43787dd55a198a22e6c455f148105a9c eslint: 7.31.0 + lint-staged: 11.1.1 prettier: 2.3.2 typescript: 4.3.5 @@ -134,6 +136,7 @@ importers: '@types/pluralize': ^0.0.29 camelcase: ^6.2.0 eslint: ^7.30.0 + lint-staged: ^11.1.1 lodash.uniq: ^4.5.0 pluralize: ^8.0.0 prettier: ^2.3.2 @@ -151,6 +154,7 @@ importers: '@types/pluralize': 0.0.29 camelcase: 6.2.0 eslint: 7.31.0 + lint-staged: 11.1.1 lodash.uniq: 4.5.0 pluralize: 8.0.0 prettier: 2.3.2 @@ -10492,7 +10496,7 @@ packages: resolution: {integrity: sha512-eTNGe6i78PSUUH2BZi1gZmGmNfb8IeN4z2OzMYxSZ1qnP1WXKn1E7D+OHwLbRDm/wQINnzIj0bsKJ6lLVSuZiQ==} hasBin: true dependencies: - chalk: 4.1.1 + chalk: 4.1.2 cli-truncate: 2.1.0 commander: 7.2.0 cosmiconfig: 7.0.0 @@ -10671,7 +10675,7 @@ packages: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} engines: {node: '>=10'} dependencies: - chalk: 4.1.1 + chalk: 4.1.2 is-unicode-supported: 0.1.0 dev: true