craco-eslint-webpack-plugin
A craco plugin for replacing eslint-loader with eslint-webpack-plugin
Installation
-
Install craco
-
Install
craco-eslint-webpack-plugin
:NPM
npm install craco-eslint-webpack-plugin --save-dev
Yarn
yarn add craco-eslint-webpack-plugin -D
-
Install
eslint-webpack-plugin
&eslint
:NPM
npm install eslint-webpack-plugin eslint --save-dev
Yarn
yarn add eslint-webpack-plugin eslint -D
-
Edit
craco.config.js
:const CracoEslintWebpackPlugin = ;moduleexports =plugins:plugin: CracoEslintWebpackPluginoptions:// See the options description belowskipPreflightCheck: trueeslintOptions:files: 'src/**/*.{js,jsx,ts,tsx}'lintDirtyModulesOnly: true// ...;
Options
-
skipPreflightCheck
eslint-webpack-plugin
requiredeslint
with version^7.5.0
, which doesn't match the version that came with the CRA, and stop you from running the app. Set this option totrue
, will set theSKIP_PREFLIGHT_CHECK=true
, which basically to tell CRA to skip the dependencies version checking. If not, you can always add into your.env
file.
-
eslintOptions