This repository was archived by the owner on Aug 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed
Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -65,19 +65,38 @@ var LinkLabel = function() { }
6565class linkLabel { }
6666` ` `
6767
68- All other symbols (methods, variables, even constants) should be camelCased!
68+ Constant values that appear outside of a method scope should be in ALL_CAPS
6969
7070` ` ` javascript
7171// GOOD
72- const defaultName = 'Element'
72+ export DEFAULT_NAME = 'Element'
73+
74+ const STATE_CALLBACKS {
75+ pending: sendPendingResponse,
76+ completed: sendCompletedResponse,
77+ archived: sendArchivedResponse
78+ }
7379
80+ // BAD
81+ class DatePicker {
82+ render() {
83+ // WRONG: constant is within a method
84+ const DEFAULT_VALUE = 0
85+ }
86+ }
87+ ` ` `
88+
89+ All other symbols (methods, variables, constants within a method) should be camelCased!
90+
91+ ` ` ` javascript
92+ // GOOD
7493class MyClass {
7594 const name = 'Button'
7695 render() { ... }
7796}
7897
79- // BAD - ES6 has ` const` now. The compiler/interpreter will warn you if you re-assign a const.
80- const DEFAULT_NAME = 'Element'
98+ // BAD - ` const` outside of a method should be ALL_CAPS
99+ const defaultName = 'Element'
81100```
82101
83102## Overriding Lint Rules
You can’t perform that action at this time.
0 commit comments