eslint-configurer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

eslint-configurer

This package uses ESLint flat configs

Installation

npm i -D eslint-configurer

Usage

eslint.config.mjs

import { configure } from "eslint-configurer";

export default configure("js", "ts", "react");

API

type Plugin = "js" | "react" | "prettier" | "ts" | "node";

function configure(...plugins: Plugin[]): Array<Record<string, any>>;

Recommended Integrations

.prettierrc

It's recommended to create a .prettierrc configuration file at the source root when using "prettier" preset of this configurer. All configuration file types are supported. A yaml sample provided below: .prettierrc.yaml

trailingComma: es5
tabWidth: 4
singleQuote: false
printWidth: 200
endOfLine: crlf
overrides:
  - files: "*.{ts,tsx}"
    options:
      bracketSameLine: true
      bracketSpacing: true
      cursorOffset: -1
      jsxSingleQuote: true
      printWidth: 80
      semi: true

package.json

This section has dependencies to husky and lint-staged. The following package.json content is a good practice for linting before committing any file.

  "scripts": {
    "lint": "lint-staged",
    "prepare": "husky install && husky add .husky/pre-commit \"npm run lint\""
  },
  "lint-staged": {
    "*.{js,ts,jsx,tsx}": [
      "eslint --fix",
      "eslint"
    ]
  },

Package Sidebar

Install

npm i eslint-configurer

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

14.8 kB

Total Files

17

Last publish

Collaborators

  • ufukbakan