Templates identifiers called as functions must include at least one visible character.
See original GitHub issueProposal: 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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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.