Updated Coding guidelines (markdown)

DanielRosenwasser
2014-12-04 12:01:31 -08:00
parent 668e4939db
commit 810d135c3f

@@ -5,11 +5,12 @@
4. Use camelCase for function names.
5. Use camelCase for property names and local variables.
6. Do not use "_" as a prefix for private properties.
7. Use whole words when possible in names when possible.
## Components
1. 1 file per logical component (e.g. parser, scanner, emitter, checker).
2. Do not add new files. :)
3. files with ".generated" suffix are auto-generated, do not hand edit them.
3. files with ".generated.*" suffix are auto-generated, do not hand-edit them.
## Types
1. Do not export types/functions unless you need to share it across multiple components.
@@ -17,21 +18,21 @@
3. Shared types should be defined in 'types.ts'.
4. Within a file, type definitions should come first.
## Null and undefined:
## `null` and `undefined`:
1. Use **undefined**, do not use null.
## General Assumptions
1. Consider objects like Nodes, Symbols, etc.. as immutable outside the component that created them. Do not change them.
1. Consider objects like Nodes, Symbols, etc. as immutable outside the component that created them. Do not change them.
2. Consider arrays as immutable by default.
## Classes
1. For consistency. do not use classes in the core compiler pipeline. Use function closures instead.
1. For consistency, do not use classes in the core compiler pipeline. Use function closures instead.
## Flags
1. More than 2 Boolean properties on a type should be turned into flags.
## Comments
1. Use JSDoc style comments.
1. Use JSDoc style comments for functions, interfaces, enums, and classes.
## Strings
1. Use double quotes for strings.