From ddc77314b5a78bd579c662cb2e6dd62eb467c513 Mon Sep 17 00:00:00 2001 From: Dan Seethaler Date: Fri, 3 Nov 2017 15:11:30 -0400 Subject: [PATCH] Fixes #21575 - Use hound to run eslint Adding eslint to hound.yml, fixing lint errors, and adding eslint-plugin-prettier for prettier enforcement. http://projects.theforeman.org/issues/21575 --- .babelrc | 10 ++++++++-- .eslintignore | 3 +++ .eslintrc | 17 +++++++++++++++++ .eslintrc.js | 11 ----------- .hound.yml | 4 +++- engines/bastion_katello/.eslintrc | 3 +++ package.json | 4 ++-- webpack/containers/Application/config.js | 1 + webpack/index.js | 5 ++++- 9 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc delete mode 100644 .eslintrc.js create mode 100644 engines/bastion_katello/.eslintrc diff --git a/.babelrc b/.babelrc index a3b237f049a..a0b12e10742 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,10 @@ { - "presets": ["env", "react"], - "plugins": ["transform-object-rest-spread", "transform-class-properties"] + "presets": [ + "env", + "react" + ], + "plugins": [ + "transform-object-rest-spread", + "transform-class-properties" + ] } diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..84e68d30976 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +# Ignore all files except webpack directory +**/*.js +!webpack/**/*.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000000..1b40b60cc5d --- /dev/null +++ b/.eslintrc @@ -0,0 +1,17 @@ +{ + "env": { + "browser": true, + "jest/globals": true + }, + "extends": [ + "airbnb", + "plugin:jest/recommended" + ], + "plugins": [ + "jest", + "react" + ], + "rules": { + "react/jsx-filename-extension": "off" + } +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 591a9ad4944..00000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - env: { - browser: true, - 'jest/globals': true, - }, - extends: ['airbnb', 'plugin:jest/recommended'], - plugins: ['jest', 'react'], - rules: { - 'react/jsx-filename-extension': 'off', - }, -}; diff --git a/.hound.yml b/.hound.yml index d76f9733efe..a4d071cdee3 100644 --- a/.hound.yml +++ b/.hound.yml @@ -8,6 +8,8 @@ jshint: enabled: false eslint: - enabled: false + enabled: true + config_file: .eslintrc + ignore_file: .eslintignore fail_on_violations: true diff --git a/engines/bastion_katello/.eslintrc b/engines/bastion_katello/.eslintrc new file mode 100644 index 00000000000..c987ae81696 --- /dev/null +++ b/engines/bastion_katello/.eslintrc @@ -0,0 +1,3 @@ +{ + "root": true +} diff --git a/package.json b/package.json index 016254bed45..ca867fa6290 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "test": "jest webpack", "test:watch": "jest webpack --watchAll", "test:current": "jest webpack --watch", - "format": "prettier --single-quote --trailing-comma es5 --write 'webpack/**/*.js' '*.{js,json}'", + "format": "prettier --single-quote --trailing-comma es5 --write 'webpack/**/*.js'", "build": "npm run format && npm run lint", - "lint": "eslint --fix webpack/index.js || exit 0" + "lint": "eslint --fix webpack/ || exit 0" }, "repository": { "type": "git", diff --git a/webpack/containers/Application/config.js b/webpack/containers/Application/config.js index 6ca33dbb7d7..c15169c3943 100644 --- a/webpack/containers/Application/config.js +++ b/webpack/containers/Application/config.js @@ -2,6 +2,7 @@ import Welcome from '../../scenes/Welcome'; import Dashboard from '../../scenes/Dashboard'; import Repos from '../../scenes/Repos'; +// eslint-disable-next-line import/prefer-default-export export const links = [ { text: 'Welcome', diff --git a/webpack/index.js b/webpack/index.js index 7b81d46cc72..37483d81c0e 100644 --- a/webpack/index.js +++ b/webpack/index.js @@ -1,4 +1,7 @@ import { applyMiddleware } from 'redux'; +/* eslint import/no-unresolved: [2, { ignore: [foremanReact/*] }] */ +/* eslint-disable import/no-extraneous-dependencies */ +/* eslint-disable import/extensions */ import componentRegistry from 'foremanReact/components/componentRegistry'; import { mount } from 'foremanReact/common/MountingService'; @@ -10,4 +13,4 @@ componentRegistry.register({ type: ExperimentalUi, }); -mount('xui_katello', '#reactRoot'); \ No newline at end of file +mount('xui_katello', '#reactRoot');