3.2.0 • Published 15 days ago

@ntnyq/eslint-config v3.2.0

Weekly downloads
14
License
MIT
Repository
github
Last release
15 days ago

eslint-config

Flat ESLint config for JavaScript, TypeScript, Vue 2, Vue 3, Prettier.

CI NPM DOWNLOADS NPM VERSION LICENSE

Features

Install

pnpm add eslint prettier typescript @ntnyq/eslint-config @ntnyq/prettier-config -D

Usage

Highly recommended using eslint.config.mjs as the config file :

import { defineESLintConfig } from '@ntnyq/eslint-config'

export default defineESLintConfig()

Add scripts lint in package.json and config prettier:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  },
  "prettier": "@ntnyq/prettier-config"
}

VSCode Config

{
  "eslint.enable": true,
  "prettier.enable": true,
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "eslint.validate": [
    "vue",
    "html",
    "yaml",
    "toml",
    "json",
    "jsonc",
    "json5",
    "markdown",
    "javascript",
    "typescript",
    "javascriptreact",
    "typescriptreact"
  ]
}

Lint changed files only

1. Add dependencies

pnpm add husky nano-staged -D

2. Config package.json

{
  "scripts": {
    "prepare": "husky"
  },
  "nano-staged": {
    "*.{js,ts,cjs,mjs,jsx,tsx,vue,md,yml,yaml,json,html}": "eslint --fix"
  }
}

3. Add a git hook

echo "nano-staged" > .husky/pre-commit

Advanced config

Check for detail in:

Config interface

export interface ConfigOptions {
  ignores?: ConfigIgnoresOptions

  sort?: boolean | ConfigSortOptions

  command?: boolean | ConfigCommandOptions

  gitignore?: boolean | ConfigGitIgnoreOptions

  imports?: ConfigImportsOptions

  node?: ConfigNodeOptions

  javascript?: ConfigJavaScriptOptions

  typescript?: boolean | ConfigTypeScriptOptions

  unicorn?: boolean | ConfigUnicornOptions

  prettier?: boolean | ConfigPrettierOptions

  perfectionist?: boolean | ConfigPerfectionistOptions

  /**
   * @internal
   */
  unusedImports?: boolean | ConfigUnusedImportsOptions

  /**
   * @internal
   */
  antfu?: boolean | ConfigAntfuOptions

  /**
   * @internal
   */
  ntnyq?: boolean | ConfigNtnyqOptions

  comments?: boolean | ConfigCommentsOptions

  jsdoc?: boolean | ConfigJsdocOptions

  unocss?: boolean | ConfigUnoCSSOptions

  regexp?: boolean | ConfigRegexpOptions

  jsonc?: boolean | ConfigJsoncOptions

  yml?: boolean | ConfigYmlOptions

  markdown?: boolean | ConfigMarkdownOptions

  toml?: boolean | ConfigTomlOptions

  vue?: boolean | ConfigVueOptions

  test?: boolean | ConfigTestOptions
}

Credits

License

MIT License © 2023-PRESENT ntnyq

3.2.0

15 days ago

3.1.2

16 days ago

3.1.1

25 days ago

3.1.0

29 days ago

3.0.2

1 month ago

3.0.1

1 month ago

3.0.0

1 month ago

3.0.0-beta.20

1 month ago

3.0.0-beta.19

1 month ago

3.0.0-beta.18

2 months ago

3.0.0-beta.15

2 months ago

3.0.0-beta.16

2 months ago

3.0.0-beta.17

2 months ago

3.0.0-beta.13

2 months ago

3.0.0-beta.14

2 months ago

3.0.0-beta.11

2 months ago

3.0.0-beta.12

2 months ago

3.0.0-beta.9

2 months ago

3.0.0-beta.8

2 months ago

3.0.0-beta.10

2 months ago

3.0.0-beta.5

2 months ago

3.0.0-beta.7

2 months ago

3.0.0-beta.6

2 months ago

3.0.0-beta.4

3 months ago

2.4.0

5 months ago

2.8.1

3 months ago

2.8.0

3 months ago

3.0.0-beta.1

3 months ago

3.0.0-beta.3

3 months ago

3.0.0-beta.2

3 months ago

2.3.0

5 months ago

2.7.0

4 months ago

2.7.2

4 months ago

2.7.1

4 months ago

2.8.2

3 months ago

2.2.1

5 months ago

2.2.0

5 months ago

2.6.1

4 months ago

2.6.0

4 months ago

2.6.3

4 months ago

2.6.2

4 months ago

2.7.3

4 months ago

2.1.1

5 months ago

2.5.0

4 months ago

2.5.2

4 months ago

2.5.1

4 months ago

2.5.3

4 months ago

2.1.0

5 months ago

2.0.1

7 months ago

2.0.0-beta.28

7 months ago

2.0.0

7 months ago

2.0.0-beta.27

7 months ago

2.0.0-beta.26

7 months ago

1.21.2

8 months ago

1.21.1

8 months ago

1.21.0

8 months ago

2.0.0-beta.25

8 months ago

2.0.0-beta.24

9 months ago

1.20.3

10 months ago

1.20.2

10 months ago

1.20.1

10 months ago

1.20.0

11 months ago

2.0.0-beta.23

12 months ago

1.12.3

1 year ago

1.14.0

1 year ago

1.12.2

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.18.0

1 year ago

1.12.4

1 year ago

2.0.0-beta.22

12 months ago

2.0.0-beta.21

1 year ago

2.0.0-beta.20

1 year ago

2.0.0-beta.15

1 year ago

2.0.0-beta.14

1 year ago

2.0.0-beta.13

1 year ago

2.0.0-beta.12

1 year ago

2.0.0-beta.19

1 year ago

1.11.0

1 year ago

2.0.0-beta.18

1 year ago

2.0.0-beta.17

1 year ago

2.0.0-beta.16

1 year ago

1.15.0

1 year ago

1.13.0

1 year ago

1.11.1

1 year ago

1.19.0

1 year ago

1.17.0

1 year ago

1.10.0

1 year ago

1.8.0

2 years ago

2.0.0-beta.11

1 year ago

2.0.0-beta.10

2 years ago

2.0.0-beta.9

2 years ago

1.7.3

2 years ago

1.9.0

1 year ago

2.0.0-beta.8

2 years ago

2.0.0-beta.7

2 years ago

1.7.2

2 years ago

1.7.1

2 years ago

1.6.2

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.4.2

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

2.0.0-beta.2

2 years ago

2.0.0-beta.1

2 years ago

2.0.0-beta.0

2 years ago

2.0.0-beta.6

2 years ago

2.0.0-beta.5

2 years ago

2.0.0-beta.4

2 years ago

2.0.0-beta.3

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.4.0

3 years ago

0.3.3

3 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago