Skip to content

Commit

Permalink
chore: add lint-staged with clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
edusperoni committed Jun 25, 2024
1 parent fa029f5 commit ec358bf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# clang format doesn't work properly with * and **
NativeScript/include/*
NativeScript/include/*/*
NativeScript/include/*/*/*
NativeScript/include/*/*/*/*
NativeScript/include/*/*/*/*/*
NativeScript/ada/*
NativeScript/inspector/third_party/*
NativeScript/inspector/third_party/*/*
NativeScript/inspector/third_party/*/*/*
NativeScript/inspector/third_party/*/*/*/*
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged || echo "Linting failed, verify your clang-format installation"
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ To start diving into the v8 iOS runtime make sure you have Xcode and [Homebrew](
# Install CMake
brew install cmake

# (Optional) Install clang-format to format the code
brew install clang-format

# To avoid errors, you might need to link cmake to: /usr/local/bin/cmake
# xcode doesn't read your profile during the build step, which causes it to ignore the PATH
sudo ln -s /usr/local/bin/cmake $(which cmake)
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@
"setup-ci": "./build_metadata_generator.sh",
"update-version": "./update_version.sh",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"version": "npm run changelog && git add CHANGELOG.md"
"version": "npm run changelog && git add CHANGELOG.md",
"prepare": "husky"
},
"license": "Apache-2.0",
"devDependencies": {
"conventional-changelog-cli": "^2.1.1",
"dayjs": "^1.11.7",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"semver": "^7.5.0"
},
"lint-staged": {
"{NativeScript,metadata-generator/src}/**/*.{h,hpp,c,cpp,mm}": [
"clang-format -i"
]
}
}
}

0 comments on commit ec358bf

Please sign in to comment.