How to Disable Specific Eslint Rules

The create react app eslint presets come with a few rules that are slightly annoying. One of them is jsx-a11y/href-no-hash, which makes sure you don’t add an <a> tag without a valid http address for the href property.

To ignore this, add a .eslintrc.js file at the project root with the following:

module.exports = {
  "parser": "babel-eslint",
  "env": {
    "browser": true
  },
  "rules": {
    "jsx-a11y/anchor-is-valid": "off"
  }
}

Then make sure to reload the vscode window.

Full eslint config file documentation here.

Show Comments

Get the latest posts delivered right to your inbox.