0.1.4 • Published 9 months ago

@toryz/eslint-config v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@toryz/eslint-config

npm

Refer to @antfu/eslint-config.

Install

# for vue
pnpm add eslint @toryz/eslint-config -D

# for react
pnpm add eslint @toryz/eslint-config-react -D

# for svelte
pnpm add eslint @toryz/eslint-config-svelte -D

Usage

add .eslintrc.json
{
  "root": true,
  "extends": "@toryz",
  "rules": {
    // your custom rules
  }
}

Tips: if you working on react or svelte, please use @toryz/react or @toryz/svelte to instead it.

add scripts in package.json
{
  // ...
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}
VS Code support (auto fix)

Install VS Code ESLint extension

Add the following settings to your settings.json:

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

  // The following is optional.
  // It's better to put under project setting `.vscode/settings.json`
  // to avoid conflicts with working with different eslint configs
  // that does not support all formats.
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "svelte",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yml",
    "yaml"
  ]
}
Lint Staged

If you want to apply lint and auto-fix before every commit, you can add the following to your package.json:

{
  "simple-git-hooks": {
    "pre-commit": "pnpm lint-staged"
  },
  "lint-staged": {
    "*": "eslint --fix"
  }
}

and then

npm i -D lint-staged simple-git-hooks
0.1.4

9 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago