Skip to content

Commit

Permalink
fix(travis): Fail PRs when they have eslint errors (#7715)
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen authored and mergify[bot] committed Dec 17, 2019
1 parent 67dcc9e commit 34ece35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle/buildViaTravis.sh
Expand Up @@ -7,7 +7,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
NODE_JS_VERSION=`node -e 'console.log(require("./package.json").engines.node.replace(/[^\d\.]/g, ""))'`;
nvm use $NODE_JS_VERSION

./node_modules/.bin/karma start --single-run
ESLINT_FAIL_ON_ERROR=true ./node_modules/.bin/karma start --single-run

elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
Expand Down
6 changes: 4 additions & 2 deletions webpack.config.js
Expand Up @@ -12,6 +12,8 @@ const CACHE_INVALIDATE = getCacheInvalidateString();
const NODE_MODULE_PATH = path.join(__dirname, 'node_modules');
const SETTINGS_PATH = process.env.SETTINGS_PATH || './settings.js';
const THREADS = getThreadLoaderThreads();
// Used to fail CI for PRs which contain linter errors
const ESLINT_FAIL_ON_ERROR = process.env.ESLINT_FAIL_ON_ERROR === 'true';

function configure(env, webpackOpts) {
const WEBPACK_MODE = (webpackOpts && webpackOpts.mode) || 'development';
Expand Down Expand Up @@ -121,7 +123,7 @@ function configure(env, webpackOpts) {
{ loader: 'cache-loader', options: { cacheIdentifier: CACHE_INVALIDATE } },
{ loader: 'thread-loader', options: { workers: THREADS } },
{ loader: 'babel-loader' },
{ loader: 'eslint-loader' },
{ loader: 'eslint-loader', options: { failOnError: ESLINT_FAIL_ON_ERROR } },
],
exclude: /(node_modules(?!\/clipboard)|settings\.js)/,
},
Expand All @@ -131,7 +133,7 @@ function configure(env, webpackOpts) {
{ loader: 'cache-loader', options: { cacheIdentifier: CACHE_INVALIDATE } },
{ loader: 'thread-loader', options: { workers: THREADS } },
{ loader: 'ts-loader', options: { happyPackMode: true } },
{ loader: 'eslint-loader' },
{ loader: 'eslint-loader', options: { failOnError: ESLINT_FAIL_ON_ERROR } },
],
exclude: /node_modules/,
},
Expand Down

0 comments on commit 34ece35

Please sign in to comment.