Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dethdkn/eslint-config

๐Ÿงน My Opinionated ESLint Config
https://github.com/dethdkn/eslint-config

Last synced: about 2 months ago
JSON representation

๐Ÿงน My Opinionated ESLint Config

Awesome Lists containing this project

README

        

@dethdkn/eslint-config


๐Ÿงน My Opinionated ESLint Config



rosa.dev.br


License


Antfu


Gitmoji

## ๐Ÿ“ฆ About This Package
This is my opinionated `eslint-config`, heavily inspired by Antfu's config. This setup is a combination of the following rules:

-
Stylistic
Stylistic

-
Antfu
Antfu

-
Javascript
Javascript

-
Eslint
Unused Imports

-
Eslint
Eslint Comments

-
Node
Node

-
Eslint
Promise

-
Eslint
Security

-
Eslint
JSDoc

-
Eslint
Import X

-
Eslint
Unicorn

-
Perfectionist
Perfectionist

-
Eslint
Regexp

-
Typescript
Typescript

-
Vitest
Vitest

-
Json
Json

-
Vue
Vue

-
TailwindCSS
TailwindCSS

-
TailwindCSS
CSS

-
Nuxt
Nuxt

-
Eslint
Accessibility

-
Eslint
I18n

-
Yaml
Yaml

-
Toml
Toml

- And more...


Click here to check all enabled rules

## ๐Ÿš€ Setup

1. Install with your favorite package manager:
- **pnpm** : `pnpm add -D eslint @dethdkn/eslint-config`
- npm : `npm i -D eslint @dethdkn/eslint-config`
- yarn : `yarn add -D eslint @dethdkn/eslint-config`
- bun : `bun add -D eslint @dethdkn/eslint-config`

2. Create a `eslint.config.mjs` in the project root:
```js
// eslint.config.mjs
import dethdkn from '@dethdkn/eslint-config'

export default dethdkn()
```

3. Add lint scripts to `package.json`:
```json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
```

4. Add the following configuration to `.vscode/settings.json`:
```json
{
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"typescript",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
]
}
```

## โš™๏ธ Options

- `tailwind` and `nuxt` rules can be disabled:
```js
// eslint.config.mjs
import dethdkn from '@dethdkn/eslint-config'

export default dethdkn({tailwind: false, nuxt: false})
```

- `i18n` rules can be enabled:
```js
// eslint.config.mjs
import dethdkn from '@dethdkn/eslint-config'

export default dethdkn({i18n: true})
```

## ๐Ÿ“ License

Copyright ยฉ 2024 [Gabriel 'DethDKN' Rosa](https://github.com/dethdkn)\
This project is under [MIT license](https://github.com/dethdkn/eslint-config/blob/main/LICENSE)