Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra[patch]: Improve yarn format #5578

Merged
merged 4 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/core_docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^10.3.10",
"prettier": "^2.7.1",
"prettier": "^2.8.3",
"rimraf": "^5.0.1",
"supabase": "^1.148.6",
"swc-loader": "^0.2.3",
Expand Down
1 change: 1 addition & 0 deletions libs/create-langchain-integration/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
"no-process-env": 2,
"no-instanceof/no-instanceof": 2,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-shadow": 0,
"@typescript-eslint/no-empty-interface": 0,
Expand Down
19 changes: 19 additions & 0 deletions libs/create-langchain-integration/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always",
"requirePragma": false,
"insertPragma": false,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"endOfLine": "lf"
}
16 changes: 12 additions & 4 deletions libs/create-langchain-integration/helpers/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@ function isInGitRepository(): boolean {
try {
execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
return true;
} catch (_) {}
} catch (_) {
// no-op
}
return false;
}

function isInMercurialRepository(): boolean {
try {
execSync("hg --cwd . root", { stdio: "ignore" });
return true;
} catch (_) {}
} catch (_) {
// no-op
}
return false;
}

function isDefaultBranchSet(): boolean {
try {
execSync("git config init.defaultBranch", { stdio: "ignore" });
return true;
} catch (_) {}
} catch (_) {
// no-op
}
return false;
}

Expand Down Expand Up @@ -54,7 +60,9 @@ export function tryGitInit(root: string): boolean {
if (didInit) {
try {
fs.rmSync(path.join(root, ".git"), { recursive: true, force: true });
} catch (_) {}
} catch (_) {
// no-op
}
}
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions libs/create-langchain-integration/helpers/is-url.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function isUrl(url: string): boolean {
try {
new URL(url);
return true;
const newUrl = new URL(url);
return Boolean(newUrl);
} catch (error) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/create-langchain-integration/helpers/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import fs from "fs/promises";
import os from "os";

import { copy } from "./copy";
import { copy } from "./copy.js";

/**
* Install a internal template to a given `root` directory.
*/
export async function installTemplate({ appName, root }: any) {

Check warning on line 10 in libs/create-langchain-integration/helpers/templates.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
/**
* Copy the template files to the target directory.
*/
Expand All @@ -25,7 +25,7 @@
* Update the package.json scripts.
*/
const packageJsonFile = path.join(root, "package.json");
const packageJson: any = JSON.parse(

Check warning on line 28 in libs/create-langchain-integration/helpers/templates.ts

View workflow job for this annotation

GitHub Actions / Check linting

Unexpected any. Specify a different type
await fs.readFile(packageJsonFile, "utf8")
);
packageJson.name = appName;
Expand Down
14 changes: 12 additions & 2 deletions libs/create-langchain-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
"scripts": {
"dev": "ncc build ./index.ts -w -o dist/",
"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",
"format": "prettier --write \"./\"",
"format:check": "prettier --check \"./\""
"format": "prettier --config .prettierrc --write \"./helpers\"",
"format:check": "prettier --config .prettierrc --check \"./helpers\"",
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js ./helpers",
"lint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js ./helpers",
"lint:fix": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --fix --ext .ts,.js ./helpers"
},
"devDependencies": {
"@types/prompts": "^2",
Expand All @@ -20,6 +23,13 @@
"commander": "^2.20.0",
"conf": "^10.2.0",
"dotenv": "^16.3.1",
"eslint": "^8.33.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-no-instanceof": "^1.0.1",
"eslint-plugin-prettier": "^4.2.1",
"fast-glob": "^3.3.2",
"picocolors": "^1.0.0",
"prettier": "^2.8.3",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"build": "turbo build --filter=\"!test-exports-*\"",
"turbo:command": "turbo",
"clean": "turbo clean",
"format": "turbo format",
"format:check": "turbo format:check",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix",
"format": "turbo format --concurrency=50",
"format:check": "turbo format:check --concurrency=50",
"lint": "turbo lint --concurrency=50",
"lint:fix": "turbo lint:fix --concurrency=50",
"test": "yarn test:unit && yarn test:exports:docker",
"test:unit": "turbo test --filter=\"!test-exports-*\" --filter=!examples --filter=!api_refs --filter=!core_docs --filter=!create-langchain-integration",
"test:unit:ci": "turbo test:ci",
Expand Down
11 changes: 9 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19330,7 +19330,7 @@ __metadata:
isomorphic-dompurify: ^2.9.0
json-loader: ^0.5.7
marked: ^12.0.2
prettier: ^2.7.1
prettier: ^2.8.3
process: ^0.11.10
react: ^17.0.2
react-dom: ^17.0.2
Expand Down Expand Up @@ -19468,6 +19468,13 @@ __metadata:
commander: ^2.20.0
conf: ^10.2.0
dotenv: ^16.3.1
eslint: ^8.33.0
eslint-config-airbnb-base: ^15.0.0
eslint-config-prettier: ^8.6.0
eslint-plugin-import: ^2.27.5
eslint-plugin-jest: ^27.6.0
eslint-plugin-no-instanceof: ^1.0.1
eslint-plugin-prettier: ^4.2.1
fast-glob: ^3.3.2
picocolors: ^1.0.0
prettier: ^2.8.3
Expand Down Expand Up @@ -31849,7 +31856,7 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:^2.6.2, prettier@npm:^2.7.1":
"prettier@npm:^2.6.2":
version: 2.8.8
resolution: "prettier@npm:2.8.8"
bin:
Expand Down
Loading