Skip to content

Commit 7610f44

Browse files
authored
chore: integrate lefthook & commitlint (#223)
* fix: typecheck errors * chore: integrate lefthook, commitlint & typecheck + lint-fix on commit
1 parent 4fb015e commit 7610f44

8 files changed

Lines changed: 48 additions & 4 deletions

File tree

bun.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
}

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
eslint:
5+
glob: '*.{js,ts,tsx,mjs}'
6+
exclude: 'website/**'
7+
run: bunx eslint --fix {staged_files}
8+
stage_fixed: true
9+
typecheck:
10+
run: bun run typecheck
11+
12+
commit-msg:
13+
commands:
14+
commitlint:
15+
run: bunx commitlint --edit {1}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"name": "@react-native-ai/monorepo",
33
"private": true,
44
"scripts": {
5+
"prepare": "lefthook install",
56
"typecheck": "bun run --filter='*' typecheck",
67
"lint": "eslint \"**/*.{js,ts,tsx}\"",
8+
"lint:fix": "eslint \"**/*.{js,ts,tsx}\" --fix",
79
"release": "release-it",
810
"build": "bun run --filter='@react-native-ai/*' prepare",
911
"postinstall": "bash packages/mlc/scripts/fetch-prebuilt.sh"
@@ -30,6 +32,7 @@
3032
"eslint-plugin-import": "^2.32.0",
3133
"eslint-plugin-prettier": "^5.5.1",
3234
"eslint-plugin-simple-import-sort": "^12.1.1",
35+
"lefthook": "^1.12.2",
3336
"prettier": "^3.7.4",
3437
"react-native-builder-bob": "^0.40.17",
3538
"release-it": "^19.1.0",

packages/adk/src/NativeAdkEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Platform, TurboModuleRegistry } from 'react-native'
33
import type {
44
EventEmitter,
55
UnsafeObject,
6-
} from 'react-native/Libraries/Types/CodegenTypes'
6+
} from 'react-native/Libraries/Types/CodegenTypesNamespace'
77

88
export type AdkMessageRole = 'assistant' | 'system' | 'user'
99

packages/apple-llm/src/NativeAppleLLM.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TurboModuleRegistry } from 'react-native'
33
import type {
44
EventEmitter,
55
UnsafeObject,
6-
} from 'react-native/Libraries/Types/CodegenTypes'
6+
} from 'react-native/Libraries/Types/CodegenTypesNamespace'
77

88
export interface AppleMessage {
99
role: 'assistant' | 'system' | 'tool' | 'user'

packages/apple-llm/src/NativeAppleSpeech.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { TurboModule } from 'react-native'
22
import { TurboModuleRegistry } from 'react-native'
3-
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes'
3+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypesNamespace'
44

55
import { addWAVHeader } from './utils'
66

packages/mlc/src/NativeMLCEngine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { TurboModule } from 'react-native'
22
import { TurboModuleRegistry } from 'react-native'
3-
import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypes'
3+
import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypesNamespace'
44

55
export interface ModelConfig {
66
model_id?: string

0 commit comments

Comments
 (0)