This project contains STV web interface.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
This mode is intended for UI development purposes only. stv-server is not available in this mode and therefore no server-side computations are available.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
In this mode stv-server is available (it has to be started separately). Use ng build --watch
to enable automatic rebuild on source code changes.
- Don't commit code that does not compile.
- Commits must contain a short message that describes changes.
- Commits should be reasonably small.
- Always review changes before commiting. VS Code has a great diff viewer available under
Ctrl+Shift+G G
shortcut. - Don't commit dead code (commented out code,
if (false) {...}
etc.). - Use
const
instead oflet
whenever possible. Avoidvar
. - Naming: use CamelCase for classes and camelCase for variables/methods. Use English. Names should be descriptive. For example use variable name
firstRenderTimestampMs
rather thant0
. - Indentation: use 4 spaces to keep the code readable. Keep current indentation in lines that contain no code.
- Strings:
- For single-line strings without embedded expressions use double quotation marks:
"
. Example:container.classList.add("withStateLabels"`);
- For multi-line strings and template literals use backticks:
`
. Examples:container.classList.add(`splitter-${orientation}`); const html = ` <div> <stv-example></stv-example> </div> `;
- For single-line strings without embedded expressions use double quotation marks:
- Use semicolons.
- Use spaces around operators. Bad example:
1/1.2
. Good example:1 / 1.2
. - Always use braces and put returns in separate lines:
if (...) { return; }
- If-elseIf-else:
if (...) { ... } else if (...) { ... } else { ... }
- "Todo" comments:
// @todo short description
// @todo XY short description
whereXY
should be replaced by initials of the person that is expected to address the issue.