Simon Egersand
2017-02-13 9eae924efb6dc1ba33250dcbb834ae4a7c8f4ba2
Run linting for test files too
1 files added
3 files modified
56 ■■■■■ changed files
package.json 2 ●●● patch | view | raw | blame | history
src/DaysView.js 2 ●●● patch | view | raw | blame | history
tests/.eslintrc.js 47 ●●●●● patch | view | raw | blame | history
tests/testUtils.js 5 ●●●●● patch | view | raw | blame | history
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",
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 );
tests/.eslintrc.js
New file
@@ -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 }]
    }
};
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;
    }