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.

Rule Proposal: no-ascii

See original GitHub issue

Hi everyone. One day my teammate wrote object key with non-ASCII characters. It led to problems with renaming. So I want proposal new rule no-ascii.

When does this rule warn? Please describe and show example code:

// Russian letter `Й`.
var obj = {
  Й: 'value'
};

// Japanese variable.
var 日 = 'Japanese';
日.length; // 8

Is this rule preventing an error or is it stylistic?

In JS there isn’t prohibited non-ASCII characters (it works correctly), but in some projects this is disallowed.

Why is this rule a candidate for inclusion instead of creating a custom rule?

I think it’s global rule for everyone.

Are you willing to create the rule yourself?

I found solution by @fand, but I made some changes.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ilyavolodincommented, Jun 9, 2016

I think this can already be accomplished with id-match rule with the following configuration:

"id-match": ["error", "^[a-zA-Z]*$"]
0reactions
sigorillacommented, Jun 9, 2016

Oh, thank you @ilyavolodin. That’s what I need!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Use of Non-ASCII Characters in RFCs RFC 7997
This document describes the rules under which non-ASCII characters may be used in an RFC. These rules will be applied as the necessary ......
Read more >
The Use of Non-ASCII Characters in RFCs - WaterSprings.ORG
This document describes the rules under which non-ASCII characters may be used in an RFC. These rules will be applied as the necessary ......
Read more >
The Use of Non-ASCII Characters in RFCs
This document describes the rules under which non-ASCII characters may be used in an RFC. These rules will be applied as the necessary...
Read more >
PEP 3131 – Supporting Non-ASCII Identifiers
This PEP suggests to support non-ASCII letters (such as accented characters, Cyrillic, Greek, Kanji, etc.) in Python identifiers.
Read more >
How do you ensure there are no non-ASCII characters in ...
There isn't a rule for it yet. Custom rule. From : https://github.com/palantir/tslint/#writing-custom-rules. The following is one idea:
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