简体   繁体   中英

How to use `eslint-config-airbnb` with the new eslint config spec?

What is the correct way to use eslint-config-airbnb with new eslint config spec ?

I tried to import eslint-config-airbnb . However, the config is not complying with the new spec.

 import airbnb from 'eslint-config-airbnb'; console.log(airbnb); /* this prints { extends: [ '<path_to_repo>/node_modules/eslint-config-airbnb-base/index.js', '<path_to_repo>/node_modules/eslint-config-airbnb/rules/react.js', '<path_to_repo>/node_modules/eslint-config-airbnb/rules/react-a11y.js' ], rules: {} }*/

I tried to import the files in the extends section in the above config. But those files aren't in the new spec either.

I believe esint-config-airbnb is not compatible with the new eslint config at the moment.

However, you can still use it with the new eslint config through @eslint/eslintrc which is a backward compatibility utility provided by ESLint team.

There was a how-to guide on eslint's blog here https://eslint.org/blog/2022/08/new-config-system-part-2/#backwards-compatibility-utility .

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