Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
SELA-301 Fix eslint errors, add .eslintrc
Browse files Browse the repository at this point in the history
  • Loading branch information
threehams committed May 3, 2016
1 parent 5385f11 commit 5cc54f8
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 9 deletions.
63 changes: 63 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"parser": "babel-eslint",
"rules": {
"comma-dangle": 0,
"no-cond-assign": [2, "always"],
"no-extra-boolean-cast": 0,

"curly": 2,
"default-case": 2,
"eqeqeq": 2,
"no-case-declarations": 2,
"no-else-return": 2,
"no-fallthrough": 2,
"no-redeclare": 2,
"no-warning-comments": [1, { "terms": ["todo"], "location": "start" }],

"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 2,
"no-unused-vars": 2,

"eol-last": 2,
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": { "var": 2, "let": 2, "const": 3}}],
"jsx-quotes": [2, "prefer-double"],
"linebreak-style": [2, "unix"],
"no-trailing-spaces": 1,
"quotes": [2, "double"],
"semi": [2, "always"],

"no-var": 2,
"prefer-const": 2,

"react/display-name": 0
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
},
"plugins": [
"react"
],
"globals": {
"document": true,
"React": true,
"ReactDOM": true,
"window": true,
"describe": true,
"expect": true,
"it": true,
"TestUtils": true,
"sinon": true,
"beforeEach": true,
"afterEach": true,
"before": true,
"after": true
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bugs": "https://github.com/TrueCar/gluestick/issues",
"license": "MIT",
"scripts": {
"lint": "eslint src test templates",
"lint": "./node_modules/.bin/eslint src test templates",
"test": "mocha --compilers js:babel-core/register --require babel-polyfill --recursive",
"test-coverage": "./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover --include-all-sources --report html --dir coverage/html ./node_modules/.bin/_mocha -- --recursive",
"prepublish": "./docker/generate-dockerfile.js",
Expand Down
5 changes: 2 additions & 3 deletions src/commands/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const Server = karma.Server;
const runner = karma.runner;
const karmaConfig = require("../config/karma-config").default;
const spawn = require("cross-spawn").spawn;
const mocha = require("mocha");
const path = require("path");
const CWD = process.cwd();

Expand All @@ -16,13 +15,13 @@ module.exports = function (options) {
// In order to support the Webpack `assets` alias and `src` root, the node path needs to be set up to be
// at the base directory. This allows all module resolves to be relative to the project, rather than to
// Gluestick's CWD.
const mochaEnv = Object.assign({}, process.env, { NODE_PATH: CWD, NODE_ENV: 'test' });
const mochaEnv = Object.assign({}, process.env, { NODE_PATH: CWD, NODE_ENV: "test" });

// Currently defaulting to "dot" reporter and watch. This can be improved to allow a reporter override
// and single-run.
spawn(
path.join(__dirname, "..", "..", "node_modules", ".bin", "mocha"),
["--require", helperPath, "--reporter", "dot", "debug", `${testPath}`, "--watch"],
["--require", helperPath, "--reporter", "dot", `${testPath}`, "--watch"],
{ stdio: "inherit", env: mochaEnv }
);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/testHelperKarma.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global TEST_PATH */
/* global SRC_PATH */
require('./testHelperShared');
require("./testHelperShared");

const context = require.context(TEST_PATH, true, /\.test\.js$/);
context.keys().forEach(context);
Expand Down
8 changes: 4 additions & 4 deletions src/lib/testHelperMocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const IS_WINDOWS = process.platform === "win32";
//
// **ACHTUNG** THIS SHOULD ALWAYS BE RUN BEFORE ANY OTHER REQUIRE()s.
// Cannot use path.join here since it would take a require()!
require('app-module-path').addPath(CWD + (IS_WINDOWS ? '\'' : '/') + 'assets');
require('app-module-path').addPath(CWD + (IS_WINDOWS ? '\'' : '/') + 'src');
require("app-module-path").addPath(CWD + (IS_WINDOWS ? "'" : "/") + "assets");
require("app-module-path").addPath(CWD + (IS_WINDOWS ? "'" : "/") + "src");

require('babel-register');
require("babel-register");

// Set up jsdom for component rendering through Enzyme.
// This code is directly from Enzyme's docs.
Expand Down Expand Up @@ -46,7 +46,7 @@ function noop() {
require.extensions[extension] = noop;
});

require('./testHelperShared');
require("./testHelperShared");

global.expect = require("chai").expect;
global.sinon = require("sinon");

0 comments on commit 5cc54f8

Please sign in to comment.