Skip to content

chore: add ESLint tooling with TypeScript support#161

Merged
Lum1104 merged 2 commits into
Lum1104:mainfrom
Arvuno:contrib/understand-anything/eslint-tooling
May 23, 2026
Merged

chore: add ESLint tooling with TypeScript support#161
Lum1104 merged 2 commits into
Lum1104:mainfrom
Arvuno:contrib/understand-anything/eslint-tooling

Conversation

@Arvuno
Copy link
Copy Markdown

@Arvuno Arvuno commented May 21, 2026

Summary

The repository has a pnpm lint script that runs eslint . but ESLint and typescript-eslint were not listed in devDependencies, causing the script to fail.

Added:

  • eslint (^9.0.0)
  • @eslint/js (^9.0.0)
  • typescript-eslint (^8.0.0)

Also added eslint.config.mjs with flat config format (ESLint 9+) using typescript-eslint strict rules. Ignores node_modules, dist, build, and framework-specific output directories.

Problem

Running pnpm lint fails with eslint: not found because ESLint is not installed as a dependency.

Solution

Add the required ESLint packages as devDependencies and create the flat-config file. Does not fix any linting errors — this PR only adds the tooling infrastructure.

Risk / Compatibility

  • No runtime code changes
  • No new runtime dependencies added
  • Only tooling (devDependency) additions

The repository has a pnpm lint script running 'eslint .' but ESLint
and typescript-eslint were not listed in devDependencies.

Added:
- eslint (^9.0.0)
- @eslint/js (^9.0.0)
- typescript-eslint (^8.0.0)

Added eslint.config.mjs with flat config (ESLint 9+) using
typescript-eslint strict rules. Ignores node_modules, dist, build,
and framework-specific output directories.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ESLint tooling (ESLint 9 flat config + TypeScript support) so the existing pnpm lint script can run successfully in this monorepo.

Changes:

  • Add ESLint-related devDependencies (eslint, @eslint/js, typescript-eslint) to support pnpm lint.
  • Introduce eslint.config.mjs using ESLint 9 flat config with TypeScript strict rules and ignore patterns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
package.json Adds ESLint + TypeScript-ESLint devDependencies to unblock pnpm lint.
eslint.config.mjs Introduces an ESLint 9 flat config with TS strict rules and intended ignores.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment on lines +15 to 19
"@eslint/js": "^9.0.0",
"eslint": "^9.0.0",
"typescript": "^5.7.0",
"typescript-eslint": "^8.0.0",
"vitest": "^3.1.0"
Comment thread eslint.config.mjs
@Lum1104
Copy link
Copy Markdown
Owner

Lum1104 commented May 21, 2026

Thanks for picking this up! A few notes before we land it:

On the Copilot comments

  1. Lockfile — agreed, this needs fixing. CI runs pnpm install on GitHub Actions where CI=true is set automatically, and pnpm defaults to --frozen-lockfile in that case. Please run pnpm install locally and commit the updated pnpm-lock.yaml.
  2. ignores position — I think Copilot is wrong on this one. In ESLint 9 flat config, a config object containing only an ignores key (no files, no rules, etc.) is treated as global ignores regardless of its position in the array. See the ESLint docs and the typescript-eslint examples — they put ignores last too. Your block has only ignores, so it works as intended. No change needed here.

