Skip to content

feat(linter/eslint): implement no-implied-eval rule#22391

Merged
camc314 merged 4 commits into
oxc-project:mainfrom
v-sayapin:feat-linter-no-implied-eval
May 17, 2026
Merged

feat(linter/eslint): implement no-implied-eval rule#22391
camc314 merged 4 commits into
oxc-project:mainfrom
v-sayapin:feat-linter-no-implied-eval

Conversation

@v-sayapin

@v-sayapin v-sayapin commented May 13, 2026

Copy link
Copy Markdown
Contributor

Implements the eslint/no-implied-eval rule, which disallows string-evaluating calls through setTimeout, setInterval and execScript

It supports direct global calls, member calls through global objects such as window, global, globalThis, and self, repeated global-object chains, static computed properties, optional chaining, shadowing/import handling, and statically known string arguments

ESLint ref: https://eslint.org/docs/latest/rules/no-implied-eval

Issue: #479

Algorithmic Complexity

The rule runs only on CallExpression nodes

Ordinary non-target calls return in O(1)
Global-object member matching is O(H), where H is member-chain depth
String argument detection runs only after a target callee is found

Static argument analysis is intentionally small: it handles syntactic string expressions, initialized bindings, direct global String(...) / Date(), typeof, and sequence expressions
Identifier initialization recursion is bounded

The hot path avoids regexes and heap allocations

Notes

Callee/global-object matching follows ESLint behavior: direct globals, window / global / globalThis / self, repeated same-name chains, static computed properties, optional chaining, and shadowing/import handling

Oxlint is intentionally stricter for cheap string-producing arguments such as String(foo), Date(), typeof foo, and initialized let / var strings
This follows maintainer feedback for this security-oriented rule and avoids full flow/type analysis

The rule also unwraps TypeScript-only expression wrappers such as as, satisfies, !, type assertions, and instantiation expressions

It does not try to follow timer aliases, .call / .apply, dynamic property names, string methods, object/array property values, or broad constant folding

AI Disclosure

Claude Opus 4.7 & Codex GPT 5.5

  • Code review
  • Comparison with ESLint ref rule behavior
  • Discussion of edge cases
  • Writing and validating tests

@v-sayapin v-sayapin requested a review from camc314 as a code owner May 13, 2026 21:33
@v-sayapin v-sayapin force-pushed the feat-linter-no-implied-eval branch from bb0a030 to 54c388a Compare May 13, 2026 22:07
@v-sayapin

Copy link
Copy Markdown
Contributor Author

@codex review, use the repository skill $performance-lint-rules

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@camc314 camc314 self-assigned this May 14, 2026
@v-sayapin v-sayapin marked this pull request as draft May 14, 2026 11:05
@v-sayapin v-sayapin force-pushed the feat-linter-no-implied-eval branch from 54c388a to 3aba3fd Compare May 16, 2026 15:33
@v-sayapin v-sayapin marked this pull request as ready for review May 16, 2026 15:34
@v-sayapin v-sayapin requested a review from overlookmotel as a code owner May 16, 2026 15:34

@camc314 camc314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you!

@camc314 camc314 added the A-linter Area - Linter label May 17, 2026
@camc314 camc314 merged commit 2a6ddce into oxc-project:main May 17, 2026
27 checks passed
@codspeed-hq

codspeed-hq Bot commented May 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing v-sayapin:feat-linter-no-implied-eval (07e28a8) with main (7ffb710)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

camc314 pushed a commit that referenced this pull request May 18, 2026
# Oxlint
### 🚀 Features

- 1ae291e linter/no-underscore-dangle: Add `allowInUsingDeclarations`
option (#22483) (吴杨帆)
- 0440b0f linter/eslint: Implement `id-match` rule (#22379) (Vladislav
Sayapin)
- 65bf119 linter: Implement react no-object-type-as-default-prop
(#22481) (uhyo)
- 2a6ddce linter/eslint: Implement `no-implied-eval` rule (#22391)
(Vladislav Sayapin)
- d3a3c1d linter: Auto detect agents from CLI and transition to the
agent output format (#22068) (Jovi De Croock)
- 625758a linter/vitest: Implement padding-around-after-all-blocks rule
(#21788) (kapobajza)
- 37680b0 linter: Implement react no-unstable-nested-components (#22248)
(Jovi De Croock)
- d8d9c74 linter: Implement import/newline-after-import rule (#19142)
(Ryuya Yanagi)

### 🐛 Bug Fixes

- 3f59e03 linter: Only call rayon/miette/tracing inits once (#21899)
(Matiss Janis Aboltins)
- 602dfd6 linter/promise/no-return-wrap: Detect Promise calls in all
branches (#22474) (zennnnnnn11)
- e182aee linter: Allow dialogs and popovers for no_autofocus (#22289)
(mehm8128)
- 7ffb710 linter/jest/vitest: Jest/no-standalone-expect ignores
additionalTestBlockFunctions option for jest/vitest hooks (#22477)
(kapobajza)
- c6f2d3f linter: Add more expression support for iframe-has-title
(#22460) (mehm8128)
- 5747ff1 linter: Avoid enabling jest with vitest plugin (#22499)
(camc314)
- 863984f linter/no-find-dom-node: Run on all files (#22479) (bab)

### ⚡ Performance

- 2afef79 linter: Optimize `no-loop-func` (#22491) (camchenry)
- 4c9ca72 oxlint: Align walker thread count with rayon pool (#22494)
(Boshen)

### 📚 Documentation

- f7967c7 linter/id-match: Clarify `onlyDeclarations` config docs
(#22523) (camc314)
- 1e0c97f linter: Fix closing code block in documentation for
`padding-around-after-all-blocks` rule. (#22513) (connorshea)
- a9049fd linter: Exclude directly provide autoFocus to dialog pattern
(#22510) (mehm8128)
# Oxfmt
### 🐛 Bug Fixes

- 8ee946f formatter/sort_imports: Use label to classify lines (#22512)
(leaysgur)
- 8c1da44 formatter: Normalize destructuring keys in DCR (#22478)
(camc314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants