diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0bf368aeb2ebf17dc195530b9ccb654560aa526..577bcb9585838c96ecbc30129ac41f642f8ca17e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,16 +68,46 @@ let FooBar; let fooBar; ``` -* JavaScript constants should be `ALLCAPS`. +* Enum members should be `ALLCAPS`. + +```ts +// bad +enum Foo { + bar = 'bar', + Baz = 'baz', +} + +// good +enum Foo { + BAR = 'bar', + BAZ = 'baz', +} +``` + +This also applies to JavaScript objects that are used as enums. ```js // bad -const foo = 'foo'; -const fooBar = 'fooBar'; +/** @enum {string} */ +const foo = { + bar: 'bar', + Baz: 'baz', +} // good -const FOO = 'foo'; -const FOOBAR = 'fooBar'; +/** @enum {string} */ +const foo = { + BAR: 'bar', + BAZ: 'baz', +} + + +// better +/** @enum {string} */ +const Foo = { + BAR: 'bar', + BAZ: 'baz', +} ``` * JavaScript classes and namespaces should be `PascalCase`. diff --git a/js/003-data/constants.js b/js/003-data/constants.js index 96a0787e125cb69614140bc1bb931afc99846b62..e95ba10df9f31684574894f8905bb429146cff05 100644 --- a/js/003-data/constants.js +++ b/js/003-data/constants.js @@ -68,6 +68,7 @@ globalThis.Job = Object.freeze({ TANK: '@lay in tank' }); + /** * @enum {string} */