简体   繁体   English

如何在新的 eslint 配置规范中使用 eslint-config-airbnb?

[英]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 ?eslint-config-airbnb新的 eslint 配置规范一起使用的正确方法是什么?

I tried to import eslint-config-airbnb .我尝试导入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.我试图在上面的配置中的extends部分导入文件。 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.我相信esint-config-airbnb目前与新的 eslint 配置不兼容。

However, you can still use it with the new eslint config through @eslint/eslintrc which is a backward compatibility utility provided by ESLint team.但是,您仍然可以通过@eslint/eslintrc将它与新的 eslint 配置一起使用,这是 ESLint 团队提供的向后兼容实用程序。

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 . eslint 的博客上有一个操作指南https://eslint.org/blog/2022/08/new-config-system-part-2/#backwards-compatibility-utility

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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