A few things I'd like to sort out before merging

  1. Trailing newline — eslint.config.mjs is missing a newline at EOF (the diff shows \ No newline at end of file). Minor, but eol-last would catch it.
  2. projectService in a pnpm workspace — have you actually run pnpm lint end-to-end? With type-aware rules enabled and allowDefaultProject limited to .config., I'm worried files under packages/core and packages/dashboard will hit parserOptions.project errors because each package has its own tsconfig.json and root-level eslint . has to figure out which one each file belongs to. If you've already confirmed it works, great — otherwise we may need to either drop type-aware linting or wire up per-package tsconfig resolution.
  3. strict vs recommended — since this is the first time the repo is being linted, tseslint.configs.strict is almost certainly going to produce hundreds of errors. The PR description says "does not fix any linting errors," which I read as "lint will exit non-zero from day one." Two options I'd prefer:
  • Start with tseslint.configs.recommended so we get a useful baseline that's closer to green, then ratchet up to strict in a follow-up.
  • Or keep strict but include enough fixes (or rule overrides) in this PR that pnpm lint actually exits 0.
  1. CI wiring — .github/workflows/ci.yml doesn't currently run pnpm lint. If we want this to enforce anything, we should add the step. Happy to do that in a follow-up if you'd rather keep this PR scoped to tooling — just want to flag it so we don't end up with installed-but-unused tooling.

Let me know which direction you want to take on (5) and I'll review the next push.

- typescript-eslint preset: strict -> recommended for a usable first-pass
  baseline (per PR discussion); ratchet up in a follow-up.
- Drop the projectService/parserOptions block. Neither `recommended` nor
  `strict` is type-aware, so it was unused; removing it also avoids the
  pnpm-workspace tsconfig-resolution failure mode flagged in review.
- Add Node + browser globals via the `globals` package so .mjs scripts and
  the dashboard stop hitting `no-undef`.
- Expand ignores: built bundles (**/public/**), Astro generated (.astro/),
  and .private/ (eval scratch). Cuts 2400+ errors in vendored output.
- Allow `_`-prefixed unused vars/args/caught errors; skip irregular
  whitespace inside comments (json-parser intentionally embeds ZWSP-escaped
  block-comment examples in JSDoc).
- Fix the residual 13 genuine errors: drop dead imports/vars, replace
  two `as any[]` in schema.ts with `Array<Record<string, unknown>>`,
  drop unused destructure in change-classifier, drop unused catch binding
  in extract-structure.mjs.
- Add EOF newline to eslint.config.mjs.
- Refresh pnpm-lock.yaml.
- Add `pnpm lint` step to .github/workflows/ci.yml so the tooling
  actually enforces something.

pnpm lint now exits 0 locally; 33+13 test files / 1445 tests still pass.
@Lum1104
Copy link
Copy Markdown
Owner

Lum1104 commented May 23, 2026

@okwn pushed a follow-up commit addressing the review notes; hope you don't mind me taking it the rest of the way. Summary of what changed:

Direction picked for (5): went with tseslint.configs.recommended baseline + fixed everything so pnpm lint exits 0. Ratcheting up to strict is a clean follow-up PR.

Config (eslint.config.mjs)

  • strictrecommended.
  • Dropped the parserOptions.projectService block. Neither recommended nor strict is type-aware, so it was unused; removing it also dodges the pnpm-workspace tsconfig-resolution failure mode I was worried about in (4).
  • Added Node + browser globals via the globals package — fixes 280 no-undef errors in .mjs scripts and dashboard code.
  • Expanded ignores: **/public/** (kills 1900+ errors in the homepage demo bundle), **/.astro/**, .private/**.
  • Allow _-prefixed unused vars; no-irregular-whitespace with skipComments: true (json-parser intentionally uses ZWSP-escaped block-comment examples in JSDoc).
  • EOF newline added (3).

Code fixes (the 13 residual real errors)

  • Dropped unused imports/vars in ruby-extractor.ts, tree-sitter-plugin.ts, two parsers, two test files, and change-classifier.ts.
  • Replaced two as any[] in schema.ts with Array<Record<string, unknown>> — the runtime checks already narrowed properly.
  • Dropped unused catch binding in extract-structure.mjs.

Other

  • Refreshed pnpm-lock.yaml (1).
  • Wired pnpm lint into .github/workflows/ci.yml (6).

Local verification: pnpm lint exits 0, core + skill builds pass, all 1445 tests pass. Waiting on CI now.

@Lum1104 Lum1104 merged commit 4bd6f78 into Lum1104:main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants