Skip to content

Commit

Permalink
[Lint] Update linter to use babel-lint and lint JSX/React directly
Browse files Browse the repository at this point in the history
- Upgraded eslint
- Installed babel-eslint so that we can parse JSX and ES6
- Installed eslint-react-plugin so we can lint JSX directly w/o a transform
- `no-comma-dangle` was replaced with `comma-dangle`
- `space-unary-word-ops` was replaced with `space-unary-ops`.
  • Loading branch information
ide committed May 16, 2015
1 parent fec8194 commit d5dcc41
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 94 deletions.
33 changes: 30 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"parser": "babel-eslint",

"ecmaFeatures": {
"jsx": true
},

"env": {
"es6": true,
"jasmine": true,
},

"plugins": [
"react"
],

// Map from global var to bool specifying if it can be redefined
"globals": {
"__DEV__": true,
Expand Down Expand Up @@ -35,10 +46,10 @@
},

"rules": {
"comma-dangle": 0, // disallow trailing commas in object literals
"no-cond-assign": 1, // disallow assignment in conditional expressions
"no-console": 0, // disallow use of console (off by default in the node environment)
"no-constant-condition": 0, // disallow use of constant expressions in conditions
"no-comma-dangle": 0, // disallow trailing commas in object literals
"no-control-regex": 1, // disallow control characters in regular expressions
"no-debugger": 1, // disallow use of debugger
"no-dupe-keys": 1, // disallow duplicate keys when creating object literals
Expand Down Expand Up @@ -176,7 +187,7 @@
"space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
"space-infix-ops": 1, // require spaces around operators
"space-return-throw-case": 1, // require a space after return, throw, and case
"space-unary-word-ops": 1, // require a space around word operators such as typeof (off by default)
"space-unary-ops": [1, { "words": true, "nonwords": false }], // require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
"one-var": 0, // allow just one var statement per function (off by default)
"wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default)
Expand All @@ -189,6 +200,22 @@
"max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default)
"max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
"no-bitwise": 1, // disallow use of bitwise operators (off by default)
"no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default)
"no-plusplus": 0, // disallow use of unary operators, ++ and -- (off by default)

"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-quotes": [1, "double", "avoid-escape"],
"react/jsx-no-undef": 1,
"react/jsx-sort-props": 0,
"react/jsx-uses-react": 0,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 0,
"react/no-multi-comp": 0,
"react/no-unknown-property": 0,
"react/prop-types": 0,
"react/react-in-jsx-scope": 0,
"react/self-closing-comp": 1,
"react/wrap-multilines": 0
}
}
84 changes: 0 additions & 84 deletions lint/linterTransform.js

This file was deleted.

5 changes: 0 additions & 5 deletions linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
*/
'use strict';

var transformSource = require('./jestSupport/scriptPreprocess.js').transformSource;
var linterTransform = require('./lint/linterTransform');

linterTransform.setLinterTransform(transformSource);

// Run the original CLI
require('eslint/bin/eslint');
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"debug": "~2.1.0",
"graceful-fs": "^3.0.6",
"image-size": "0.3.5",
"jest-cli": "^0.4.3",
"joi": "~5.1.0",
"jstransform": "11.0.1",
"module-deps": "3.5.6",
Expand All @@ -68,7 +69,8 @@
"yargs": "1.3.2"
},
"devDependencies": {
"jest-cli": "0.4.3",
"eslint": "0.9.2"
"babel-eslint": "^3.1.3",
"eslint": "^0.19.0",
"eslint-plugin-react": "^2.3.0"
}
}

0 comments on commit d5dcc41

Please sign in to comment.