Skip to content

Commit 6ec08c5

Browse files
authored
Configure lint-staged precommit on all workspaces (#657)
Only include lint-staged in top-level package.json as outlined in docs: https://github.com/okonet/lint-staged#how-to-use-lint-staged-in-a-multi-package-monorepo Moves lint-staged config to top-level package.json since the same configuration works for all workspaces. lint-staged discovers the closest configuration to each staged file, so workspace specific configs can be added in the future if there are conflicts with the global config.
1 parent 5ce8f2b commit 6ec08c5

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"write-heading-ids": "docusaurus write-heading-ids",
1515
"lint": "eslint --cache \"**/*.js\"",
1616
"lint:fix": "yarn lint --fix",
17+
"precommit": "lint-staged",
1718
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
1819
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,mdx}\""
1920
},

examples/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"start:dist": "yarn build && node -r dotenv/config dist/index.js",
1616
"lint": "eslint src",
1717
"lint:fix": "yarn lint --fix",
18+
"precommit": "tsc --noEmit && lint-staged",
1819
"format": "prettier --write \"**/*.ts\"",
1920
"format:check": "prettier --check \"**/*.ts\""
2021
},

langchain/package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
"hnswlib-node": "^1.4.2",
135135
"html-to-text": "^9.0.5",
136136
"jest": "^29.5.0",
137-
"lint-staged": "^13.1.1",
138137
"mammoth": "^1.5.1",
139138
"pdfjs-dist": "^3.4.120",
140139
"prettier": "^2.8.3",
@@ -246,12 +245,6 @@
246245
"yaml": "^2.2.1",
247246
"zod": "^3.21.4"
248247
},
249-
"lint-staged": {
250-
"**/*.{ts,tsx}": [
251-
"prettier --write --ignore-unknown",
252-
"eslint --cache --fix"
253-
]
254-
},
255248
"publishConfig": {
256249
"access": "public"
257250
},

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,12 @@
4848
},
4949
"resolutions": {
5050
"dpdm@^3.12.0": "patch:dpdm@npm%3A3.12.0#./.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch"
51+
},
52+
"lint-staged": {
53+
"**/*.{ts,tsx}": [
54+
"prettier --write --ignore-unknown",
55+
"eslint --cache --fix"
56+
],
57+
"*.md": "prettier --write"
5158
}
5259
}

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11516,7 +11516,6 @@ __metadata:
1151611516
is-binary-path: ^2.1.0
1151711517
jest: ^29.5.0
1151811518
jsonpointer: ^5.0.1
11519-
lint-staged: ^13.1.1
1152011519
mammoth: ^1.5.1
1152111520
object-hash: ^3.0.0
1152211521
openai: ^3.2.0

0 commit comments

Comments
 (0)