@dokduk/eslint-config
v0.0.2
Published
DokDuk's ESLint configuration
Downloads
5
Readme
DokDuk's ESLint config
- Auto fix for formatting (aimed to be used standalone without Prettier)
- Reasonable defaults, best practices, only one line of config
- Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
- ESLint Flat config, compose easily!
- Style principle: Minimal for reading, stable for diff, consistent
- Sorted imports, dangling commas
- Single quotes, no semi
- Using ESLint Stylistic
- Respects .gitignore by default
- Requires ESLint v9.5.0+
Please keep in mind that this is still a personal config with a lot opinions. Changes might not always be pleased by everyone and every use cases.
Usage
ni -D eslint @dokduk/eslint-config
And create eslint.config.mjs
in your project root:
// eslint.config.mjs
import { dokduk } from '@dokduk/eslint-config'
export default dokduk()
IDE Support - Auto fix on save
Install VS Code ESLint extension
Add the following settings to your .vscode/settings.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", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],
// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}