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

Relax rule: import/no-absolute-path #861

Closed
feross opened this Issue Apr 14, 2017 · 2 comments

Comments

2 participants
@feross
Copy link
Member

feross commented Apr 14, 2017

I would like to relax the import/no-absolute-path rule which "Forbids import of modules using absolute paths". It's not that I think absolute imports are a good idea, it's just that this rule is incredibly slow!

I opened an issue about it on the eslint-plugin-import repo: benmosher/eslint-plugin-import#803

Almost 25% of linting time is spent in that one rule. Since this isn't actually a very common error (0 repos in our test suite actually failed when this was added, it's no big deal to just remove it, IMO)

Here's the raw output:

TIMING=1 standard                                                                                                                                         master
Rule                         | Time (ms) | Relative
:----------------------------|----------:|--------:
import/no-absolute-path      |    27.906 |    24.3%
indent                       |     7.070 |     6.2%
no-extra-parens              |     4.939 |     4.3%
comma-dangle                 |     4.313 |     3.8%
no-unused-vars               |     3.695 |     3.2%
no-regex-spaces              |     2.834 |     2.5%
space-in-parens              |     2.611 |     2.3%
no-useless-return            |     2.361 |     2.1%
no-unmodified-loop-condition |     2.310 |     2.0%
block-spacing                |     2.126 |     1.9%
@feross

This comment has been minimized.

Copy link
Member Author

feross commented Apr 14, 2017

Confirmed a noticable (150-200ms) improvement on a real-world repo (webtorrent):

Before:

$ rm -rf ~/.standard-cache && time ~/code/standard/bin/cmd.js
2.74s user 0.16s system 123% cpu 2.353 total

After:

$ rm -rf ~/.standard-cache && time ~/code/standard/bin/cmd.js
2.55s user 0.15s system 124% cpu 2.178 total
@feross

This comment has been minimized.

Copy link
Member Author

feross commented Apr 14, 2017

Released as 10.0.2

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.