Skip to content

build: switch Makefiles and pre-commit to flat config (gh54 part VII) - #10973

Draft
Planeshifter wants to merge 4 commits into
philipp/gh54-eslint-v9from
philipp/gh54-switch-to-flat-config
Draft

build: switch Makefiles and pre-commit to flat config (gh54 part VII)#10973
Planeshifter wants to merge 4 commits into
philipp/gh54-eslint-v9from
philipp/gh54-switch-to-flat-config

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Mar 15, 2026

Copy link
Copy Markdown
Member

Progresses stdlib-js/metr-issue-tracker#54.

Description

What is the purpose of this pull request?

This pull request:

  • Switches Makefiles and pre-commit hook from legacy .eslintrc.* config to flat config autodiscovery
  • Removes ESLINT_USE_FLAT_CONFIG=false, --ignore-path, --config, and per-target config variables from JS and TS eslint.mk.
  • Removes per-directory tsconfig.json copy mechanism from TS eslint.mk (flat config's TS block handles this).
  • Removes legacy config path variables from the pre-commit hook.
  • ESLint now autodiscovers eslint.config.cjs and applies rules based on file patterns.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Stacked on #10972.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was written primarily by Claude Code.


@stdlib-js/reviewers

@Planeshifter Planeshifter changed the title build: switch Makefiles and pre-commit to flat config build: switch Makefiles and pre-commit to flat config (gh54 part VII) Mar 15, 2026
@Planeshifter
Planeshifter force-pushed the philipp/gh54-switch-to-flat-config branch from c3dab8a to c6bab92 Compare March 15, 2026 18:08
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Mar 18, 2026
@Planeshifter
Planeshifter force-pushed the philipp/gh54-switch-to-flat-config branch from c6bab92 to 3bdcf70 Compare August 20, 2026 05:57
@Planeshifter
Planeshifter force-pushed the philipp/gh54-switch-to-flat-config branch from 3bdcf70 to 9610469 Compare August 20, 2026 06:11
@Planeshifter
Planeshifter force-pushed the philipp/gh54-switch-to-flat-config branch from 9610469 to 92735cb Compare August 20, 2026 06:25
@kgryte
kgryte force-pushed the philipp/gh54-switch-to-flat-config branch from 92735cb to bcb201a Compare August 21, 2026 10:06
@kgryte
kgryte force-pushed the philipp/gh54-switch-to-flat-config branch from bcb201a to 86526e2 Compare August 21, 2026 10:14
@Planeshifter
Planeshifter force-pushed the philipp/gh54-switch-to-flat-config branch from 86526e2 to 00d646f Compare August 25, 2026 03:49
Planeshifter and others added 4 commits August 25, 2026 18:17
Add TypeScript-specific flat config blocks for `**/*.d.ts` and
`**/test/**/*.ts` files:

- Configure `@typescript-eslint/parser` with `parserOptions.project`
  pointing to the root `tsconfig.json`
- Register `@typescript-eslint`, `@stylistic/ts`, `jsdoc`, `import`,
  `expect-type`, and `stdlib` plugins
- Reuse the existing TypeScript rules from `etc/eslint/rules/typescript.js`
- Disable `jsdoc/require-jsdoc` for TypeScript test files

Ref: stdlib-js/metr-issue-tracker#54
Upgrade ESLint from v8 to v9 and fix all v9-specific breakages:

- Bump `eslint` from `^8.57.0` to `^9.0.0`
- Add `!**/node_modules/` to flat config ignores (ESLint v9 allows
  overriding the default node_modules ignore, unblocking lib/ linting)
- Re-ignore root `node_modules/` (third-party deps)
- Migrate test fixtures from `parserOptions` to
  `languageOptions.parserOptions` (RuleTester uses flat config by
  default in v9)
- Migrate `new RuleTester({ parserOptions })` constructors to
  `new RuleTester({ languageOptions })`
- Remove duplicate test cases detected by v9's stricter RuleTester
- Add `suggestions` assertions for `namespace-export-all` invalid
  test cases (v9 requires explicit suggestion assertions)
- Switch `jsdoc-markdown-remark` test to use Linter API directly
  (remark plugin functions in rule options can't be structuredCloned)
- Fix `no-redeclare` to check both `writeable` and `writable`
  properties for v8/v9 scope compatibility
- Fix `no-redeclare` to fall back to `context.parserOptions` when
  `context.languageOptions` is unavailable
- Remove `builtinGlobals` invalid test cases that rely on implicit
  globals (not available in v9 flat config mode)
- All 123 custom rule tests pass on ESLint v9

Ref: stdlib-js/metr-issue-tracker#54
Follow-up to the ESLint v9 upgrade:

-   Migrates the `format-args` rule tests to `languageOptions`. The rule
    landed on `develop` after this branch was written, so the rebase
    pulled it in unmigrated and its tests errored under v9 with "Key
    \"parserOptions\": This appears to be in eslintrc format rather than
    flat config format".
-   Narrows the flat config un-ignore from `!**/node_modules/` to
    `!lib/node_modules/`. The broad pattern un-ignored nested
    `node_modules` directories inside packages (e.g. `nyc` caches under
    `math/base/special/*/node_modules/`), which then got linted. The
    narrow pattern leaves those to ESLint's default ignores, making the
    separate `node_modules/` re-ignore unnecessary. Verified identical
    behavior across all tracked source files.
-   Restores the two `no-redeclare` `builtinGlobals` invalid fixtures
    using `languageOptions.sourceType: 'script'`. They failed under flat
    config because its default `sourceType` is `module`, which places
    `var` declarations in module rather than global scope; they do not
    depend on how v9 exposes implicit globals.
-   Regenerates `etc/npm/deps.txt` for the `eslint` and
    `eslint-plugin-expect-type` version bumps.

All 124 custom rule tests pass on ESLint v9.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Update build tooling to use ESLint flat config (`eslint.config.js`)
instead of legacy `.eslintrc.*` files:

- Remove `ESLINT_USE_FLAT_CONFIG=false` from JS eslint.mk
- Remove `--ignore-path`, `--config`, and per-target config variables
  from both JS and TS eslint.mk (flat config autodiscovery handles
  all of this via `eslint.config.js`)
- Remove per-directory tsconfig.json copy mechanism from TS eslint.mk
  (the flat config's TS block points to the root tsconfig.json)
- Remove legacy config path variables from pre-commit hook

ESLint now autodiscovers `eslint.config.js` at the repo root and
applies the correct rules based on file patterns (benchmarks, tests,
examples, TypeScript) defined in the flat config.

Ref: stdlib-js/metr-issue-tracker#54
@kgryte
kgryte force-pushed the philipp/gh54-switch-to-flat-config branch from 00d646f to a1f1006 Compare August 26, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant