Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

chore: add a npm run check to make it easier to run all the web lint/fmt/etc locally

Gabe Kangas0794d770f829
diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml
index 50a8e940aa..c5c6a52a3e 100644
--- a/.github/workflows/go-lint.yml
+++ b/.github/workflows/go-lint.yml
@@ -50,6 +50,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
- version: v2.5.0
+ version: v2.8.0
only-new-issues: true
args: --timeout=3m
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0df12f8d28..42c1cfc121 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,3 +7,18 @@ We abide by our [Code of Conduct](https://owncast.online/contribute/) and feel s
We’ve been very lucky to have this so far, so maybe you can help us with your skills and passion, too!
There is a larger, more detailed, and more up-to-date [guide for helping contribute to Owncast on our website](https://owncast.online/help/).
+
+## Before Submitting a PR
+
+For web changes, from the `web/` directory:
+
+```bash
+npm run check # Verify your code will pass CI
+npm run lint && npm run format # Auto-fix errors
+```
+
+For Go changes, from the repository root:
+
+```bash
+make lint && make fmt
+```
diff --git a/web/package.json b/web/package.json
index 34c208ec63..e6a15abf9d 100644
--- a/web/package.json
+++ b/web/package.json
@@ -9,13 +9,20 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
- "lint": "eslint --fix --ext .js,.ts,.tsx types/ pages/ components/ stories/ && npm run stylelint",
- "stylelint": "stylelint **/*.scss",
+ "check": "npm run check:lint && npm run check:format && npm run check:unused && npm test && npm run build",
+ "check:lint": "jsfiles=$(git diff --name-only origin/develop... | grep '^web/.*\\.[jt]sx\\?$' | sed 's|^web/||'); cssfiles=$(git diff --name-only origin/develop... | grep '^web/.*\\.s\\?css$' | sed 's|^web/||'); ([ -z \"$jsfiles\" ] || echo \"$jsfiles\" | xargs eslint) && ([ -z \"$cssfiles\" ] || echo \"$cssfiles\" | xargs stylelint)",
+ "check:format": "files=$(git diff --name-only origin/develop... | grep '^web/.*\\.\\(js\\|ts\\|jsx\\|tsx\\|css\\|scss\\)$' | sed 's|^web/||'); [ -z \"$files\" ] || echo \"$files\" | xargs prettier --check",
+ "check:unused": "knip --include dependencies,files,exports",
+ "lint": "eslint --fix --ext .js,.ts,.tsx types/ pages/ components/ && npm run stylelint",
+ "lint:changed": "files=$(git diff --name-only origin/develop... | grep '^web/.*\\.[jt]sx\\?$' | sed 's|^web/||'); [ -z \"$files\" ] || echo \"$files\" | xargs eslint --fix",
+ "stylelint": "stylelint --fix **/*.scss",
+ "stylelint:changed": "files=$(git diff --name-only origin/develop... | grep '^web/.*\\.s\\?css$' | sed 's|^web/||'); [ -z \"$files\" ] || echo \"$files\" | xargs stylelint --fix",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"build-styles": "cd ./style-definitions && style-dictionary build && ./build.sh && cd -",
"test": "jest",
- "format": "prettier --write **/*.{js,ts,jsx,tsx,css,md,scss}",
+ "format": "prettier --write **/*.{js,ts,jsx,tsx,css,md,scss}",
+ "format:changed": "files=$(git diff --name-only origin/develop... | grep '^web/' | sed 's|^web/||'); [ -z \"$files\" ] || echo \"$files\" | xargs prettier --write",
"translate": "node scripts/i18n-extract.js"
},
"dependencies": {