Git Product home page Git Product logo

eslint-config's Introduction

@trazable/eslint-config

Trazable Standards Semantic Versioning

This project was bootstrapped with Lerna.

@trazable/eslint-config is a collection of useful ESLint configs for much more convenient project developing:

  • ๐Ÿงฉ Modular usage. Easily combine presets for the different technologies.
  • ๐Ÿ”— Almost conflict free.

Here is the example for TypeScript Node project:

// .eslintrc
{
  "extends": [
    "@trazable/eslint-config-patch",
    "@trazable/eslint-config-base",
    "@trazable/eslint-config-typescript",
    "@trazable/eslint-config-node"
  ]
}

Usage

@trazable/eslint-config consists of many ESLint presets. They are designed to work with each other without any conflicts. In most cases, you only need to specify extends and parser fields. @trazable/eslint-config will take care of composing it. There are two basic presets - patch and base. Almost every @trazable/eslint-config preset has some plugins in its dependencies and uses them from there. Default ESLint module resolution behavior doesn't allow doing it this way. The patch preset fixes this problem. It uses @rushstack/eslint-patch under the hood. The base preset encapsulates some base plugins and rules. It is required for using other @trazable/eslint-config presets. The other presets are optional. Select them depending on your goals and project stack. For example, the config for React project:

// .eslintrc
{
  "extends": [
    "@trazable/eslint-config-patch",
    "@trazable/eslint-config-base",
    "@trazable/eslint-config-react",
  ]
}

Presets

  • @trazable/eslint-config-patch
  • @trazable/eslint-config-base
  • @trazable/eslint-config-node
  • @trazable/eslint-config-typescript
  • @trazable/eslint-config-react

Parsers

In most cases, you need @babel/eslint-parser for JavaScript, and @typescript-eslint/parser for Typescript.

Common issues

Errors from @rushstack/eslint-patch

Most often happens in monorepos. Rename your .eslintrc to .eslintrc.js and move patch config in the following way:

// .eslintrc.js
require("@trazable/eslint-config-patch")

module.exports = {
  extends: [
    "@trazable/eslint-config-base",
  ],
  parser: "@babel/eslint-parser",
}

Errors related to "parserOptions.project"

Specify your tsconfig.json location manually:

// .eslintrc
{
  "extends": [
    "@trazable/eslint-config-patch",
    "@trazable/eslint-config-base",
    "@trazable/eslint-config-typescript"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": ["./tsconfig.json"]
  }
}

If it doesn't work, try this:

// .eslintrc.js
const path = require('path')

module.exports = {
  extends: [
    '@trazable/eslint-config-patch',
    '@trazable/eslint-config-base',
    '@trazable/eslint-config-typescript',
  ],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: [path.resolve(__dirname, './tsconfig.json')]
  },
}

Contributing

Documentation

Steps to contribute:

  • Fork the repo.
  • Checkout to a new branch.
  • Make changes, commit them.
  • git push to your fork.
  • Create a pull request into the main repo.

Publish

Documentation

Steps to publish new version to npm:

eslint-config's People

Stargazers

Pablo avatar

Watchers

James Cloos avatar

Forkers

pablogm95

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.