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

Conflict with ESLint quotes "backtick" #27

Closed
fxedel opened this issue Jan 18, 2018 · 2 comments
Closed

Conflict with ESLint quotes "backtick" #27

fxedel opened this issue Jan 18, 2018 · 2 comments

Comments

@fxedel
Copy link

fxedel commented Jan 18, 2018

In our project, we decided to always use template literals with backticks instead of normal quotes as Template Literals are Strictly Better Strings. So we want to use const str = `text`; instead of const str = 'text';. See our issue on that topic.

Unfortunately, this plugin conflicts with that rule:

const fs = require('fs'); // error by ESLint's quotes rule
const fs = require(`fs`); // warning by this plugin's detect-non-literal-require rule
// -> No possibility to use require without errors/warnings

All rules enforcing a literal usage pass with single ticks and fail with back ticks, without respecting whether or not the template string does actually contain variables.

The rules actually check the argument's type to be 'Literal' (rules/detect-non-literal-require.js#L18), maybe it's possible to also check to case that the argument is non-literal, but is a template string doesn't containing any variables?

@jesusprubio
Copy link
Contributor

Summary
False positive with requires if using backticks as literal.

Still relevant?
Yes.

Next steps

@ota-meshi
Copy link
Member

I believe it is fixed in v1.5.0.

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

No branches or pull requests

3 participants