Skip to content

no-restricted-paths is slow when many imports/excepts #1758

Open
@robatwilliams

Description

@robatwilliams

The rule appears to be building and validating the excepts for each zone every time an import is encountered. This makes it very slow when you have many files/imports, zones, and/or excepts.

I narrowed it down to this validation part here:

const hasValidExceptionPaths = absoluteExceptionPaths
            .every((absoluteExceptionPath) => isValidExceptionPath(absoluteFrom, absoluteExceptionPath))

https://github.com/benmosher/eslint-plugin-import/blob/master/src/rules/no-restricted-paths.js#L88

Could it instead validate the exception paths once when the rule is initialised?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions