Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 1.03 KB

README.md

File metadata and controls

71 lines (50 loc) · 1.03 KB

@singularit/eslint-config-typescript npm

Usage

Install

npm install eslint @singularit/eslint-config-typescript -D

Config .eslintrc.js

module.exports = {
    extends: "@singularit"
}

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Githooks with husky and lint-staged

  1. Install and setup husky
npx husky-init && npm install
  1. Add lint-staged to pre-commit hook
# .husky/pre-commit

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

- npm test
+ npx lint-staged
  1. Configure lint-staged
// package.json
{
  ...
+ "lint-staged": {
+   "*.{js,jsx,ts,tsx,md,yml,yaml}": "eslint --fix --max-warnings 0"
+ }
  ...
}

License

MIT

Credits