From 965dd8bc2f8608dd61f0772f75fa014ffc7c8abb Mon Sep 17 00:00:00 2001 From: Dawson Botsford Date: Fri, 22 Sep 2017 14:30:45 -0700 Subject: add editorconfig and linting commands --- web-examples/.editorconfig | 14 ++++++++++++++ web-examples/readme.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 web-examples/.editorconfig create mode 100644 web-examples/readme.md diff --git a/web-examples/.editorconfig b/web-examples/.editorconfig new file mode 100644 index 0000000..6706680 --- /dev/null +++ b/web-examples/.editorconfig @@ -0,0 +1,14 @@ +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# Matches multiple files with brace expansion notation +# Set default charset +[*] +charset = utf-8 +indent_style = spaces +indent_size = 2 +trim_trailing_whitespace = true diff --git a/web-examples/readme.md b/web-examples/readme.md new file mode 100644 index 0000000..f0c3cdc --- /dev/null +++ b/web-examples/readme.md @@ -0,0 +1,47 @@ +# Web Examples + +Think of these as **highly-recommended** recommendations for web projects at Driver + +## Every Web Project + +1. [Setup your IDE](http://editorconfig.org/) to respect a `.editorconfig` file. +2. Download the `.editorconfig` to your project root. +```sh +$ wget https://raw.githubusercontent.com/drivergroup/best-practices/master/web-examples/.editorconfig +``` + +### JS-Specific + +1. Install eslint +```sh +$ npm install --save-dev eslint +``` +2. Add a `.eslintrc` to the project root + +3. Configure `"lint"` script in `package.json` to lint js files +```json +"scripts": { + "lint": "eslint ." +} +``` + +Ensure tests pass before every Pull Request + +### TypeScript-Specific + +1. Install tslint +```sh +$ npm install --save-dev tslint +``` +2. Add a `tsconfig.json` to the project root + +3. Configure `"lint"` script in `package.json` +```json +"scripts": { + "lint": "tslint --project . --type-check" +} +``` + + + +Ensure tests pass before every Pull Request -- cgit v1.2.3