Skip to content

docs: document import/extensions slowness #6318

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

Merged
merged 3 commits into from
Jan 12, 2023
Merged

Conversation

bradzacher
Copy link
Member

This was a surprising result that I found at work today.
I found that import/extensions took ~30s for a total codebase run - which was 1/3 of the overall lint time!!!

I replaced it with the listed no-restricted-syntax config which in comparison runs in less than 1ms over the entire codebase, which is a YUGE win.

This hadn't been documented before because when I wrote this performance section I didn't realise that this lint rule could be slow.

I tried to clearly spell out the fact that the alternative has false positives and is not a 1:1 replacement. Now-a-days I've found that there's very few npm packages that still include .js in their name, and false-positives like foo.js.ts should really not happen - so in practice it'll be 1:1, but still tried to make it clear there could be false positives.

@bradzacher bradzacher added the documentation Documentation ("docs") that needs adding/updating label Jan 10, 2023
@nx-cloud
Copy link

nx-cloud bot commented Jan 10, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 6756ff3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 47 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Jan 10, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 6756ff3
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/63bf63f77c857300092432ee
😎 Deploy Preview https://deploy-preview-6318--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Fun! 🧠

1. to enforce file extensions are always used,
2. to enforce file extensions are never used.

##### Enforcing extensions are used
Copy link
Member

Choose a reason for hiding this comment

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

Note that the font size for #####s is pretty small:

Screenshot of headings with small sizes

Maybe a good time to bump that up a bit?

Copy link
Member Author

Choose a reason for hiding this comment

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

How did you see this? Did you check it out locally?
When I tried the netlify deploy link above it doesn't include my changes :(

Copy link
Member

Choose a reason for hiding this comment

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

Oh I tried this with yarn start locally. Weird that the deploy doesn't have it.

@bradzacher
Copy link
Member Author

@JoshuaKGoldberg - I just made the performance setion its own page entirely.
I think it's a meaty enough chunk that it deserves it.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Agreed, this is a good move. Thanks!

I'll send a separate PR standardizing file names to Upper_Snake_Case.mdx.

Edit: #6325

That generally makes them run orders of magnitude slower.
Linters are designed to run in a parse, check, report, fix cycle. This means that there is a lot of intermediate work that needs to be done before a linter can fix a formatting issue with your code.

Additionally linters typically run each rule isolated from one another. This has several problems with it like:
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
Additionally linters typically run each rule isolated from one another. This has several problems with it like:
Additionally linters typically run each rule isolated from one another. This has several problems with it such as:

@bradzacher bradzacher merged commit 722fd77 into main Jan 12, 2023
@bradzacher bradzacher deleted the docs-import-extensions-slow branch January 12, 2023 03:56
@typescript-eslint typescript-eslint deleted a comment Jan 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation ("docs") that needs adding/updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants