Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lint workflow #2839

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
node-version: 20
cache: 'npm'
- run: npm run install-ci
- run: npm run lint
kzar marked this conversation as resolved.
Show resolved Hide resolved
- run: npm run lint && echo 'No lint issues!' || (npm run lint-fix; git diff; echo 'Lint check failed, review diff above or run "npm run lint-fix"'; return 1)

build:
strategy:
Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ The extension imports several DDG-owned modules (see [package.json](https://gith

### Linting
- All linting: `npm run lint`
- This includes both the ESLint and TypeScript checks.
- This includes the ESLint and TypeScript checks as well as Prettier style checks.
- To automatically fix all lint issues: `npm run lint-fix`
- ESLint linting: `npm run eslint`
- To automatically fix mistakes found (where possible) use: `npm run eslint-fix`
- TypeScript Linting: `npm run tsc`
- Prettier linting: `npm run prettier`
- To automatically fix style issues use: `npm run prettier-fix`
- Since Prettier rules are stylistic-only, it is okay to add `// prettier-ignore` comments to ignore specific lines or blocks of code.

### Testing
- Unit tests: `npm test` (full docs [here](./unit-test/README.md))
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"dev": "echo 'Try npm run dev-firefox or npm run dev-chrome instead' && exit 0",
"eslint": "eslint '*.js' shared/js shared/data unit-test integration-test scripts",
"eslint-fix": "npm run eslint -- --fix",
"lint": "npm run eslint && prettier . --check && npm run tsc",
"prettier": "prettier . --check",
"prettier-fix": "prettier . --write",
"lint": "npm run eslint && npm run prettier && npm run tsc",
"lint-fix": "npm run eslint-fix && npm run prettier-fix",
"test": "npm run test.unit && npm run test.node",
"test.unit": "make unit-test",
"test.node": "make node-test",
Expand Down
Loading