Giter Site home page Giter Site logo

eslint-config's Introduction

eslint-config

Dependency status Dev Dependency status

My own eslint configurations.

Installation

$ npm install --save-dev @atduarte/eslint-config

Usage

First you need to choose the base configuration to use:

  • es5 - The configuration to be used in ECMAScript 5 based projects
  • es6 - The configuration to be used in ECMAScript 6 based projects

Then enhance it with one or more addons:

  • browser - If you are going to develop code for the browser (having in mind IE >= 9)
  • node - If you are going to develop code for NodeJS
  • node-v4-es6 - If you are going to develop code for NodeJS 4.x.x with the es6 base configuration
  • es6-modules - If you are going to use ES6 import & export (must be used with the es6 base configuration)
  • react - If you are going to use React and JSX (requires eslint-plugin-react)

Finally, simply create a .eslintrc.json file with the chosen base configuration and addons. Feel free to override rules you won't agree with. You can look at some examples bellow.

Alternatively, you can make your own configuration by using the set of rules individually. If you're interested in doing that, you can check es5.js to see how it is done.

Examples

Cutting edge ES6 with modules in the browser, using react:

{
    "root": true,
    "extends": [
        "@atduarte/eslint-config/es6",
        "@atduarte/eslint-config/addons/es6-modules",
        "@atduarte/eslint-config/addons/browser",
        "@atduarte/eslint-config/addons/react"
    ]
}

Cutting edge ES6 with modules in NodeJS (requires babel or similar):

{
    "root": true,
    "extends": [
        "@atduarte/eslint-config/es6",
        "@atduarte/eslint-config/addons/es6-modules",
        "@atduarte/eslint-config/addons/node"
    ]
}

Use ES6 in NodeJS without any transpiler:

{
    "root": true,
    "extends": [
        "@atduarte/eslint-config/es6",
        "@atduarte/eslint-config/addons/node"
    ]
}

.. and if you are programming against NodeJS v4 please use:

{
    "root": true,
    "extends": [
        "@atduarte/eslint-config/es6",
        "@atduarte/eslint-config/addons/node"
        "@atduarte/eslint-config/addons/node-v4-es6"
    ]
}

Good old ES5 in NodeJS:

{
    "root": true,
    "extends": [
        "@atduarte/eslint-config/es5",
        "@atduarte/eslint-config/addons/node"
    ]
}

Note that by setting root to true, we ensure that no ancestor configuration is used which also improves eslint performance because no more file lookups need to be done.

File name convention

If your file exports a single class, your filename should be exactly the name of the class. For other cases, the name of the file should be the same as the default exports (prefer camelCase).

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.