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 21, 2015
1 parent a1193b7 commit fefcb2d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 93 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 @@ -36,10 +47,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 @@ -177,7 +188,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 @@ -190,6 +201,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": [1, "allow-in-func"],
"react/no-did-update-set-state": [1, "allow-in-func"],
"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');
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
},
"devDependencies": {
"jest-cli": "0.4.5",
"eslint": "0.9.2"
"babel-eslint": "^3.1.6",
"eslint": "^0.21.2",
"eslint-plugin-react": "^2.3.0"
}
}

0 comments on commit fefcb2d

Please sign in to comment.