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
1 merge request!9364Minor contributing documentation tweaks
......@@ -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`.
......
......@@ -68,6 +68,7 @@ globalThis.Job = Object.freeze({
TANK: '@lay in tank'
});
/**
* @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