chore(style): update fmt rules & guidelines

This commit is contained in:
AJ ONeal
2022-08-13 04:34:55 +00:00
parent c4de76b5af
commit de0a09290e
2 changed files with 31 additions and 4 deletions

View File

@@ -10,6 +10,7 @@
- You'll be asked to make changes if you don't run the code formatters and
linters:
- Node / JavaScript:
- [prettier](https://webinstall.dev/prettier)
```sh
@@ -20,11 +21,36 @@
npm run lint
```
- Bash
- [shfmt](https://webinstall.dev/shfmt)
```sh
npm run shfmt
```
- [shellcheck](https://webinstall.dev/shellcheck)
Or
```bash
shfmt -w -i 4 -sr -ci -s ./
```
- [shellcheck](https://webinstall.dev/shellcheck) \
To check for all warnings and errors (except the ones we ignore):
```bash
# to check all errors
shellcheck -s sh --exclude=SC2154,SC2034 */*.sh */*/*.sh
```
To check for only specific warnings and errors:
```bash
# to check specific errors
shellcheck -s sh --include=SC2005 */*.sh */*/*.sh
```
Enumerated shellcheck codes:
<https://gist.github.com/nicerobot/53cee11ee0abbdc997661e65b348f375>
- Common exceptions:
```txt
# We make use of `.` (source) to import without exports
SC2034: foo appears unused. Verify it or export it.
SC2154: var is referenced but not assigned.
```
- If you use vim, [vim-essentials](https://webinstall.dev/vim-essentials)
includes everything you need to automatically format and lint on save.
- If you use VS Code, the same plugins are also available in the VS Code store.

View File

@@ -1,13 +1,14 @@
{
"name": "@webinstall/webi-installers",
"private": true,
"version": "0.2.0",
"version": "1.0.0",
"description": "webinstall script repository",
"main": "_webi/",
"scripts": {
"prettier": "npx prettier@2.x -w '**/*.{js,md,html}'",
"fmt": "npm run prettier; npm run shfmt",
"lint": "npx jshint@2.x -c ./.jshintrc */*.js",
"shfmt": "shfmt -w -i 4 -sr -s ./",
"prettier": "npx prettier@2.x -w '**/*.{js,md,html}'",
"shfmt": "shfmt -w -i 4 -sr -ci -s ./",
"test": "node _webi/test.js ./node/"
},
"repository": {