@kirill.konshin/lint 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +203 -0
- package/index.js +657 -0
- package/lintPrepare.js +326 -0
- package/package.json +94 -0
- package/ruleTestColocation.js +50 -0
- package/rules/code-style.md +6 -0
- package/rules/electron.md +25 -0
- package/rules/expo.md +4 -0
- package/rules/github.md +71 -0
- package/rules/gitlab.md +37 -0
- package/rules/i18n.md +6 -0
- package/rules/jest.md +9 -0
- package/rules/monorepo-turbo-nx.md +56 -0
- package/rules/mui.md +10 -0
- package/rules/nextjs.md +69 -0
- package/rules/npm-yarn.md +61 -0
- package/rules/nx.md +31 -0
- package/rules/react.md +87 -0
- package/rules/redux.md +4 -0
- package/rules/storybook.md +38 -0
- package/rules/tailwind.md +17 -0
- package/rules/testing.md +25 -0
- package/rules/turbo.md +58 -0
- package/rules/typescript.md +95 -0
- package/rules/vite.md +21 -0
- package/rules/webstorm.md +133 -0
- package/skills/lint-repo.md +58 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-repo
|
|
3
|
+
description: Set up/update this repo's ESLint + Prettier + lint-staged + Husky tooling (@kirill.konshin/lint), and/or audit the codebase against the packaged agent rules. Rules are discovered from .claude/rules/*.md (created by `lint-prepare init`), falling back to node_modules/@kirill.konshin/lint/rules/*.md; project overrides in AGENTS.md Custom Rules / CLAUDE.md win on conflict. Use when asked to set up, configure, or upgrade lint/format/pre-commit tooling, OR to check, audit, verify, or lint the codebase against agent rules/conventions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lint Repo
|
|
7
|
+
|
|
8
|
+
Two jobs. Pick by the request; do only what was asked.
|
|
9
|
+
|
|
10
|
+
- **Set up / upgrade lint tooling** → [§A](#a-set-up--update-tooling)
|
|
11
|
+
- **Audit code against the rules** → [§B](#b-audit-code-against-rules)
|
|
12
|
+
|
|
13
|
+
Full config templates: @README.md
|
|
14
|
+
|
|
15
|
+
## A. Set up / update tooling
|
|
16
|
+
|
|
17
|
+
Follow the README, reconciling (never blindly overwriting project-specific overrides):
|
|
18
|
+
|
|
19
|
+
1. **Install** — add `eslint`, `prettier`, `@kirill.konshin/lint`, `husky`, `lint-staged` (+ the PNPM `.npmrc` block if pnpm).
|
|
20
|
+
2. **Config** — create/reconcile `.editorconfig`, `eslint.config.mjs` and `.prettierrc.mjs` (set `next.rootDir`, keep project rule overrides).
|
|
21
|
+
3. **Lint-staged** — create/reconcile `.lintstagedrc.mjs`.
|
|
22
|
+
4. **Husky** — `prepare/postinstall` (`prepare` by default, `postinstall` if Yarn 2+ is used AND root package.json is **private**) script; `.husky/pre-commit`, plus `eslint`/`prettier`/`lint`/`lint:staged` scripts. Drop a legacy `lint:all` if it duplicates `lint`.
|
|
23
|
+
5. **IDEA** — apply the file-scope glob patterns if the repo has a JetBrains `.idea`.
|
|
24
|
+
6. **Install** — run the package manager (`yarn` / `npm install` / `pnpm install`) so the new deps and Husky hooks land. Under Yarn 2+ check if root `package.json` has `prepare` script, and if it does, run it.
|
|
25
|
+
|
|
26
|
+
Check the README's "Issues" section before debugging a lint crash.
|
|
27
|
+
|
|
28
|
+
## B. Audit code against rules
|
|
29
|
+
|
|
30
|
+
Rules: `.claude/rules/*.md` → else `node_modules/@kirill.konshin/lint/rules/*.md`; plus overrides in `AGENTS.md # Custom Rules` / `CLAUDE.md` (override wins on conflict). Treat rule files as normative — read them directly.
|
|
31
|
+
|
|
32
|
+
### 1. Mechanical pass first
|
|
33
|
+
|
|
34
|
+
Run `eslint .` and `prettier --check .` **without `--fix`**. Report compactly (counts + notable files). Ask: fix all / pick / skip. Apply the confirmed fixes (`eslint --fix`, `prettier --write`). This cleans deterministic issues so the rule audit runs on a patched tree.
|
|
35
|
+
|
|
36
|
+
### 2. Rule audit
|
|
37
|
+
|
|
38
|
+
Scan the (now-patched) code for rule violations. **One line each, most critical first:**
|
|
39
|
+
|
|
40
|
+
`⟨CRIT|HIGH|MED|LOW⟩ path:line — <rule file> — <what's wrong>`
|
|
41
|
+
|
|
42
|
+
No multi-paragraph write-ups. Nothing found → say so and stop.
|
|
43
|
+
|
|
44
|
+
### 3. Ask once
|
|
45
|
+
|
|
46
|
+
Go one-by-one / reply with instructions / skip all / fix all. Do nothing until answered.
|
|
47
|
+
|
|
48
|
+
### 4. One-by-one
|
|
49
|
+
|
|
50
|
+
Per issue: **skip** / **skip + add override** / **fix** / **instructions**. For an override, offer only the applicable mechanism(s) and **name which one you'll write, showing the exact line/snippet first**:
|
|
51
|
+
|
|
52
|
+
- **ESLint override** (mechanical findings) — `// eslint-disable-next-line <rule>` at the site, or a rule entry in the project's `eslint.config.*` override block.
|
|
53
|
+
- **AI override → AGENTS.md** (rule-audit findings) — a general rule appended to `AGENTS.md # Custom Rules` (run `lint-prepare init` to create the file if missing). Prefer a general statement over a per-file exception unless it's genuinely a one-off.
|
|
54
|
+
- **both** — when the violation is covered by an ESLint rule _and_ an agent rule.
|
|
55
|
+
|
|
56
|
+
### 5. Report
|
|
57
|
+
|
|
58
|
+
Show the diff of everything changed.
|