Skip to content

Commit 774ff31

Browse files
committed
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>
1 parent 4fe2092 commit 774ff31

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

.eslintrc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"amd": true
5+
},
6+
"extends": "airbnb",
7+
"parserOptions": {
8+
"ecmaVersion": 7,
9+
"ecmaFeatures": {
10+
"experimentalObjectRestSpread": true,
11+
"jsx": true
12+
},
13+
"sourceType": "module"
14+
},
15+
"parser": "babel-eslint",
16+
"plugins": [
17+
"react"
18+
],
19+
"rules": {
20+
"comma-dangle": ["error", "only-multiline"],
21+
"max-len": ["warn", {"code": 140}],
22+
"no-continue": ["off"],
23+
"no-plusplus": ["off"],
24+
"semi": ["off"],
25+
"import/no-amd": ["off"]
26+
}
27+
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"devDependencies": {
1818
"babel-cli": "^6.10.1",
1919
"babel-core": "^6.10.4",
20+
"babel-eslint": "^7.1.0",
2021
"babel-loader": "^6.2.4",
2122
"babel-plugin-add-module-exports": "0.2.1",
2223
"babel-polyfill": "6.13.0",
@@ -29,6 +30,11 @@
2930
"compute-cluster": "0.0.9",
3031
"core-js-builder": "^2.4.1",
3132
"ember-template-compiler": "^1.8.0",
33+
"eslint": "^3.9.0",
34+
"eslint-config-airbnb": "^12.0.0",
35+
"eslint-plugin-import": "^1.16.0",
36+
"eslint-plugin-jsx-a11y": "^2.2.3",
37+
"eslint-plugin-react": "^6.4.1",
3238
"exports-loader": "^0.6.2",
3339
"expose-loader": "^0.7.0",
3440
"gglobby": "0.0.3",

spec/javascripts/.eslintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"amd": true,
4+
"qunit": true
5+
},
6+
"globals": {
7+
"module": true,
8+
"test": true,
9+
"equal": true,
10+
"ok": true,
11+
"sinon": true,
12+
"deepEqual": true
13+
}
14+
}

0 commit comments

Comments
 (0)