Search code examples
eslinteslint-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?

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.


Solution

  • 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.