1.3.18 • Published 8 months ago

@kouts/eslint-config v1.3.18

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@kouts/eslint-config

Custom ESLint and Prettier config with Vue.js support and sensible defaults

!NOTE
Starting from v1, this ESLint config uses the ESLint Flat config and is only compatible with ESLint v9 or v8.50.0+.
If you're looking for the previous version, checkout the README here.

Installation

pnpm i -D @kouts/eslint-config eslint prettier

Usage

ESLint config

Add an eslint.config.js (or eslint.config.cjs if your project is CommonJS) that imports the config function:

import { config } from '@kouts/eslint-config'

export default [
  ...config(),
  {
    // Add custom rules here
  },
]

Customizing the config

The configuration comes with default settings that extend the neostandard config config. You can further customize it by passing an object to the config function:

Config settings defaults:

OptionTypeDescriptionDefault
tsbooleanEnable TypeScript supporttrue
noJsxbooleanNo jsx rules will be addedtrue
noStylebooleanNo style rules will be addedtrue
semibooleanUse semicolonsfalse
vuebooleanEnable Vue.js supporttrue
vueVersion2 or 3Specify the version of Vue.js3
vitestbooleanEnable Vitest supporttrue

Example:

config({
  ts: false,
  vue: true
  vueVersion: 3,
  vitest: false,
})

Prettier config

Create a prettier.config.js file with the following content:

import prettierConfig from '@kouts/eslint-config/prettier'

export default prettierConfig

package.json scripts

Add the following ESLint commands to your .package-json for linting and autofixing:

{
  "lint": "eslint \"**/*.{vue,ts,js}\"",
  "lint-fix": "eslint --fix \"**/*.{vue,ts,js}\""
}

VS Code settings

Ad the following settings to your VS Code project settings for autofix on save:

.vscode/settings.json

{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Features

License

MIT

1.3.18

8 months ago

1.3.17

8 months ago

1.3.16

8 months ago

1.3.14

9 months ago

1.3.15

9 months ago

1.3.13

9 months ago

1.3.12

10 months ago

1.3.11

10 months ago

1.3.10

10 months ago

1.3.9

10 months ago

1.3.8

10 months ago

1.3.7

10 months ago

1.3.6

10 months ago

1.3.5

10 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago

1.3.4

10 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

0.0.15

11 months ago

0.0.14

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.3

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago