From d44e65eace24a28f47706b8f203b8ce44d622f74 Mon Sep 17 00:00:00 2001 From: Dawson Botsford Date: Wed, 20 Sep 2017 15:09:54 -0700 Subject: 🎉 init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 21 +++++++++++++++++++++ readme.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 LICENSE create mode 100644 readme.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0ba87be --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Driver + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..5b6912f --- /dev/null +++ b/readme.md @@ -0,0 +1,55 @@ +# Best Practices + +Make your code 💯 - A collection of best practices for software + +## ☕️ JavaScript ☕️ + +* 2 spaces (instead of tabs) +* Lint with `eslint:recommended` at a minimum +* Promises (not callbacks) + +### ⚛️ React/Redux ⚛️ + +* Lint with [`tslint-react`](https://github.com/palantir/tslint-react) or eslint's [`plugin:react/recommended`](https://github.com/yannickcr/eslint-plugin-react) at a minimum. +* No unnecessary and empty `
`’s +* If `this.props.` is used more than once, dereference it at the top of `render`. +* Extract variables used in `render()` to the top of `render()` +* API calls should lie in a testable file outside of components. + +* Components should not wait for promises to resolve, instead listen on props via redux’ `mapStateToProps()`. +* Declare and export components in separate places (otherwise the web inspector cannot name components properly) + +### 𝓣𝓢 TypeScript 𝓣𝓢 + +* Lint with [`tslint:recommended`](https://github.com/palantir/tslint) at a minimum. +* No implicit any (type everything that’s not inferable) +* Any variable declared without an initial value should be typed (`let patientId;`) +* In components which use `mapStateToProps`, separate `ownProps` from `connectedProps` into separate interfaces + +## 💅 CSS 💅 + +* Prefer Flexbox +* Classes should describe elements and not be generic (`Bigbox` -> `FAQContainer`) +* Mobile: <= 620px +* Tablet: 620px - 1024px +* Desktop: > 1024px + +## HTML + +* Use `