@neuledge/eslint-config-next

1.1.1 • Public • Published

ESLint Next.js Config

Initial Setup

  1. Install the package:
yarn add -DW eslint husky lint-staged prettier @neuledge/eslint-config-next
  1. Create a .eslintrc.json file with the following content:
{
  "extends": "@neuledge/next",

  "settings": {
    "next": {
      "rootDir": ["path/to/next/project"]
    }
  }
}

Make sure you update the path path/to/next/project to all the root project directories on Next.js.

  1. Create a .prettierrc.json file with the following content:
{
  "singleQuote": true
}
  1. Add the following scripts to your package.json:
{
  "scripts": {
    "prepare": "husky install || echo \"skip husky\"",
    "fix": "yarn lint:fix",
    "lint": "eslint . --ext \"js,jsx,ts,tsx,mjs,cjs\"",
    "lint:fix": "yarn lint --fix",
    "lint:strict": "yarn lint --max-warnings 0"
  }
}
  1. Add lint-state to the end of your package.json file:
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx,mjs,cjs}": "eslint"
  }
}
  1. Install and configure husky:
yarn prepare
yarn husky add .husky/commit-msg 'NODE_OPTIONS="--max_old_space_size=4096" npx --no-save lint-staged'

Usage

Linting

yarn lint

Fixing Linting Errors

yarn fix

Strict Linting

(Best used in CI)

yarn lint:strict

Readme

Keywords

none

Package Sidebar

Install

npm i @neuledge/eslint-config-next

Weekly Downloads

56

Version

1.1.1

License

MIT

Unpacked Size

2.25 kB

Total Files

3

Last publish

Collaborators

  • moshe