Add eslint to Canvas

Rollout plan for this:
  1. Add necessary files and plugins to Canvas (this commit)
     - This will do nothing for many people, but those with eslint
       plugins in their editors will now start seeing linting stuff
       show up properly
     - These users can gradually add/remove rules as they see fit or
       where it makes sense.  The default rule set is from Airbnb with
       a few minor modifications to make things less difficult with the
       current codebase.
  2. Turn on warnings in the CI system (this commit + 1-2 months)
     - This would only apply to the diffs of new code
     - This will allow additional feedback from developers that don't
       already lint locally.  Rules can be adjusted as seen fit.
  3. Turn on failures in the CI system (this commit + 3-4 months)
     - Again this will be only for changed code, but at this point will
       start failing builds that don't follow the standards.
     - Changes to the rules can still be made here, but should be less
       frequent than those made in the previous 2 steps.

closes CNVS-32987

Test Plan:
  - Running eslint locally works
  - Editors pick up linting errors when configured properly

Change-Id: I93b7da735b96b472857120418c3c271a9ed6d429
Reviewed-on: https://gerrit.instructure.com/93969
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
Clay Diffrient 2016-10-28 15:58:10 -06:00
parent 4fe20928cb
commit 774ff31bb4
3 changed files with 47 additions and 0 deletions

27
.eslintrc.json Normal file
View File

@ -0,0 +1,27 @@
{
"env": {
"es6": true,
"amd": true
},
"extends": "airbnb",
"parserOptions": {
"ecmaVersion": 7,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"comma-dangle": ["error", "only-multiline"],
"max-len": ["warn", {"code": 140}],
"no-continue": ["off"],
"no-plusplus": ["off"],
"semi": ["off"],
"import/no-amd": ["off"]
}
}

View File

@ -17,6 +17,7 @@
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^7.1.0",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "0.2.1",
"babel-polyfill": "6.13.0",
@ -29,6 +30,11 @@
"compute-cluster": "0.0.9",
"core-js-builder": "^2.4.1",
"ember-template-compiler": "^1.8.0",
"eslint": "^3.9.0",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1",
"exports-loader": "^0.6.2",
"expose-loader": "^0.7.0",
"gglobby": "0.0.3",

View File

@ -0,0 +1,14 @@
{
"env": {
"amd": true,
"qunit": true
},
"globals": {
"module": true,
"test": true,
"equal": true,
"ok": true,
"sinon": true,
"deepEqual": true
}
}