Skip to content

Commit ab07b4a

Browse files
authored
infra[patch]: Improve yarn format (#5578)
* infra[patch]: Improve yarn format * chore: lint files * cr
1 parent b444fec commit ab07b4a

File tree

9 files changed

+61
-16
lines changed

9 files changed

+61
-16
lines changed

docs/core_docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"eslint-plugin-react": "^7.30.1",
6565
"eslint-plugin-react-hooks": "^4.6.0",
6666
"glob": "^10.3.10",
67-
"prettier": "^2.7.1",
67+
"prettier": "^2.8.3",
6868
"rimraf": "^5.0.1",
6969
"supabase": "^1.148.6",
7070
"swc-loader": "^0.2.3",

libs/create-langchain-integration/.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = {
2929
"no-process-env": 2,
3030
"no-instanceof/no-instanceof": 2,
3131
"@typescript-eslint/explicit-module-boundary-types": 0,
32+
"@typescript-eslint/no-explicit-any": "warn",
3233
"@typescript-eslint/no-empty-function": 0,
3334
"@typescript-eslint/no-shadow": 0,
3435
"@typescript-eslint/no-empty-interface": 0,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"printWidth": 80,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"semi": true,
7+
"singleQuote": false,
8+
"quoteProps": "as-needed",
9+
"jsxSingleQuote": false,
10+
"trailingComma": "es5",
11+
"bracketSpacing": true,
12+
"arrowParens": "always",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "preserve",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": false,
18+
"endOfLine": "lf"
19+
}

libs/create-langchain-integration/helpers/git.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@ function isInGitRepository(): boolean {
77
try {
88
execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
99
return true;
10-
} catch (_) {}
10+
} catch (_) {
11+
// no-op
12+
}
1113
return false;
1214
}
1315

1416
function isInMercurialRepository(): boolean {
1517
try {
1618
execSync("hg --cwd . root", { stdio: "ignore" });
1719
return true;
18-
} catch (_) {}
20+
} catch (_) {
21+
// no-op
22+
}
1923
return false;
2024
}
2125

2226
function isDefaultBranchSet(): boolean {
2327
try {
2428
execSync("git config init.defaultBranch", { stdio: "ignore" });
2529
return true;
26-
} catch (_) {}
30+
} catch (_) {
31+
// no-op
32+
}
2733
return false;
2834
}
2935

@@ -54,7 +60,9 @@ export function tryGitInit(root: string): boolean {
5460
if (didInit) {
5561
try {
5662
fs.rmSync(path.join(root, ".git"), { recursive: true, force: true });
57-
} catch (_) {}
63+
} catch (_) {
64+
// no-op
65+
}
5866
}
5967
return false;
6068
}

libs/create-langchain-integration/helpers/is-url.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function isUrl(url: string): boolean {
22
try {
3-
new URL(url);
4-
return true;
3+
const newUrl = new URL(url);
4+
return Boolean(newUrl);
55
} catch (error) {
66
return false;
77
}

libs/create-langchain-integration/helpers/templates.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "path";
22
import fs from "fs/promises";
33
import os from "os";
44

5-
import { copy } from "./copy";
5+
import { copy } from "./copy.js";
66

77
/**
88
* Install a internal template to a given `root` directory.

libs/create-langchain-integration/package.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
"scripts": {
1111
"dev": "ncc build ./index.ts -w -o dist/",
1212
"build": "ncc build ./index.ts -o ./dist/ --minify --no-cache --no-source-map-register && cp ./template/.eslintrc.cjs ./template/.prettierrc ./template/.release-it.json ./dist/template",
13-
"format": "prettier --write \"./\"",
14-
"format:check": "prettier --check \"./\""
13+
"format": "prettier --config .prettierrc --write \"./helpers\"",
14+
"format:check": "prettier --config .prettierrc --check \"./helpers\"",
15+
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js ./helpers",
16+
"lint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js ./helpers",
17+
"lint:fix": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --fix --ext .ts,.js ./helpers"
1518
},
1619
"devDependencies": {
1720
"@types/prompts": "^2",
@@ -20,6 +23,13 @@
2023
"commander": "^2.20.0",
2124
"conf": "^10.2.0",
2225
"dotenv": "^16.3.1",
26+
"eslint": "^8.33.0",
27+
"eslint-config-airbnb-base": "^15.0.0",
28+
"eslint-config-prettier": "^8.6.0",
29+
"eslint-plugin-import": "^2.27.5",
30+
"eslint-plugin-jest": "^27.6.0",
31+
"eslint-plugin-no-instanceof": "^1.0.1",
32+
"eslint-plugin-prettier": "^4.2.1",
2333
"fast-glob": "^3.3.2",
2434
"picocolors": "^1.0.0",
2535
"prettier": "^2.8.3",

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"build": "turbo build --filter=\"!test-exports-*\"",
2222
"turbo:command": "turbo",
2323
"clean": "turbo clean",
24-
"format": "turbo format",
25-
"format:check": "turbo format:check",
26-
"lint": "turbo lint",
27-
"lint:fix": "turbo lint:fix",
24+
"format": "turbo format --concurrency=50",
25+
"format:check": "turbo format:check --concurrency=50",
26+
"lint": "turbo lint --concurrency=50",
27+
"lint:fix": "turbo lint:fix --concurrency=50",
2828
"test": "yarn test:unit && yarn test:exports:docker",
2929
"test:unit": "turbo test --filter=\"!test-exports-*\" --filter=!examples --filter=!api_refs --filter=!core_docs --filter=!create-langchain-integration",
3030
"test:unit:ci": "turbo test:ci",

yarn.lock

+9-2
Original file line numberDiff line numberDiff line change
@@ -19330,7 +19330,7 @@ __metadata:
1933019330
isomorphic-dompurify: ^2.9.0
1933119331
json-loader: ^0.5.7
1933219332
marked: ^12.0.2
19333-
prettier: ^2.7.1
19333+
prettier: ^2.8.3
1933419334
process: ^0.11.10
1933519335
react: ^17.0.2
1933619336
react-dom: ^17.0.2
@@ -19468,6 +19468,13 @@ __metadata:
1946819468
commander: ^2.20.0
1946919469
conf: ^10.2.0
1947019470
dotenv: ^16.3.1
19471+
eslint: ^8.33.0
19472+
eslint-config-airbnb-base: ^15.0.0
19473+
eslint-config-prettier: ^8.6.0
19474+
eslint-plugin-import: ^2.27.5
19475+
eslint-plugin-jest: ^27.6.0
19476+
eslint-plugin-no-instanceof: ^1.0.1
19477+
eslint-plugin-prettier: ^4.2.1
1947119478
fast-glob: ^3.3.2
1947219479
picocolors: ^1.0.0
1947319480
prettier: ^2.8.3
@@ -31849,7 +31856,7 @@ __metadata:
3184931856
languageName: node
3185031857
linkType: hard
3185131858

31852-
"prettier@npm:^2.6.2, prettier@npm:^2.7.1":
31859+
"prettier@npm:^2.6.2":
3185331860
version: 2.8.8
3185431861
resolution: "prettier@npm:2.8.8"
3185531862
bin:

0 commit comments

Comments
 (0)