Git Product home page Git Product logo

eslint-config-oy's Introduction

eslint-config-oy

Shared ESLint config for my projects.
(Lints both JavaScript & TypeScript projects.)

Installation

$ npm install --save-dev eslint-config-oy

Usage

.eslintrc.json in TypeScript project:

{
    "extends": [
        "eslint-config-oy/ts"
    ]
}

.eslintrc.json in JavaScript project:

{
    "extends": [
        "eslint-config-oy"
    ]
}

Evironment Set Up

  • Install eslint extension for VSCode.

  • Add files below in the project's .vscode directory and paste related contents:

    • .vscode/extensions.json:
      {
          "recommendations": [
              "dbaeumer.vscode-eslint"
          ]
      }
    • .vscode/tasks.json:
      {
          "version": "2.0.0",
          "tasks": [
              {
                  "type": "npm",
                  "script": "lint",
                  "problemMatcher": ["$eslint-stylish"],
                  "label": "npm: lint",
                  "detail": ""
              }
          ]
      }
    • .vscode/settings.json:
      {
          "eslint.validate": [
              "typescript",
              "typescriptreact"
          ]
      }

Contributing

  • index.js is eslint config for JavaScript projects.

  • ts.js is eslint config for TypeScript projects; and extends from index.js.

  • If @typescript-eslint has an override rule of an eslint rule; first make sure you turn off the eslint rule in ts.js.

    {
        quotes: "off",
        '@typescript-eslint/quotes': [
            'error',
            'single',
            {
                avoidEscape: true,
                allowTemplateLiterals: true
            }
        ],
    }
  • If a rule works the same way for both JavaScript and TypeScript, add the rule's value (configuration) in _common.js and reference in both index.js and ts.js.

    // _common.js
    {
        QUOTES: [
            'error',
            'single',
            {
                avoidEscape: true,
                allowTemplateLiterals: true
            }
        ],
        // ...
    }
    
    // index.js
    {
        quotes: common.QUOTES,
        // ...
    }
    
    // ts.js
    {
        quotes: 'off',
        '@typescript-eslint/quotes': common.QUOTES,
        // ...
    }

Related projects

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.