From ce3f63eaae64ddc7213bc0bdbe3e1eb830e847b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Fri, 16 Jun 2017 23:01:06 +0100 Subject: [PATCH] fix(joyent-cp-frontend): patch react-scripts to use eslintrc --- .gitignore | 2 -- packages/cp-frontend/.eslintrc | 4 +++- .../scripts/patch-webpack-config.js | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4864a639..54acbdde 100644 --- a/.gitignore +++ b/.gitignore @@ -159,5 +159,3 @@ packages/*/dist packages/*/buid packages/ui-toolkit/styleguide/ packages/*/package-lock.json - -/packages/ui-toolkit/styleguide/index.html diff --git a/packages/cp-frontend/.eslintrc b/packages/cp-frontend/.eslintrc index b17555dc..2b67b7bc 100644 --- a/packages/cp-frontend/.eslintrc +++ b/packages/cp-frontend/.eslintrc @@ -2,6 +2,8 @@ "extends": "joyent-portal", "rules": { "no-console": 0, - "new-cap": 0 + "new-cap": 0, + // temp + "no-undef": 1 } } diff --git a/packages/cp-frontend/scripts/patch-webpack-config.js b/packages/cp-frontend/scripts/patch-webpack-config.js index 63e2a445..cc38fa95 100644 --- a/packages/cp-frontend/scripts/patch-webpack-config.js +++ b/packages/cp-frontend/scripts/patch-webpack-config.js @@ -10,6 +10,29 @@ module.exports = config => { config.module.rules = config.module.rules .reduce((loaders, loader, index) => { + if (Array.isArray(loader.use)) { + return loaders.concat([ + Object.assign(loader, { + use: loader.use.map(l => { + if (isString(l) || !isString(l.loader)) { + return l; + } + + if (!l.loader.match(/eslint-loader/)) { + return l; + } + + return Object.assign(l, { + options: Object.assign(l.options, { + baseConfig: null, + useEslintrc: true + }) + }); + }) + }) + ]); + } + if (!isString(loader.loader)) { return loaders.concat([loader]); }