-
Notifications
You must be signed in to change notification settings - Fork 19
JavaScript and HTML Code Style Guide
4 spaces (no tabs)
console.error
and console.warn
are ok but no console.logs
(even if commented out) debugging
On same line except when line continuation and then brace on line by itself outdented to line up with start of original line. Example:
if (curStaging.nStage.coding.displayText.length === 0
&& var1
&& var2
) {
// Code
}
Use let
for variables that will be changing and const
for variables that won't.
Open Question: We need to decide on a singlequote-vs-doublequote-vs-backquote converion.
Open Question: We need to decide on which of these two we prefer in our ES6 code.
Function names are camel case with lower case starting letter
If a function is intended only for use within the class, start it with an underscore then lower case letter
Only spaces after commas in argument list and after close paren but before brace
E.g. getTumorSizeString(curStaging) {
Use public class field syntax for binding functions - ex. handleChange = () => { ... };
Semi-colons should be used at end of every line
Group like imports (e.g., material UI components, react, flux-specific, styling, etc.) but no introductory comment Styling should always be last (import of css)
No compiler warnings. Eliminate runtime warnings as much as possible (may be from a reused component)
First choice is always a CSS file named the same as the react component it styles.
Inline styling is typically required by Material UI components
CSS class names and HTML element ids should use all lowercase with dashes
ES6 Class names camel case starting with cap letter
JIRA: Create linter that can be run manually on selected code files
Make sure all date formatting and parsing is done using moment library instead of custom formatting functions. If you see any legacy cases of this in code you are editing, please replace them or add a JIRA to do it.
Should we be using single quotes vs. double quotes for strings?
Copyright © 2017 The MITRE Corporation | Approved for Public Release; Distribution Unlimited. Case Number 16‑1988
- Home
- About Flux Notes
- Active Treatment Summary Objects
- Data Standards for Breast Cancer
- Database decision
- Declarative Shortcut Format
- Demo Script
- Deployment Plan - Lite Mode
- Dragon Software Information and Troubleshooting
- Flux Notes Lite Demo Script
- How To Create New Shortcuts
- Interaction Between REACT.js Components in Flux
- JavaScript and HTML Code Style Guide
- Key Application Features
- Minimap Evaluation
- Naming Convention for Visual Components
- NLP Server: Provisioning and Troubleshooting
- Pre Release Testing Script
- Profiling and Performance
- Redux Implementation Guide
- Shorthand Context Problem
- Testing
- Third Party Libraries Changes
- Demo Scenarios -- (out of date)