Skip to content

Instantly share code, notes, and snippets.

@nrl240
Last active March 8, 2021 22:48
Show Gist options
  • Save nrl240/6ed38d7f32cdbcfb9dcecca8cc0ca510 to your computer and use it in GitHub Desktop.
Save nrl240/6ed38d7f32cdbcfb9dcecca8cc0ca510 to your computer and use it in GitHub Desktop.
ESLint Reconfiguration

Reconfiguring ESLint to break free of Airbnb

Needless to say, Airbnb is top tier when it comes to developer contributions. Much of the industry has adopted Airbnb's JavaScript Style Guide. However, perhaps the style guide is too restrictive at this point in your coding journey.

NPM Installations

  • Removing node modules
    • In your terminal, run npm uninstall -g eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react-hooks
  • Checking list of globally installed node modules
    • In your terminal run, npm list -g --depth 0 and confirm that the following are in the list:
      ├── [email protected]
      ├── [email protected]
      
    • If there are any other eslint-related node modules in the list, please uninstall them:
      • Pay attention, the last argument of the command below should be replaced
        • npm uninstall -g paste-node-module-name-without-the-version-here
    • If you are missing either of the two aforementioned node modules, please install them:

ESLint configuration

  • Edit the .eslintrc.json file
    • Open the file: code ~/.eslintrc.json
    • Replace the entire contents of the file with the following JSON:
      {
        "extends": "eslint:recommended",
        "env": {
          "browser": true,
          "node": true,
          "mocha": true,
          "es6": true
        },
        "plugins": ["react"],
        "parserOptions": {
          "ecmaVersion": 2018,
          "sourceType": "module",
          "ecmaFeatures": {
            "jsx": true
          }
        },
        "rules": {
          "linebreak-style": 0,
          "no-console": "off"
        }
      }
    • Don't forget to save the file before you close it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment