@kard/esfix

v1.0.2
  • Types
  • ESM
  • CJS

Eslint CLI default configuration and fix utility.

License
MIT
Install Size
-
Vulns
4
Published

Get started

$npm install @kard/esfix
$pnpm add @kard/esfix
$yarn add @kard/esfix
$bun add @kard/esfix
$deno add npm:@kard/esfix
$vlt install @kard/esfix
# Run locally
$npx @kard/esfix
$pnpm exec @kard/esfix
$npx @kard/esfix
$bunx @kard/esfix
$deno run npm:@kard/esfix
$vlx @kard/esfix

Readme

Esfix

Build Status codecov

Table of Content

Installation

npm i --dev @kard/esfix

Or with yarn

yarn add --dev @kard/esfix

Configuration exaple

In the package.json:

  "scripts": {
    "esfix": "esfix"
  },
  "eslintConfig": {
    "files": [ "src/**/*.js", "src/**/*.jsx" ],
    "fix": true
  }

Notes:

  • The eslintConfig section can be used to rewrite all of the eslint options. Please refer to the Configuration File Formats and Rules pages of eslint documentation.

Command line options

--nolocals - Ignore any local configurations of the analyzed projects. Whet this key is presents, the only internal configuration of the package is using.

--dryrun - No fixes are carried out linting is performed and all of its messages are shown. It's like to run eslint without --fix.

--showconfig - Show summarized config. No checks or fixes are carried out in this case.

Troubleshooting

Different indent sizes

It is especially painful when only indent is rewritten in a separate file (for instance: the main configuration is inside .eslintrc.json while rewrite is placed inside package.json)

Error pattern

error: Expected indentation of ... space characters but found ... (react/jsx-indent-props) at ...

...

11 errors and 1 warning found.
11 errors potentially fixable with the `--fix` option.

Solution: make sure that these rules are in sync.

  "rules": {
    "indent": ["error", 2],
    "react/jsx-indent": [ "error", 2 ],
    "react/jsx-indent-props": [ "error", 2 ]
  }