greensuisse
greensuisse

Reputation: 1827

Eslint: use airbnb styles but exclude all jsx-a11y

I would like to use airbnb styles ESLint. However, accessibility does not bring values in my project, and actually it add more noise to the code.

Is there a way to use AirBnb eslint but disable jsx-a11y? I can fork the AirBnb repo and delete the link, but just wonder if there is a better way.

Upvotes: 10

Views: 2733

Answers (3)

formicini
formicini

Reputation: 348

Uninstall eslint-config-airbnb, then install and use eslint-config-airbnb-base, eslint-plugin-react, and eslint-plugin-react-hooks. If you also want TypeScript, install eslint-config-airbnb-typescript as normal. Your eslint config should have changed from:

extends: [
  'airbnb',
  'airbnb-typescript'
]

to:

extends: [
  'eslint:recommended',
  'plugin:react/recommended',
  'plugin:react-hooks/recommended',
  'airbnb-base',
  'airbnb-typescript'
]

Upvotes: 0

AndreFeijo
AndreFeijo

Reputation: 10629

If you are using Typescript, then change:

"extends": [
  "airbnb-typescript"
],

To:

"extends": [
  "eslint-config-airbnb-base",
  "airbnb/rules/react"
],

Upvotes: 1

fotonmoton
fotonmoton

Reputation: 615

In your .eslintrc you can change:

"extends": [
  "airbnb"
]

to

"extends": [
  "airbnb-base",
  "airbnb/rules/react"
]

All credit goes to oustn

Upvotes: 9

Related Questions