Skip to content

Commit

Permalink
Added husky and lint (#9)
Browse files Browse the repository at this point in the history
* Added husky with pre-commit cmd
* Added lint packages and configs
* Lint changes

---------

Signed-off-by: Saurabh Kamat <kamatsaurabh01@gmail.com>
  • Loading branch information
sauk2 authored Jun 6, 2024
1 parent 2aa0b25 commit d26e0c5
Show file tree
Hide file tree
Showing 15 changed files with 2,613 additions and 264 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {},
"ignorePatterns": ["dist", "coverage", "*.md", "*.yml", "*.yaml"]
}
17 changes: 17 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "PR checks"
on:
pull_request:
defaults:
run:
shell: bash
jobs:
test_lint_and_build:
name: "Lint sources and check build artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4.0.2
with:
node-version: "20.x"
- run: npm install && npm run lint
- run: npm run build && git diff --exit-code
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
schedule:
# Run the CI automatically twice per day to look for flakyness.
- cron: "0 */12 * * *"
defaults:
run:
shell: bash
jobs:
test_gazebo_install_ubuntu:
name: 'Check installation of Gazebo on Ubuntu'
Expand Down
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
9 changes: 9 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
"*": [
"eslint --cache --fix --config .eslintrc.json",
"prettier --write --config .prettierrc --ignore-path .prettierignore --ignore-unknown",
// Note: doing the build here ensures we omit unstaged changes
() => "npm run build",
() => "git add dist/index.js",
],
};
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
coverage
*.md
*.yml
*.yaml
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": false,
"semi": true,
"tabWidth": 2,
"useTabs": true
}
9 changes: 8 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26285,7 +26285,14 @@ function configOs() {
yield utils.exec("sudo", ["bash", "-c", "echo 'Etc/UTC' > /etc/timezone"]);
yield utils.exec("sudo", ["apt-get", "update"]);
// Install tools required to configure the worker system.
yield apt.runAptGetInstall(["wget", "curl", "gnupg2", "locales", "lsb-release", "ca-certificates"]);
yield apt.runAptGetInstall([
"wget",
"curl",
"gnupg2",
"locales",
"lsb-release",
"ca-certificates",
]);
// Select a locale supporting Unicode.
yield utils.exec("sudo", ["locale-gen", "en_US", "en_US.UTF-8"]);
core.exportVariable("LANG", "en_US.UTF-8");
Expand Down
Loading

0 comments on commit d26e0c5

Please sign in to comment.