1.3.0 • Published 1 year ago

@neuledge/eslint-config v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ESLint Default Config

Initial Setup

  1. Install the package:
pnpm add -D eslint husky lint-staged prettier @neuledge/eslint-config
  1. Create a .eslintrc.json file with the following content:
{
  "extends": "@neuledge",
  "parserOptions": {
    "project": ["./tsconfig.eslint.json", "./packages/*/tsconfig.json"]
  }
}
  1. Create a .prettierrc.json file with the following content:
{
  "singleQuote": true
}
  1. Add the following scripts to your package.json:
{
  "scripts": {
    "fix": "pnpm lint:fix",
    "lint": "eslint . --ext \"js,ts,mjs,cjs\"",
    "lint:fix": "pnpm lint --fix",
    "lint:strict": "pnpm lint --max-warnings 0"
  }
}
  1. Add lint-state to the end of your package.json file:
{
  "lint-staged": {
    "*.{js,ts,mjs,cjs}": "eslint"
  }
}
  1. Install and configure husky:
pnpm husky init
echo 'NODE_OPTIONS="--max_old_space_size=4096" npx --no-save lint-staged' > .husky/pre-commit

Usage

Linting

pnpm lint

Fixing Linting Errors

pnpm fix

Strict Linting

(Best used in CI)

pnpm lint:strict