Code Monkey home page Code Monkey logo

eslint-config's Introduction

@rgrove/eslint-config

These are my personal ESLint configs. There are many like them, but these ones are mine.

You're welcome to extend my configs and use them for your own projects, but be warned: my preferences change from time to time, and these configs will change with them.

Please don't ask me to change these configs to suit your preferences. Just override them in your own configs, or don't use them.

Installation

npm

npm i --save-dev @rgrove/eslint-config

pnpm

pnpm add --save-dev --config.auto-install-peers=true @rgrove/eslint-config

Usage

To use the primary config, add an extends property to your .eslintrc.js (or wherever you've chosen to configure ESLint), like this:

module.exports = {
  extends: '@rgrove/eslint-config'
};

You can extend multiple configs using an array:

module.exports = {
  extends: [
    '@rgrove/eslint-config',
    '@rgrove/eslint-config/browser',
    '@rgrove/eslint-config/modules',
    '@rgrove/eslint-config/react'
  ]
};

When extending multiple configs, always extend @rgrove/eslint-config first, since it defines baseline rules that other configs may override.

See the documentation for ESLint's extends property for more details.

Available Configs

@rgrove/eslint-config

This is the base config. It defines parser options and rules that are relevant in all modern JS environments, and doesn't assume the use of any particular module system.

When extending multiple configs, this one should always be first.

@rgrove/eslint-config/browser

Defines parser options and rules specific to modern browser JS.

@rgrove/eslint-config/commonjs

Defines parser options and rules specific to CommonJS modules.

@rgrove/eslint-config/modules

Defines parser options and rules specific to ES modules.

@rgrove/eslint-config/node

Defines parser options and rules specific to modern Node.js.

@rgrove/eslint-config/react

Defines parser options and rules specific to React.

@rgrove/eslint-config/typescript

Defines parser options and rules specific to TypeScript.

Using an alternative parser

These configs use ESLint's default parser. If you're using (for example) Babel to transpile language features that aren't yet part of the ECMAScript standard, ESLint may not be able to parse them, and you may see parsing errors when you run ESLint.

To fix this, you may need to specify an alternative parser such as babel-eslint in your ESLint config:

module.exports = {
  parser: 'babel-eslint',

  extends: [
    '@rgrove/eslint-config',
    '@rgrove/eslint-config/browser',
    '@rgrove/eslint-config/modules',
    '@rgrove/eslint-config/react'
  ]
};

You'll need to install and properly configure babel-eslint (or whatever alternative parser you use) as a dependency of your own project.

eslint-config's People

Contributors

dependabot[bot] avatar rgrove avatar

Watchers

 avatar  avatar  avatar

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.