Skip to content

build: add eslint.config.cjs for JavaScript targets on ESLint v8 (gh54 part V)#10967

Draft
Planeshifter wants to merge 2 commits intophilipp/gh54-ts-toolchain-bumpfrom
philipp/gh54-flat-config
Draft

build: add eslint.config.cjs for JavaScript targets on ESLint v8 (gh54 part V)#10967
Planeshifter wants to merge 2 commits intophilipp/gh54-ts-toolchain-bumpfrom
philipp/gh54-flat-config

Conversation

@Planeshifter
Copy link
Member

@Planeshifter Planeshifter commented Mar 15, 2026

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

Description

What is the purpose of this pull request?

This pull request:

  • Adds eslint.config.cjs flat config alongside the legacy .eslintrc.* configuration
  • Inlines stdlib rules as a runtime plugin object via lib/node_modules/@stdlib/_tools/eslint/rules/scripts/plugin.js.
  • Reuses existing rule definitions from etc/eslint/rules/.
  • Separates non-clonable rule options (remark plugin instances) from the main rules object to work around structuredClone limitations in ESLint's flat config internals.
  • Adds globals package for flat config environment definitions.
  • Legacy .eslintrc.* files remain in place as the default workflow.

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?

Files under lib/node_modules/ are hard-ignored by ESLint v8 flat config (**/node_modules/** is always ignored). Full lib/ linting via flat config requires ESLint v9, which allows !**/node_modules/ ignore overrides. This is expected and will be resolved in PR 11.

Other

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

Stacked on #10966. Usage: ESLINT_USE_FLAT_CONFIG=true npx eslint -c eslint.config.cjs <file>.

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 force-pushed the philipp/gh54-ts-toolchain-bump branch from b5e37c5 to 6b4b53e Compare March 15, 2026 14:28
@Planeshifter Planeshifter force-pushed the philipp/gh54-flat-config branch from 676204c to 1b253a7 Compare March 15, 2026 14:29
@Planeshifter Planeshifter force-pushed the philipp/gh54-flat-config branch from 1b253a7 to fd4e835 Compare March 15, 2026 15:29
@Planeshifter Planeshifter force-pushed the philipp/gh54-ts-toolchain-bump branch from 6b4b53e to b7de8e9 Compare March 15, 2026 15:34
@Planeshifter Planeshifter force-pushed the philipp/gh54-flat-config branch from fd4e835 to 6cba0ae Compare March 15, 2026 15:34
@socket-security
Copy link

socket-security bot commented Mar 15, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: Unsafe defaults in npm remark-html``

CVE: GHSA-9q5w-79cv-947m Unsafe defaults in remark-html (CRITICAL)

Affected versions: = 14.0.0; < 13.0.2; >= 14.0.0 < 14.0.1

Patched version: 13.0.2

From: package.jsonnpm/remark-html@10.0.0

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/remark-html@10.0.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@Planeshifter Planeshifter force-pushed the philipp/gh54-ts-toolchain-bump branch from b7de8e9 to 255a35c Compare March 15, 2026 16:26
@Planeshifter Planeshifter force-pushed the philipp/gh54-flat-config branch from 6cba0ae to 338fb5d Compare March 15, 2026 16:26
@Planeshifter Planeshifter changed the title build: add eslint.config.cjs for JavaScript targets on ESLint v8 build: add eslint.config.cjs for JavaScript targets on ESLint v8 (gh54 part V) Mar 15, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-ts-toolchain-bump branch from 255a35c to 28cbc14 Compare March 15, 2026 17:46
@Planeshifter Planeshifter force-pushed the philipp/gh54-flat-config branch from 0d008d7 to 0705d6b Compare March 15, 2026 17:48
Add flat config alongside the legacy `.eslintrc.*` configuration:

- Create `eslint.config.cjs` with base JS config, override blocks
  for benchmarks, examples, tests, and REPL namespace files
- Inline stdlib rules as a runtime plugin object via
  `lib/node_modules/@stdlib/_tools/eslint/rules/scripts/plugin.js`
- Reuse existing rule definitions from `etc/eslint/rules/`
- Separate non-clonable rule options (remark plugin instances) from
  the main rules object to work around `structuredClone` limitations
  in ESLint's flat config internals
- Add `globals` package for flat config environment definitions
- Legacy `.eslintrc.*` files remain in place as the default workflow

Usage (requires ESLint v8 with flat config enabled):

    ESLINT_USE_FLAT_CONFIG=true npx eslint -c eslint.config.cjs <file>

Note: files under `lib/node_modules/` are hard-ignored by ESLint v8
flat config. Full `lib/` linting via flat config requires ESLint v9,
which allows `!**/node_modules/` ignore overrides.

Ref: stdlib-js/metr-issue-tracker#54
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
@Planeshifter Planeshifter reopened this Mar 15, 2026
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.

1 participant