Skip to content

Commit

Permalink
build(dev,proxy): ent-3643 eslint webpack plugin (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Sep 15, 2021
1 parent a8aba88 commit 2fb3e48
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ DEV_BRANCH=ci-beta

REACT_APP_ENV=development

REACT_APP_CONFIG_SERVICE_LOCALES=/locales/locales.json
REACT_APP_CONFIG_SERVICE_LOCALES_PATH=/locales/{{lng}}.json

REACT_APP_SERVICES_RHSM_VERSION=http://localhost:5000/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/
REACT_APP_SERVICES_RHSM_CAPACITY=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/
Expand Down
12 changes: 12 additions & 0 deletions config/build.plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { join, resolve } = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const fedModulePlugin = require('@redhat-cloud-services/frontend-components-config/federated-modules');
const { setupWebpackDotenvFilesForEnv } = require('./build.dotenv');

Expand All @@ -21,6 +22,7 @@ const setCommonPlugins = () => {
const DIST_DIR = process.env._BUILD_DIST_DIR;
const DOTENV_ENV = process.env.REACT_APP_ENV;
const RELATIVE_DIRNAME = process.env._BUILD_RELATIVE_DIRNAME;
const SRC_DIR = process.env._BUILD_SRC_DIR;
const STATIC_DIR = process.env._BUILD_STATIC_DIR;

const plugins = [
Expand All @@ -31,6 +33,16 @@ const setCommonPlugins = () => {
fedModulePlugin({ root: RELATIVE_DIRNAME })
];

// Development plugins
if (NODE_ENV === 'development' || NODE_ENV === 'review') {
plugins.push(
new ESLintPlugin({
context: SRC_DIR,
failOnError: false
})
);
}

// Save 20kb of bundle size in prod
if (NODE_ENV === 'production') {
plugins.push(new webpack.NormalModuleReplacementPlugin(/redux-logger/, resolve(__dirname, './build.empty.js')));
Expand Down
2 changes: 1 addition & 1 deletion config/spandx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {string} params.BETA_PREFIX
* @returns {object}
*/
const setProxyRoutes = ({ DEV_PORT, BETA_PREFIX }) => ({
const setProxyRoutes = ({ DEV_PORT, BETA_PREFIX = '' }) => ({
routes: {
'/locales': {
host: `https://localhost:${DEV_PORT}${BETA_PREFIX}/apps/subscriptions`
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-webpack-plugin": "^3.0.1",
"express": "^4.17.1",
"glob": "^7.1.7",
"jest": "27.0.6",
Expand Down
13 changes: 12 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@
"@types/eslint" "*"
"@types/estree" "*"

"@types/eslint@*":
"@types/eslint@*", "@types/eslint@^7.2.14":
version "7.28.0"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.28.0.tgz#7e41f2481d301c68e14f483fe10b017753ce8d5a"
integrity sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==
Expand Down Expand Up @@ -5188,6 +5188,17 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==

eslint-webpack-plugin@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/eslint-webpack-plugin/-/eslint-webpack-plugin-3.0.1.tgz#0990a80e9d5927e7e68365f93426cb340679e88c"
integrity sha512-PAHHDjCg2yWBNoiBPYLZWcv+M83urkslQKER7XvK84lo5YLcihJK6qwnCH2Fkt3eVdX+G1iyGZRlKsIhTiczHw==
dependencies:
"@types/eslint" "^7.2.14"
jest-worker "^27.0.6"
micromatch "^4.0.4"
normalize-path "^3.0.0"
schema-utils "^3.1.0"

eslint@7.32.0:
version "7.32.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d"
Expand Down

0 comments on commit 2fb3e48

Please sign in to comment.