mapbox / mapbox/mapbox-gl-js

Relax restriction on "let" expression variable names

Open
#5,231 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cross-platform :tv:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Currently, we only allow `a-zA-Z0-9` and `_` in variable names. This is unnecessarily restrictive and, of course, especially problematic for users of non-Latin alphabets.

We can either:
- expand the set of explicitly allowed characters ( @1ec5 @ChrisLoer do you know if there's a reasonable/practical way to do this that would work across many/most scripts? )
- or instead switch to just _disallowing_ characters that aren't valid in JS identifiers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the parser or validator for `let` expression variable names and compare its current `a-zA-Z0-9` and `_` restriction with JavaScript identifier rules. Decide whether to expand allowed characters or reject invalid JavaScript identifier characters, then verify that names from non-Latin scripts are accepted without allowing invalid identifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.