-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot read property 'forEach' of undefined when iterating html files #2210
Comments
It definitely should be necessary if you’re linting non-js files; typically those use an entirely separate config for reasons like this. |
I have updated my repo and disabled the nx command caching. The error seems to related to the rule |
I'm not familiar with
What's happening is that you're getting very lucky - most rules don't use the Program visitor, and HTML files probably have AST node names that are completely distinct from JS ones. The import plugin has 15 rules using the Program visitor; you might just not have those enabled yet (the airbnb config enables most of them; i suggest using it). The fix would be trivial - |
So I see a fix in a third party repo but I don't see this merged into |
@ljharb did you submit a PR back to the origin from your fork? |
@ljharb hi, any updates on this bug? Do you want to move this commit to the original repo? |
@skoblenick that's inaccurate; the commit is indeed in main, and it's not possible for the commit to have closed this issue unless it landed in main in this repo, so I'm not sure what your confusion is. |
@Dima-Astreyko the fix is included in v2.25.4+. |
Linting all files with a global rule results in:
I have a sample repo that reproduces the issue here: https://github.com/skoblenick/eslint-plugin-import-issue
I realize I could technically move the plugin into an
override
that is specific to the.ts
files however it shouldn't be necessary when the code could just be more defensive. I could imagine a use case where I may have preprocessor working on imports within a html or template file (like anhbs
) and I want them ordered (hence a lint check).The text was updated successfully, but these errors were encountered: