Skip to content

cany748/eslint-config

Repository files navigation

@cany748/eslint-config

ESLint config for JavaScript, TypeScript, Vue 3 / Nuxt 3.

Based on Anthony Fu and Kevin Deng configs.

Usage

Install

pnpm add -D eslint @cany748/eslint-config # JavaScript only
# Or yarn add -D / npm install -D
pnpm add -D eslint @cany748/eslint-config-ts # JavaScript and TypeScript
pnpm add -D eslint @cany748/eslint-config-vue # JavaScript, TypeScript, Vue 3 / Nuxt 3

Config

// `.eslintrc` or `eslintConfig` on `package.json`
{
  "extends": "@cany748"
  // "extends": "@cany748/eslint-config-ts"
  // "extends": "@cany748/eslint-config-vue"
}
// `.prettierrc` or `prettier` on `package.json`
{
  "printWidth": 140
}

You don't need .eslintignore normally as it has been provided by the preset.

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

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

pnpm add -D lint-staged simple-git-hooks

License

MIT License © 2021-PRESENT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published