Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Request: Add api support for timing information #16521

Closed
1 task
Mattstir opened this issue Nov 8, 2022 · 14 comments
Closed
1 task

Change Request: Add api support for timing information #16521

Mattstir opened this issue Nov 8, 2022 · 14 comments
Assignees
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion needs design Important details about this change need to be discussed
Projects

Comments

@Mattstir
Copy link

Mattstir commented Nov 8, 2022

ESLint version

8.22.0

What problem do you want to solve?

Currently it is not possible to get the TimingInformation, when using the Node.js API.

Only CLI supports the output of the TIMING information. Adding this also for the nodejs api would allow for automatic reporting of slow rules. In a big project with a lot of rules (also a lot of custom - quite heavy ones) this would come in quite handy.

What do you think is the correct solution?

My take on this would be to add a new option to the ESLint.Options.
e.g.: timing: true

To not break any current usages, changing the report value of e.g.: lintFiles isn't really possible.
Therefore adding a function that allows to get the timing information of the last lintrun would make sense.

e.g.: eslint.getLatestTimingInformation

This returns an array with a following object per rule:

{
    name: string, // name of the rule
    time: number, // time the rule consumed in ms
    relative: number // percent of the total consumed time, e.g.: 0.13 for 13%
}

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@Mattstir Mattstir added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Nov 8, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Nov 8, 2022
@snitin315
Copy link
Contributor

Since we already allow this for CLI, I feel it makes sense to support this with Nodejs API. I'd like to know what other team members think about this.

@snitin315 snitin315 moved this from Needs Triage to Feedback Needed in Triage Nov 9, 2022
@snitin315 snitin315 added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Nov 9, 2022
@nzakas nzakas added the needs design Important details about this change need to be discussed label Nov 11, 2022
@nzakas
Copy link
Member

nzakas commented Nov 11, 2022

👍 If we have the data, we can expose it. The question is: what is the best way to expose it? We can't just add a method to ESLint class because the timing method is specific to each call to lintText() or lintFiles(). In all likelihood, we might need new methods like lintTextWithTiming() and lintFilesWithTiming() to avoid breaking changes.

This would require an RFC.

@bmish
Copy link
Sponsor Member

bmish commented Nov 11, 2022

Interested in this feature.

@github-actions
Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Jan 10, 2023
@Mattstir
Copy link
Author

Please don't auto-close this issue, as this is still needed! :)

@bmish bmish removed the Stale label Jan 12, 2023
@bmish
Copy link
Sponsor Member

bmish commented Jan 12, 2023

I was imagining all sorts of additional statistics we could calculate about rules (violations, suppressions, time, etc) in: #14597 (comment). It would be ideal if this information was available via both CLI and Node API. So it could be worthwhile to account for additional "summary" metrics in any new API.

@github-actions
Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Feb 14, 2023
@Mattstir
Copy link
Author

Again, Please don't auto-close this issue, as this is still needed! :)

@Rec0iL99 Rec0iL99 removed the Stale label Feb 15, 2023
@nzakas
Copy link
Member

nzakas commented Mar 1, 2023

@Mattstir best way to make sure this doesn't get closed is to open an RFC. The core team won't be working on this, so unless someone from the community chips in, this won't get done.

@github-actions
Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@nzakas
Copy link
Member

nzakas commented Apr 5, 2023

RFC is opened, so definitely not stale.

@fasttime
Copy link
Member

Not stale. Waiting for eslint/rfcs#108.

@fasttime
Copy link
Member

fasttime commented Jan 14, 2024

The RFC has been accepted, it is being implemented in #17850.

@nzakas
Copy link
Member

nzakas commented Apr 4, 2024

#17850 has been merged, so closing.

@nzakas nzakas closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion needs design Important details about this change need to be discussed
Projects
Archived in project
Triage
Feedback Needed
Development

No branches or pull requests

6 participants