Skip to content

Commit

Permalink
Setup pre-commit hooks (#33)
Browse files Browse the repository at this point in the history
* Add pre-commit and a few basic hooks

* Add additional pre-commit hooks

* Add tsc pre-commit hook

* Miscellaneous fixes:

- Update .prettierrc
- Add pre-commit scripts to run
- Remove unused dependency husky

* Reorganize pre-commit hooks into subrepos

* Use tabs with width of 4 to format package.json

* Remove unecessary package.json elements, add author

* Update README.md with pre-commit hooks section

* Add test hook for control-station

* Add test hook for control-station
  • Loading branch information
samderanova authored Apr 29, 2024
1 parent bb1b221 commit accdc7a
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@

The control system consists of the pod operation backend and control station client.
See the respective README files for setup instructions.

## Pre-Commit Hooks

This repository has pre-commit hooks enabled using
[pre-commit](https://www.npmjs.com/package/pre-commit) that automatically run linters,
formatters, and tests before commits to ensure functionality.
1 change: 1 addition & 0 deletions control-station/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"useTabs": true,
"printWidth": 88,
"semi": true,
"singleQuote": false
}
2 changes: 2 additions & 0 deletions control-station/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write .",
"test": "tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion control-station/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import "./index.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);
2 changes: 1 addition & 1 deletion control-station/src/services/PodSocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PodSocketClient {
(Object.entries(this.serverEvents) as Entries<ServerToClientEvents>).forEach(
([event, handler]) => {
this.socket.on(event, handler);
}
},
);
}

Expand Down
207 changes: 207 additions & 0 deletions package-lock.json

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

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "hx9-control-system",
"version": "1.0.0",
"description": "The control system consists of the pod operation backend and control station client. See the respective README files for setup instructions.",
"devDependencies": {
"pre-commit": "^1.2.2"
},
"scripts": {
"format:cs": "cd control-station && npm run format",
"format:po": "cd pod-operation && npm run format",
"lint:cs": "cd control-station && npm run lint",
"lint:po": "cd pod-operation && npm run lint",
"test:cs": "cd control-station && npm run test",
"test:po": "cd pod-operation && npm run test"
},
"pre-commit": [
"format:cs",
"format:po",
"lint:cs",
"lint:po",
"test:cs",
"test:po"
],
"author": "UCI HyperXite"
}
11 changes: 11 additions & 0 deletions pod-operation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "pod-operation",
"version": "1.0.0",
"description": "This Rust package is for the main program to be run on the pod. The program runs a finite-state machine to operate the pod components and acts as a Socket.IO server to communicate with the control station.",
"scripts": {
"lint": "cargo clippy",
"format": "cargo fmt",
"test": "cargo test"
},
"author": "UCI HyperXite"
}

0 comments on commit accdc7a

Please sign in to comment.