build: upgrade ESLint core to v9 (gh54 part VI) - #10972
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
ae6c4ab to
de3432a
Compare
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
de3432a to
749cc2b
Compare
89ca559 to
85dcf2f
Compare
85dcf2f to
fe1dbb3
Compare
81b57b2 to
0aea562
Compare
0aea562 to
3320e06
Compare
3320e06 to
612337e
Compare
612337e to
4325a4f
Compare
Coverage ReportNo coverage information available. |
| 'var tape = require( \'tape\' );', | ||
| '', | ||
| 'var isnan = require( \'@stdlib/math/base/assert/is-nan\' ); // eslint-disable-line no-empty-lines-between-requires' | ||
| 'var isnan = require( \'@stdlib/math/base/assert/is-nan\' ); // eslint-disable-line rule-to-test/no-empty-lines-between-requires' |
There was a problem hiding this comment.
I am guessing that rule-to-test is some known identifier?
| ESLINT_IGNORE ?= $(ROOT_DIR)/.eslintignore | ||
|
|
||
| # Use legacy config until build tooling switches to flat config: | ||
| export ESLINT_USE_FLAT_CONFIG := false |
There was a problem hiding this comment.
Who and what is using this environment variable?
There was a problem hiding this comment.
Is this something recognized by ESLint?
| # Define the path to the ESLint ignore file: | ||
| ESLINT_IGNORE ?= $(ROOT_DIR)/.eslintignore | ||
|
|
||
| # Use legacy config until build tooling switches to flat config: |
There was a problem hiding this comment.
| # Use legacy config until build tooling switches to flat config: | |
| # FIXME: Use legacy config until build tooling switches to flat config: |
2aa6fbc to
c7a7b0b
Compare
Ref: stdlib-js/metr-issue-tracker#1223 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
Executing the example would run the linter within the linter and deadlock, which caused the "Run changed examples" CI job to time out. Ref: stdlib-js/metr-issue-tracker#1223 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
Executing the example via the `stdlib/doctest` rule would run the linter within the linter and deadlock, which caused the "Lint Changed Files" CI job to time out. Ref: stdlib-js/metr-issue-tracker#1223 --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
Now that Markdown code blocks are linted using the path of the containing file, rules which special-cased anonymous (`<text>`) input to tolerate not-yet-implemented packages (readme-driven development) must apply the same leniency to Markdown file paths. Also share the host realm's error constructors with the doctest sandbox so that `instanceof` checks on host-created errors succeed. Ref: stdlib-js/metr-issue-tracker#1223 Co-authored-by: Athan Reines <kgryte@gmail.com> --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
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>
Corrects four doctest return annotations whose displayed values did not match actual output: a `%g` example omitting the literal text following the conversion specification and three width-padded examples showing too few padding spaces. Surfaced by Markdown code block linting once restored under ESLint v9. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
535428e to
b35ca81
Compare
|
Rebased this branch onto
This PR should land after #14668. (Attempted to retarget the base branch to stack it explicitly, but GitHub refused since the PR is part of a stack — until #14668 merges, the diff here includes its commits.) 🤖 Generated with Claude Code |
Progresses stdlib-js/metr-issue-tracker#54.
Description
This pull request:
!**/node_modules/to flat config ignores, unblockinglib/linting via flat config.parserOptionstolanguageOptions.parserOptions(RuleTester uses flat config by default in v9).suggestionsassertions fornamespace-export-all(v9 requires explicit suggestion assertions).jsdoc-markdown-remarktest to Linter API (remark plugin functions can't bestructuredCloned).no-redeclarefor v8/v9 scope compatibility (writeablevswritable,context.languageOptionsfallback).Related Issues
This pull request has the following related issues:
Questions
The
builtinGlobalsinvalid test cases forno-redeclarewere removed because ESLint v9 flat config doesn't expose implicit globals the same way v8 did. ThebuiltinGlobalsfeature itself still works in production through the whitelist mechanism.Other
Stacked on #10967. Legacy config still works with
ESLINT_USE_FLAT_CONFIG=false.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code under my direction.
@stdlib-js/reviewers