Skip to content

Commit

Permalink
feat: Add typechecking to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 3, 2023
1 parent fe4a428 commit cc363c2
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm typecheck
9 changes: 8 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
module.exports = {extends: ['@commitlint/config-conventional']}
/** @type {import('@commitlint/types').UserConfig} */
const config = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [0],
},
}
module.exports = config
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"**/*.{js,ts,tsx}": "eslint --ext .js,.ts,.tsx --cache --fix"
},
"devDependencies": {
"@commitlint/types": "^18.4.3",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @type {import('prettier').Config}
*/
module.exports = {
/** @satisfies {import('prettier').Config & Record<string, unknown>} */
const config = {
arrowParens: 'always',
bracketSameLine: true,
bracketSpacing: false,
Expand All @@ -26,3 +24,5 @@ module.exports = {
trailingComma: 'all',
useTabs: false,
}
module.exports = config

2 changes: 1 addition & 1 deletion sdks/sdk-openai/yaml2json.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
const {parseArgs} = require('node:util')

async function readStreamToString(stream /* @type {NodeJS.ReadableStream} */) {
async function readStreamToString(/** @type {NodeJS.ReadableStream} */ stream) {
const chunks = []
for await (const chunk of stream) {
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "./tsconfig.base.json",
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["examples"]
"compilerOptions": {
"checkJs": true
},
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
"exclude": ["examples", "**/dist"]
}

1 comment on commit cc363c2

@vercel
Copy link

@vercel vercel bot commented on cc363c2 Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

opensdks – ./

opensdks-git-main-venice.vercel.app
opensdks.vercel.app
opensdks-venice.vercel.app
opensdks.org

Please sign in to comment.