Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
This repository was archived by the owner on May 1, 2025. It is now read-only.

Replace import/no-restricted-paths with no-restricted-imports #35

@fregante

Description

@fregante

With a recent update, eslint became unreasonably slow, with lints running at 7 minutes locally. I think this started happening after a ts-eslint or import-plugin update. A good chunk of time seems to be taken by the import/no-restricted-paths rule currently, like 2 whole minutes.

I think the native no-restricted-imports could match the functionality, with the exception that it does not accept "per-directory" options. This can be achieved by using the native eslint overrides, but these overrides cancel out any other config for this rule, unless you manually re-apply it, like:

"no-restricted-imports": [
"error",
{
// Documentation: https://eslint.org/docs/rules/no-restricted-imports#options
patterns: [
// Extend the existing patterns
...config.rules["no-restricted-imports"][1].patterns,
{
group: ["./*"],
message:
'Use root-based imports (`import "@/something"`) instead of relative imports.',
},
],

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions