Skip to content

linter: Speed up no-loop-func rule #22471

@connorshea

Description

@connorshea

I ran yarn oxlint --debug=timings on our codebase at work and was surprised to see eslint/no-loop-func having such a large chunk of the runtime:

Finished in 8.7s on 12010 files with 278 rules using 11 threads.

Rule timings:
Rule                                             Time (ms)  Relative    Calls  Source
----------------------------------------------  ----------  --------  -------  ------
eslint/no-loop-func                                254.337     23.1%    54883  native
eslint/no-unused-vars                               85.605      7.8%    11975  native
eslint/no-underscore-dangle                         76.536      7.0%  3685784  native
import/extensions                                   31.538      2.9%   161441  native
eslint/no-shadow                                    29.547      2.7%    12010  native
react/exhaustive-deps                               23.118      2.1%   149431  native

We should see if we can optimize it. (note: the 8.7s runtime is almost entirely due to type-aware rules)

https://github.com/oxc-project/oxc/blob/610f4c7b0bdac95148373fab8798e8fcbecec820/crates/oxc_linter/src/rules/eslint/no_loop_func.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions