Skip to content

Commit

Permalink
Use prettier instead of clang-format
Browse files Browse the repository at this point in the history
We're formatting TypeScript, not C/C++.
  • Loading branch information
tamird committed Aug 6, 2024
1 parent 37ee1af commit 8dc0598
Show file tree
Hide file tree
Showing 10 changed files with 419 additions and 328 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
name: CI
on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
- name: clang-format (diff)
if: github.event_name == 'pull_request'
env:
BASE: ${{ github['base_ref'] }}
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/$BASE:refs/remotes/origin/$BASE
npm run git-clang-format -- --diff origin/$BASE |\
awk -v s="^diff" '$0~s{r=1} 1; END{exit(r)}'
- name: clang-format (project)
if: github.event_name == 'push'
run: |
npm run git-clang-format -- --diff --commit $(git hash-object -t tree /dev/null) |\
awk -v s="^diff" '$0~s{r=1} 1; END{exit(r)}'
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
- run: npx prettier . --check
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
out/

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"bracketSpacing": false,
"singleQuote": true
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# node-clangd

Shared features of vscode-clangd and coc-clangd
67 changes: 25 additions & 42 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"scripts": {
"compile": "tsc -watch -p ./",
"test": "tsc -p ./ && tape -r source-map-support/register 'out/test/**/*.js' | tap-spec",
"format": "clang-format -i --glob=\"{src,test}/*.ts\"",
"git-clang-format": "git-clang-format",
"format": "prettier . --write",
"prepare": "tsc -p ./"
},
"repository": {
Expand Down Expand Up @@ -45,8 +44,8 @@
"@types/tape": "^4.13.0",
"@types/tmp": "^0.2.0",
"@types/which": "^1.3.2",
"clang-format": "^1.4.0",
"node-static": "^0.7.11",
"prettier": "^3.3.3",
"source-map-support": "^0.5.19",
"tap-spec": "^5.0.0",
"tape": "^5.0.0",
Expand Down
Loading

0 comments on commit 8dc0598

Please sign in to comment.