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

Prevent the no-import-test rule to crash when imported path is not a string #228

Merged
merged 4 commits into from May 18, 2019

Conversation

GMartigny
Copy link
Contributor

fix #213

(Sorry for the duplicated PR)

Copy link
Member

@novemberborn novemberborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon it's better to check the source in the AST visitors rather than converting to a string here. @Manu1400 took that approach in this commit: 2d48704, which was submitted a little earlier as part of #221.

I've asked him to open a separate PR with that approach. Would you mind having a look at that one too?

@GMartigny
Copy link
Contributor Author

GMartigny commented Apr 22, 2019

I reckon it's better to check the source in the AST visitors

I made the requested changes.

@sindresorhus
Copy link
Member

@GMartigny Can you follow the approach done in 2d48704 ? (Asking since #221 is stale, so no point in waiting for that)

@sindresorhus sindresorhus changed the title Prevent the no-import-test rule to crash when imported path is not a string Prevent the no-import-test rule to crash when imported path is not a string May 14, 2019
@GMartigny
Copy link
Contributor Author

Can you follow the approach done in 2d48704 ?

That's what I did. Just, instead of checking twice in ImportDeclaration and CallExpression, I factorized it into createImportValidator.

# Conflicts:
#	rules/no-import-test-files.js
#	test/no-import-test-files.js
@sindresorhus sindresorhus merged commit 1c8ca97 into avajs:master May 18, 2019
@GMartigny GMartigny deleted the preventCrashNoImportTest branch May 21, 2019 10:42
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.

Exception on invalid argument to require.
3 participants