From 7fd757cd026ef15c0dfdd4c091e245f45e3c63db Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Wed, 5 Feb 2020 23:41:59 -0500 Subject: [PATCH] Customize eslint, config --- .eslintignore | 1 + .eslintrc.json | 34 ++++++++++++++++++++++++++++++++++ config/webpack.config.js | 9 +-------- package.json | 8 ++++---- 4 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..07ed7069 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +build/* \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..f4a36c03 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,34 @@ +{ + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true, + "modules": true, + "experimentalObjectRestSpread": true + } + }, + "plugins": [ + "react" + ], + "extends": ["eslint:recommended", "plugin:react/recommended"], + "rules": { + "comma-dangle": 0, + "no-unused-vars": "warn", + "no-unexpected-multiline": "warn", + "prefer-const": "warn" + }, + "settings": { + "react": { + "pragma": "React", + "version": "15.6.1" + } + }, + "env": { + "browser": true, + "node": true, + "jasmine": true, + "jest": true + } +} \ No newline at end of file diff --git a/config/webpack.config.js b/config/webpack.config.js index 4022aaac..775dee6f 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -1,5 +1,3 @@ -'use strict'; - const fs = require('fs'); const isWsl = require('is-wsl'); const path = require('path'); @@ -13,9 +11,7 @@ const TerserPlugin = require('terser-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const safePostCssParser = require('postcss-safe-parser'); -const ManifestPlugin = require('webpack-manifest-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); -const WorkboxWebpackPlugin = require('workbox-webpack-plugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent'); @@ -28,10 +24,7 @@ const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const getPackageJson = require('./getPackageJson'); const PrettierPlugin = require("prettier-webpack-plugin"); -const eslint = require('eslint'); - const postcssNormalize = require('postcss-normalize'); - const appPackageJson = require(paths.appPackageJson); // Source maps are resource heavy and can cause out of memory issue for large source files. @@ -65,7 +58,7 @@ const banner = ` ${name} v${version} ${repository.url} - Copyright (c) ${author.replace(/ *\<[^)]*\> */g, " ")} + Copyright (c) ${author.replace(/ *<[^)]*> */g, " ")} This source code is licensed under the ${license} license found in the LICENSE file in the root directory of this source tree. diff --git a/package.json b/package.json index 2bebf7f1..44dd8f12 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@svgr/webpack": "5.1.0", "@typescript-eslint/eslint-plugin": "1.13.0", "@typescript-eslint/parser": "1.13.0", - "babel-eslint": "10.0.3", + "babel-eslint": "^10.0.3", "babel-jest": "^25.1.0", "babel-loader": "8.0.6", "babel-plugin-named-asset-import": "^0.3.6", @@ -78,13 +78,13 @@ "mini-css-extract-plugin": "0.9.0", "optimize-css-assets-webpack-plugin": "5.0.3", "pnp-webpack-plugin": "1.6.0", - "prettier": "^1.19.1", - "prettier-webpack-plugin": "^1.2.0", "postcss-flexbugs-fixes": "4.2.0", "postcss-loader": "3.0.0", "postcss-normalize": "8.0.1", "postcss-preset-env": "6.7.0", "postcss-safe-parser": "4.0.1", + "prettier": "^1.19.1", + "prettier-webpack-plugin": "^1.2.0", "react": "^16.12.0", "react-app-polyfill": "^1.0.6", "react-dev-utils": "^10.1.0", @@ -96,7 +96,7 @@ "style-loader": "1.1.3", "terser-webpack-plugin": "2.3.4", "ts-pnp": "1.1.5", - "uglifyjs-webpack-plugin": "^2.1.2", + "uglifyjs-webpack-plugin": "^2.2.0", "url-loader": "3.0.0", "webpack": "4.41.5", "webpack-dev-server": "3.10.2",