From 9eae924efb6dc1ba33250dcbb834ae4a7c8f4ba2 Mon Sep 17 00:00:00 2001
From: Simon Egersand <s.egersand@gmail.com>
Date: Mon, 13 Feb 2017 22:40:03 +0100
Subject: [PATCH] Run linting for test files too

---
 tests/testUtils.js |    5 +++--
 tests/.eslintrc.js |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 package.json       |    2 +-
 src/DaysView.js    |    2 +-
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/package.json b/package.json
index 6f80d49..afcea33 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
     "build:mac": "./node_modules/.bin/gulp",
     "build:win": "./node_modules/.bin/gulp.cmd",
     "dev": "./node_modules/.bin/webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example",
-    "lint": "./node_modules/.bin/eslint src/ DateTime.js",
+    "lint": "./node_modules/.bin/eslint src/ DateTime.js tests/",
     "test": "./node_modules/.bin/jest",
     "test:all": "npm run test:typings && npm run test",
     "test:typings": "./node_modules/.bin/tsc -p ./typings",
diff --git a/src/DaysView.js b/src/DaysView.js
index c2140ac..5cc7ab3 100644
--- a/src/DaysView.js
+++ b/src/DaysView.js
@@ -81,7 +81,7 @@
 			if ( selected && prevMonth.isSame( selected, 'day' ) )
 				classes += ' rdtActive';
 
-			if (prevMonth.isSame( moment(), 'day' ) )
+			if ( prevMonth.isSame( moment(), 'day' ) )
 				classes += ' rdtToday';
 
 			isDisabled = !isValid( currentDate, selected );
diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js
new file mode 100644
index 0000000..10be2b2
--- /dev/null
+++ b/tests/.eslintrc.js
@@ -0,0 +1,47 @@
+module.exports = {
+		"parserOptions": {
+				"ecmaVersion": 6,
+				"sourceType": "module",
+				"ecmaFeatures": {
+						"jsx": true
+				}
+		},
+    "env": {
+        "browser": true
+    },
+    "globals": {
+        "require": true,
+        "module": true
+    },
+    // Enables rules that report common problems,
+    // see http://eslint.org/docs/rules/ for list
+    "extends": "eslint:recommended",
+    "rules": { //TODO: Extend rules in root folder
+        // Enforce the use of variables within the scope they are defined
+        "block-scoped-var": 2,
+        // Enforce camelcase naming convention
+        "camelcase": 2,
+        // Enforce consistent spacing before and after commas
+        "comma-spacing": 2,
+        // Enforce at least one newline at the end of files
+        "eol-last": 2,
+        // Require the use of === and !==
+        "eqeqeq": [2, "smart"],
+        // Enforce consistent spacing before and after keywords
+        "keyword-spacing": [2, { "before": true, "after": true }],
+        // Disallow multiple empty lines
+        "no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 1, "maxBOF": 0 }],
+        // Enforce the consistent use of the radix argument when using parseInt()
+        "radix": 2,
+        // Require or disallow semicolons instead of AS
+        "semi": 2,
+        // Enforce consistent spacing before and after semicolons
+        "semi-spacing": 2,
+        // Enforce consistent spacing before blocks
+        "space-before-blocks": 2,
+        // Enforce consistent spacing inside parentheses
+        // "space-in-parens": [2, "always"],
+        // Enforce the consistent use of either backticks, double, or single quotes
+        "quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }]
+    }
+};
diff --git a/tests/testUtils.js b/tests/testUtils.js
index db230a0..9af50a6 100644
--- a/tests/testUtils.js
+++ b/tests/testUtils.js
@@ -1,9 +1,10 @@
-import React from 'react';
+import React from 'react'; // eslint-disable-line no-unused-vars
 import { mount } from 'enzyme';
-import Datetime from '../DateTime';
+import Datetime from '../DateTime'; // eslint-disable-line no-unused-vars
 
 const simulateClickOnElement = (element) => {
 	if (element.length === 0) {
+		// eslint-disable-next-line no-console
 		console.warn('Element not clicked since it doesn\'t exist');
 		return;
 	}

--
Gitblit v1.9.3