Skip to content

Exception on invalid argument to require. #213

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

Closed
coreyfarrell opened this issue Jan 13, 2019 · 2 comments · Fixed by #228
Closed

Exception on invalid argument to require. #213

coreyfarrell opened this issue Jan 13, 2019 · 2 comments · Fixed by #228
Labels
bug 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@coreyfarrell
Copy link

coreyfarrell commented Jan 13, 2019

Issuehunt badges

The following code causes xo to crash:

const something = require(true);

Obviously this is not a valid thing to do, but it should cause eslint to report an error instead of throwing an exception. This is something I found with a test which verifies that my babel plugin does not blow up if a non-string is passed to require. For now I've had to add the test fixture files to xo.ignores in my package.json.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type boolean
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:1085:7)
    at isTestFile (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint-plugin-ava/rules/no-import-test-files.js:9:36)
    at /usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint-plugin-ava/rules/no-import-test-files.js:26:31
    at CallExpression (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint-plugin-ava/rules/no-import-test-files.js:65:5)
    at listeners.(anonymous function).forEach.listener (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/usr/src/npm/babel-plugin-template-html-minifier/node_modules/eslint/lib/util/node-event-generator.js:280:22)
IssueHunt Summary

gmartigny gmartigny has been rewarded.

Sponsors (Total: $20.00)

Tips

@IssueHuntBot
Copy link

@IssueHunt has funded $20.00 to this issue.


Manu1400 added a commit to Manu1400/eslint-plugin-ava that referenced this issue Mar 24, 2019
GMartigny pushed a commit to GMartigny/eslint-plugin-ava that referenced this issue Mar 29, 2019
@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels May 18, 2019
@IssueHuntBot
Copy link

@sindresorhus has rewarded $18.00 to @GMartigny. See it on IssueHunt

  • 💰 Total deposit: $20.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $2.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
3 participants