Skip to content

Fix no-import-test-files rule incorrectly reporting module names ending in .js #226

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 1 commit into from
May 14, 2019

Conversation

GMartigny
Copy link
Contributor

Fix #215

@GMartigny
Copy link
Contributor Author

Hi,
The isExternalModule function is based on https://github.com/benmosher/eslint-plugin-import/blob/master/src/core/importType.js#L40 minus the part doing a full resolve of the import. First, it feels overkill in this context. Secondly, I'm not confident doing a resolve of a user-defined path, as it open the door for script injection.

I also add the regression test of the initial use-case.

@sindresorhus sindresorhus changed the title Check if imported module is external before reporting no-import-test Check if imported module is external before reporting no-import-test May 14, 2019
@sindresorhus
Copy link
Member

In the future, make sure you PR title describe what it fixes, not how.

@sindresorhus sindresorhus changed the title Check if imported module is external before reporting no-import-test Fix no-import-test-files rule incorrectly reporting module names ending in .js May 14, 2019
@sindresorhus sindresorhus merged commit c383cf6 into avajs:master May 14, 2019
@GMartigny GMartigny deleted the noImportTestForExernals branch May 14, 2019 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-import-test-files incorrectly flags modules that end in .js
2 participants