mapbox / mapbox/mapbox-gl-js

Feature request: remove rules from match expression

Open
#7,895 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Motivation

From my perspective some rules at match expression are unneeded what make the validation slower as needed and the handling complex.

Unneeded rules

Empty Array:

Error: Expected at least one branch label

["match", [id], [], 1,2]

This is clear, only default will use

Same Value:
["match", [id], [1], 1, [1] 2, 3]

This is clear, 2 is never used because 1 comes first

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

The issue names no files, tests, or entry points. Start by locating the match-expression validation and its tests, then verify how empty branch lists and duplicate branch values are handled; done means the requested cases no longer produce unnecessary validation errors or retain unreachable branches.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.