3.2.0 • Published 2 months ago

@ntnyq/eslint-config v3.2.0

Weekly downloads
14
License
MIT
Repository
github
Last release
2 months 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

2 months ago

3.1.2

2 months ago

3.1.1

2 months ago

3.1.0

2 months ago

3.0.2

2 months ago

3.0.1

2 months ago

3.0.0

2 months ago

3.0.0-beta.20

2 months ago

3.0.0-beta.19

2 months ago

3.0.0-beta.18

3 months ago

3.0.0-beta.15

3 months ago

3.0.0-beta.16

3 months ago

3.0.0-beta.17

3 months ago

3.0.0-beta.13

3 months ago

3.0.0-beta.14

3 months ago

3.0.0-beta.11

3 months ago

3.0.0-beta.12

3 months ago

3.0.0-beta.9

3 months ago

3.0.0-beta.8

3 months ago

3.0.0-beta.10

3 months ago

3.0.0-beta.5

4 months ago

3.0.0-beta.7

4 months ago

3.0.0-beta.6

4 months ago

3.0.0-beta.4

4 months ago

2.4.0

6 months ago

2.8.1

4 months ago

2.8.0

5 months ago

3.0.0-beta.1

4 months ago

3.0.0-beta.3

4 months ago

3.0.0-beta.2

4 months ago

2.3.0

6 months ago

2.7.0

5 months ago

2.7.2

5 months ago

2.7.1

5 months ago

2.8.2

4 months ago

2.2.1

6 months ago

2.2.0

6 months ago

2.6.1

5 months ago

2.6.0

5 months ago

2.6.3

5 months ago

2.6.2

5 months ago

2.7.3

5 months ago

2.1.1

7 months ago

2.5.0

6 months ago

2.5.2

5 months ago

2.5.1

6 months ago

2.5.3

5 months ago

2.1.0

7 months ago

2.0.1

8 months ago

2.0.0-beta.28

8 months ago

2.0.0

8 months ago

2.0.0-beta.27

8 months ago

2.0.0-beta.26

8 months ago

1.21.2

9 months ago

1.21.1

9 months ago

1.21.0

9 months ago

2.0.0-beta.25

10 months ago

2.0.0-beta.24

10 months ago

1.20.3

11 months ago

1.20.2

11 months ago

1.20.1

12 months ago

1.20.0

1 year ago

2.0.0-beta.23

1 year 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

1 year 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

2 years 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

2 years 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

3 years ago

1.0.2

3 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