简体   繁体   中英

How to write config file for eslint stylish mode?

I'm using Eslint for a react application. This is a part of my webpack config:

 { enforce: 'pre', test: /\\.(js|jsx)$/, loader: 'eslint-loader', exclude: /node_modules/, options: { formatter: require('eslint/lib/cli-engine/formatters/stylish'), } }, { test: /\\.(js|jsx)$/, use: 'babel-loader', exclude: /node_modules/ } 

I've set stylish as formatter, but when I start my application I get this error :

ERROR in ./src/index.js Module build failed (from ./node_modules/eslint-loader/index.js): Error: No ESLint configuration found in D:\\react\\src.

But apparently stylish is default mode of eslint, but I should create config file ?

What I should write into config file ?

Thanks

This has nothing to do with webpack. Webpack can run eslint as part of the build process to do some logic related to linting, but eslint is a separate program.

As such, it requires its own configuration. Its configuration is in a file called .eslintrc .

Here's how to configure it: Configuring ESLint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM