@em-and-ai/eslint-config-server

1.0.1 • Public • Published

Eslint configuration for ExpressJs

This package extends Airbnb's base JS .eslintrc (without React plugins) as an extensible shared configuration.

Installation

npm install --save-dev @em-and-ai/eslint-config-server

Usage

  • First of all, you need to install Eslint:
npm install --save-dev eslint
  • Next step, you need to install Airbnb-base and Import Plugin:
npm install --save-dev eslint-config-airbnb-base
npm install --save-dev eslint-plugin-import@latest
  • Create eslint configuration file (.eslintrc) by yourself or by the following command:
npm init @eslint/config
  • Because this package base on Airbnb-base, so you need to extend Airbnb-base first and then extend this package:
    "extends": [
        "airbnb-base",
        "@em-and-ai/server"
    ]
  • To check eslint, you need to add line in your package.json:
  "scripts": {
    "lint": "eslint --ext .js ."
  }
  • If you want to add more script to auto fix. You need to add --fix flag like this:
  "scripts": {
    "lint": "eslint --ext .js .",
    "lint:fix": "eslint --fix --ext .js ."
  }

Integration

You can integrate this ESLint configuration with Husky.

  • First of all, enable Git hooks:
npx husky install
  • Then, you can create a hook to check Eslint before commit:
npx husky add .husky/pre-commit "npm run lint"

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i @em-and-ai/eslint-config-server

    Weekly Downloads

    8

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    6.6 kB

    Total Files

    4

    Last publish

    Collaborators

    • emandaijsc
    • thinh.le_emandai.net
    • hung.hoang_emandai.net
    • truong.nguyen2k
    • hoang.le_emandai.net