@corva/eslint-config-node

6.0.0 • Public • Published

@corva/eslint-config-node

Defines global linting rules for Corva.AI Node.js projects.

Usage

Setup

Generic

npm install husky standard-version -D
npm pkg set scripts.prepare="husky install"
npm pkg set scripts.release="git add -A && standard-version -a"
npm pkg set scripts.release-rc="git add -A && standard-version -a --prerelease rc --skip.changelog"
npm run prepare

Codestyle

# Install
npm i -D @corva/eslint-config-node
# OR
yarn add -D @corva/eslint-config-node

# Add eslint config
echo "module.exports = {'extends': '@corva/eslint-config-node'};" > .eslintrc.js

# Add prettier config
echo "\"@corva/eslint-config-node/prettier\"" > .prettierrc

or add a .eslintrc.js file in the root of your project and extended it with the default config:

module.exports = {
  extends: '@corva/eslint-config-node',
};

and .prettierrc:

"@corva/eslint-config-node/prettier"

Commitlint

Add dependencies:

npm i -D @commitlint/cli @commitlint/config-conventional

Add config:

echo "module.exports = {extends: ['@commitlint/config-conventional']};" > .commitlintrc.js

For husky <=v4 add following in your package.json:

{
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}

For husky >= v5:

npx husky add .husky/commit-msg  'npx --no -- commitlint --edit ${1}'

lint-staged

Add dependencies:

npm i -D lint-staged

Add config to package.json:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  },
  "lint-staged": {
    "*.{js,ts}": "npm run lint:fix"
  }
}

For husky <=v4 add following in your package.json:

{
  "husky": {
    "hooks": {
      "pre-commit": "npx lint-staged"
    }
  }
}

For husky >= v5:

npx husky add .husky/pre-commit  'npx lint-staged'

Readme

Keywords

Package Sidebar

Install

npm i @corva/eslint-config-node

Weekly Downloads

340

Version

6.0.0

License

UNLICENSED

Unpacked Size

7.25 kB

Total Files

4

Last publish

Collaborators

  • aj8k
  • leonid.khomenko
  • suchov
  • vasyl.skalozub
  • andrii.koval
  • yuliiahryhorchuk
  • mgdskr_corva
  • ruslan.shukiurov
  • maksymozymok
  • kostia.khozhay
  • ryandawson
  • bestfit
  • oleksandr_krupko
  • villeti
  • jordanambra
  • dumavit1
  • antonpyrlyk
  • corva-devops-automation