add simple linting script

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-10 09:52:58 -03:00
parent e3c77f433a
commit 251a7191d3
2 changed files with 29 additions and 0 deletions

8
.gitignore vendored
View file

@ -1 +1,9 @@
.vscode/*
# NPM things
package.json
package-lock.json
node_modules/
# Yarn things
yarn.lock

21
lint.sh Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/bash
if ! which npx 2>&1 > /dev/null; then
echo "[lint] npm/npx is not installed"
exit 1
fi
npx prettier > /dev/null || npm install prettier && echo "[lint] We have 'prettier'"
npx eslint > /dev/null || npm install eslint && echo "[lint] We have 'eslint'"
npx prettier-eslint > /dev/null || npm install prettier-eslint-cli && echo "[lint] We have 'prettier-eslint'"
echo "[lint] Linting JavaScript files..."
npx prettier-eslint --write "**/*.js"
echo "[lint] Linting HTML files..."
npx prettier-eslint --write "**/*.html"
echo "[lint] Linting CSS files..."
npx prettier-eslint --write "**/*.css"
echo "[lint] Linting MarkDown files"
npx prettier-eslint --write "**/*.md"
echo "[lint] Finished Linting."