Skip to content

perf(linter): jest/expect-expect rule is excessively slow #23592

Description

@spanishpear

What version of Oxlint are you using?

1.70

What command did you run?

No response

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

We've got a large custom config across a bunch of files, but I think the given information should help!

What happened?

I have a large monorepo project where we are seeing this performance profile with --debug=timings (just a snippet)

oxlint --debug=timings

Found 602 warnings and 0 errors.
Finished in 23.5s on 116898 files with 133 rules using 8 threads.

Rule timings:
Rule                                                 Time (ms)  Relative    Calls  Source
--------------------------------------------------  ----------  --------  -------  ------
jest/expect-expect                                   90501.192     86.8%  1197500  native
eslint/no-unused-vars                                 1738.462      1.7%   115507  native
react/exhaustive-deps                                  704.302      0.7%  3154542  native
eslint/prefer-rest-params                              551.882      0.5%  7276020  native

specifically for our config

'jest/expect-expect': [
    'warn',
    {
        assertFunctionNames: ['expect', 'expectSaga'],
    },
],

when i comment out the assertFunctionNames; it gets to

oxlint --debug=timings

Found 1259 warnings and 0 errors.
Finished in 16.6s on 116898 files with 133 rules using 8 threads.

Rule timings:
Rule                                                 Time (ms)  Relative    Calls  Source
--------------------------------------------------  ----------  --------  -------  ------
jest/expect-expect                                   29563.747     69.0%  1197500  native
eslint/no-unused-vars                                 1695.540      4.0%   115507  native
react/exhaustive-deps                                  724.672      1.7%  3154542  native
eslint/prefer-rest-params                              536.790      1.3%  7276020  native

but if i disable the rule entirely, it is now super fast

oxlint --debug=timings

Found 152 warnings and 0 errors.
Finished in 13.8s on 116898 files with 132 rules using 8 threads.

Rule timings:
Rule                                                 Time (ms)  Relative    Calls  Source
--------------------------------------------------  ----------  --------  -------  ------
eslint/no-unused-vars                                 1705.014     12.9%   115507  native
react/exhaustive-deps                                  723.946      5.5%  3154542  native
eslint/prefer-rest-params                              520.718      3.9%  7276020  native
eslint/no-multi-str                                    465.895      3.5%  3351357  native
eslint/prefer-spread                                   423.895      3.2%  3279131  native
eslint/no-script-url                                   331.077      2.5%  3424312  native

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions