0.3.0-beta.1 • Published 1 year ago

@widcardw/eslint-config-monorepo v0.3.0-beta.1

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

ESLint config

ESLint config preset based on @antfu/eslint-config.

Recently I am trying vue-tsx and solid-js, so this preset includes some jsx presets.

Usage

Install

pnpm i -D eslint @widcardw/eslint-config

Config .eslintrc

{
  "extends": "@widcardw"
}

Config VSCode auto fix

File .vscode/setting.json

{
  "prettier.enable": false,
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

Rules

JSX Opening Element

The eslint-plugin-wix will try to fix the indent of some JSX elements. See the examples below or refer to the tests. If you come to any bug, please report it on issues.

Incorrect

<div style={{ color: 'red' }}
>
  ...
</div>

Correct

<div style={{ color: 'red' }}>
  ...
</div>

Incorrect

<div

/>

Correct

<div />

Incorrect

<div
  style={{ color: 'red' }}>
  ...
</div>

Correct

<div
  style={{ color: 'red' }}
>
  ...
</div>

Incorrect

  ...
    <div
      style={{ color: 'red' }}
      onClick={() => {console.log('You clicked me!')}}

>  {/* <-- This really drives me mad! */}
      ...
    </div>
  ...

Correct

  ...
    <div
      style={{ color: 'red' }}
      onClick={() => {console.log('You clicked me!')}}
    >  {/* <-- Now it is fixed! */}
      ...
    </div>
  ...