-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Coding Guidelines
Sven Efftinge edited this page Feb 25, 2017
·
48 revisions
Use 4 spaces per indentation
- Use PascalCase for
typenames - Use PascalCase for
enumvalues - Use camelCase for
functionandmethodnames - Use camelCase for
propertynames andlocal variables - Use whole words in names when possible
- Use lower case, dash-separated file names (e.g.
document-provider.ts) - Name files after the main Type it exports
- Add architectural types to the file name separated by a dot. (e.g.
file-navigator.plugin.ts) - Do not use "_" as a prefix for private properties
- Do not export
typesorfunctionsunless you need to share it across multiple components - Do not introduce new
typesorvaluesto the global namespace
- Use JSDoc style comments for
functions,interfaces,enums, andclasses
- Use "double quotes" for strings shown to the user that need to be externalized (localized)
- Use 'single quotes' otherwise
- All strings visible to the user need to be externalized
Use undefined, do not use null.
- Use arrow functions
=>over anonymous function expressions - Only surround arrow function parameters when necessary. For example,
(x) => x + xis wrong but the following are correct:
x => x + x
(x,y) => x + y
<T>(x: T, y: T) => x === y- Always surround loop and conditional bodies with curly braces
- Open curly braces always go on the same line as whatever necessitates them
- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:
for (var i = 0, n = str.length; i < 10; i++) { }
if (x < 10) { }
function f(x: number, y: string): void { }- Use a single declaration per variable statement
(i.e. usevar x = 1; var y = 2;overvar x = 1, y = 2;). -
elsegoes on a separate line from the closing curly brace.
Project Management
- Roadmap
- Dev Meetings
- Technical Meetings
- Community Call
- Intellectual Property (IP) guide
- Registering CQs (Deprecated)
Documentation