Configuring ESLint and Prettier in Atom

Install eslint and optional plugins:

npm install -g eslint eslint-plugin-react

Install atom plugins:

linter-eslint
prettier-atom

Create .eslintrc either in the root of your application (or your root path if you want it to be global)

Add simple configuration rules:

{
    "plugins": [
        "react"
    ],
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "env": {
        "es6":     true,
        "browser": true,
        "node":    true,
        "mocha":   true
    },   
    "extends": [
        "eslint:recommended", 
        "plugin:react/recommended"
    ],    
    "rules": {
    }
}

Optionally, update atom prettier-atom to format on save (in plugin settings)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.