Skip to content
Snippets Groups Projects
Commit f86d4ca7 authored by DCoded's avatar DCoded
Browse files

Updated documentation to specifiy enums

parent a3a556a4
No related branches found
No related tags found
No related merge requests found
...@@ -68,16 +68,46 @@ let FooBar; ...@@ -68,16 +68,46 @@ let FooBar;
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 ```js
// bad // bad
const foo = 'foo'; /** @enum {string} */
const fooBar = 'fooBar'; const foo = {
bar: 'bar',
Baz: 'baz',
}
// good // good
const FOO = 'foo'; /** @enum {string} */
const FOOBAR = 'fooBar'; const foo = {
BAR: 'bar',
BAZ: 'baz',
}
// better
/** @enum {string} */
const Foo = {
BAR: 'bar',
BAZ: 'baz',
}
``` ```
* JavaScript classes and namespaces should be `PascalCase`. * JavaScript classes and namespaces should be `PascalCase`.
......
...@@ -68,6 +68,7 @@ globalThis.Job = Object.freeze({ ...@@ -68,6 +68,7 @@ globalThis.Job = Object.freeze({
TANK: '@lay in tank' TANK: '@lay in tank'
}); });
/** /**
* @enum {string} * @enum {string}
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment