airbnb / airbnb/javascript

Incorrect constant export example

Open
#3,032 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

> _What about all const variables? - This is unnecessary, so uppercasing should not be used for constants within a file. **It should be used for exported constants however.**_

There are two points:

1. Based on the above description the provided example appears incorrect
2. Also, Since const variables can't be changed through reassignment, this example (i.e., variable name) feels odd.

Current example:
```
// bad
export const THING_TO_BE_CHANGED = 'should obviously not be uppercased';
```

Perhaps it could be:
```
// bad
export const some_exported_constant = 'should obviously be uppercased';
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the JavaScript style guide section covering constant naming and locate the example quoted in this issue. Review the surrounding wording and update the example so it consistently distinguishes file-local constants from exported constants; the issue is done when the guidance and code sample no longer contradict each other.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.