Skip to content

Basic ESLint setup

Michael Hulse edited this page Mar 10, 2019 · 2 revisions

Install local to your project

$ npm i -D eslint
// This will help you to generate an eslint file:
$ ./node_modules/.bin/eslint --init

Install global on your system

$ npm i -g eslint
$ eslint --init

Example output

$ ./node_modules/.bin/eslint --init
? How would you like to use ESLint? To check syntax and find problems
? What type of modules does your project use? CommonJS (require/exports)
? Which framework does your project use? None of these
? Where does your code run? (Press <space> to select, <a> to toggle all, <i> to invert selection)Browser
? What format do you want your config file to be in? JavaScript
Successfully created .eslintrc.js file in /Users/mhulse/dev/github/mhulse/parallel-image-downloader

Example .eslintrc.js

module.exports = {
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true
    },
    "extends": "eslint:recommended",
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "rules": {
    }
};

Links

Clone this wiki locally