js-linterlisted
Install: claude install-skill hashgesh/skill-hive
# JS/TS Linter Skill
Check JavaScript and TypeScript code for lint errors, formatting and type errors.
## When Invoked
1. **Detect the package manager** from the lockfile: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `bun.lock`/`bun.lockb` → bun, otherwise npm. Run tools through it (`npx`, `pnpm exec`, `yarn`, `bunx`) so the project's local versions are used.
2. **Prefer the project's own scripts**: if `package.json` has `lint`, `format:check`, `typecheck` or similar scripts, offer to run them (`npm run lint`) and stop here if the user agrees.
3. **Ask files/directory**: default to the files changed on the current branch, else the whole project:
`git diff --name-only --diff-filter=d origin/main...HEAD -- '*.js' '*.jsx' '*.mjs' '*.cjs' '*.ts' '*.tsx'`
4. **Check configs**:
- ESLint 9 needs a flat config (`eslint.config.js`/`.mjs`/`.cjs`/`.ts`) and fails without one. Legacy `.eslintrc*` only works with ESLint 8 or below. If there is no config, ask before adding the minimal one below.
- Prettier uses `.prettierrc*` or the `prettier` key in `package.json`, and its defaults otherwise.
- Type-check only if there is a `tsconfig.json`.
5. **Run checks**:
- Lint: `npx eslint {files}`
- Format: `npx prettier --check {files}`
- Types: `npx tsc --noEmit -p tsconfig.json` (checks the whole project; filter the output to the selected files)
6. **Show results** grouped by: Lint, Formatting, Types - each with `file:line` and rule name.
7. **Auto-fix if requested** (sho