Skip to content

Commit

Permalink
Switch from JSXHint to ESLint + babel and jsx plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrobinson committed Jun 9, 2015
1 parent 46d5d1d commit fcddc3e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 29 deletions.
42 changes: 42 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"parser": "babel-eslint",
"rules": {
"quotes": 0,
"camelcase": 0,
"no-unused-vars": 0,
"eqeqeq": 0,
"key-spacing": 0,
"no-underscore-dangle": 0,
"curly": 0,
"no-use-before-define": 0,
"comma-dangle": 0,
"space-infix-ops": 0,
"no-shadow": 0,
"no-empty": 0,
"no-extra-bind": 0,
"eol-last": 0,
"consistent-return": 0,
"yoda": 0,
"no-multi-spaces": 0,
"no-mixed-spaces-and-tabs": 0,
"no-alert": 0,
"dot-notation": 0,
"space-unary-ops": 0,
"semi": 0,
"no-console": 0,
"global-strict": 0
},
"plugins": [
"react"
],
"ecmaFeatures": {
"jsx": true
},
"globals": {
"angular": false,
"React": false
},
"env": {
"browser": true
}
}
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

5 changes: 2 additions & 3 deletions lint_js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

# Simple shell script for running jshint and nicely formatting the output :heart_eyes_cat:

JS_HINT=./node_modules/jsxhint/cli.js
JS_HINT_OPTS='--babel --es6module --verbose --config .jshintrc'
ESLINT='./node_modules/eslint/bin/eslint.js'
JS_FILES=`find resources/frontend_client/app -name "*.js" | grep -v bower_components | grep -v 'app/test/' | grep -v '\#' | grep -v 'app/dist/'`

BOLD='\033[1;30m'
Expand Down Expand Up @@ -47,7 +46,7 @@ file_modified () {
run_js_lint () {
file=$1
output_file=$2
$JS_HINT $JS_HINT_OPTS $file | perl -pe 's/^.*(line.*)$/$1/' | sort > $output_file
$ESLINT $file | perl -pe 's/^.*(line.*)$/$1/' | sort > $output_file
}

for file in $JS_FILES; do
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
"angular-mocks": "^1.2.28",
"babel": "^5.4.7",
"babel-core": "^5.4.7",
"babel-eslint": "^3.1.14",
"babel-loader": "^5.1.3",
"css-loader": "^0.14.4",
"cssnext-loader": "^1.0.1",
"eslint": "^0.22.1",
"eslint-plugin-react": "^2.5.0",
"extract-text-webpack-plugin": "^0.8.1",
"glob": "^5.0.10",
"http-server": "^0.6.1",
"jsxhint": "0.13.3",
"karma": "~0.10",
"karma-junit-reporter": "^0.2.2",
"ng-annotate-webpack-plugin": "^0.1.2",
Expand Down
11 changes: 2 additions & 9 deletions resources/frontend_client/app/card/card.charting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@
/*jslint browser:true */
/*global document,_,google,console,vs*/

import $ from 'jquery';
import crossfilter from 'crossfilter';
import d3 from 'd3';
import dc from 'dc';

// JSXHint workarounds: https://github.com/STRML/JSXHint/issues/69
import _$ from 'jquery';
var $ = _$;
import _crossfilter from 'crossfilter';
var crossfilter = _crossfilter;

// var crossfilter = require('crossfilter');
// var $ = require('jquery');

// ---------------------------------------- TODO - Maybe. Lots of these things never worked in the first place. ----------------------------------------
// IMPORTANT
// - 'titles' (tooltips)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
'use strict';

/*global window,moment*/
/*global window*/

// import compiled version, webpack doesn't seem to be running JSX transforms on node_modules
// css imported in init.css
import DatePicker from 'react-datepicker';
import Tether from 'tether';
import moment from 'moment';

// DatePicker depedencies :(
window.Tether = require('tether');
window.moment = require('moment');
window.Tether = Tether;
window.moment = moment;

export default React.createClass({
displayName: 'DateFilter',
Expand Down

0 comments on commit fcddc3e

Please sign in to comment.