question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[no-path-concat] overlooks template literals

See original GitHub issue

Tell us about your environment

  • ESLint Version: 6.4.0
  • Node Version: -
  • npm Version: -

What parser (default, Babel-ESLint, etc.) are you using?

Default.

Please show your full configuration: What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Online Demo

/*eslint no-path-concat: error */

const a = __dirname + "/foo.js"
const b = `${__dirname}/foo.js`

What did you expect to happen?

There are two errors:

  • __dirname + "/foo.js"
  • `${__dirname}/foo.js`

What actually happened? Please include the actual, raw output from ESLint.

There is only one error:

  • __dirname + "/foo.js"

The rule doesn’t seem to consider the interpolation of template literals as concatenation.

Are you willing to submit a pull request to fix this bug?

Yes.


Should we pass the rule to eslint-plugin-node plugin?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kaicataldocommented, Sep 28, 2019

👍 to updating the rule’s behavior and am not opposed to deprecating it in core and moving it to eslint-plugin-node. I wonder if it’s worth evaluating whether we should move our other Node-specific rules to the plugin?

1reaction
gabrieldrscommented, Oct 3, 2019

ok, I will work on the tests and fixing the error in the code base today and will open a pr with the changes 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found