mapbox / mapbox/mapbox-gl-js

Create a consistent convention for getters, setters, and constructor options

Open
#4,029 11 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo: breaking change :warning:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Many attributes of the map have getters, setters, and constructor options (for example, `minZoom`, `getMinZoom`, `setMinZoom` 👍 )

Some have only a subset of the three, even though it would be practical and useful to have all three. (for example, `maxBounds` and `setMaxBounds` exist but `getMaxBounds` does not) (for example, `renderWorldCopies` exists as a constructor option but we do not provide `setRenderWorldCopies` or `getRenderWorldCopies`).

We should do a review of all getters, setters, and constructor options to ensure that

- for every constructor option, there exists a getter
- for every constructor option that could be changed at runtime, there exists a setter
- for every getter that could be set in the constructor, there exists a constructor option
- for every setter, there exists a getter

We may want to create some infrastructure to automatically plumb together constructor options and getters.

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 inventorying the map attributes that expose constructor options, getters, and setters, using the examples in the issue as a guide. Determine which combinations are missing and which options are mutable at runtime. Done means the API follows one documented convention, with any shared plumbing agreed and covered by the repository's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.