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.

Templates identifiers called as functions must include at least one visible character.

See original GitHub issue

Proposal: Templates called as functions must include at least one visible character.


**Context:** Unicode and ES6 support the multiple zero-width characters as variable names (both ID_Start & ID_Continue). Newer editors like Atom don't by default display zero-width characters while other editors like Vim display by default many zero-width characters as Code Point values, but many zero- width chars still sneak by, like Variation Selectors (U+E0100 - U+E01EF).
**When does this rule warn? Please describe and show example code:**

👎 Example of incorrect code for this rule:

var \u{200AD}= evilFunc;  // A single line can be all it takes to subtly call code.

// This template is preceded by a zero-width char,
// executing evilFunc with 'Bar' as a parameter.
𠂭`Bar`

👍 Example of correct code for this rule:

foo𠂭`Bar`  // Still includes an zero-width char, but includes a visible char, so is okay.

`Bar`     // Does not include a zero-width char, so is okay.

**Is this rule preventing an error or is it stylistic?** Security rule.
**Why is this rule a candidate for inclusion instead of creating a custom rule?** It is widely applicable to ES6 users, and can be considered fairly important. The code that developers read must behave predictably.
**Are you willing to create the rule yourself?** Yes.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
michaelficarracommented, Jun 15, 2016

@mysticatea No, it’s not whitespace.

@jagracey Only when the tag is an identifier, of course. But I don’t see any reason to limit this to template tags; grouping parentheses can also lead to covertly calling or constructing a function. You should just have it apply to all identifiers.

0reactions
albertocommented, Aug 1, 2016

Thanks for your interest in improving eslint. Unfortunately, it looks like consensus couldn’t be reached on this issue and so I’m closing it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after 21 days tend never to reach consensus, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function template - cppreference.com
In order to instantiate a function template, every template argument must be known, but not every template argument has to be specified. When...
Read more >
Storing C++ template function definitions in a .CPP file
The problem you describe can be solved by defining the template in the header, or via the approach you describe above. I recommend...
Read more >
Qute Reference Guide - Quarkus
Qute is a templating engine designed specifically to meet the Quarkus needs. The usage of reflection is minimized to reduce the size of...
Read more >
Reference: Templates — Daml SDK 2.5.0 documentation
Each template must have at least one signatory. A signatory declaration consists of the signatory keyword followed by a comma-separated list of one...
Read more >
Custom templates quick start guide | Google Tag Manager ...
Create tag and variable templates. ... Fields are used to enter custom data, such as an account ID. ... The path must consist...
Read more >

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