3.4.1 • Published 11 months ago

@deviltea/eslint-config v3.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@deviltea/eslint-config

npm

Extends from awesome @antfu/eslint-config, with some personal customizations.

  • Preferred tabs instead of spaces.
    	> According to the [discussion](https://github.com/microsoft/vscode/issues/156304#issue-1318328510), I prefer to use tabs instead of spaces.

The way to customize the rules is the same as @antfu/eslint-config.

Usage

Install

pnpm add -D eslint @deviltea/eslint-config
// eslint.config.mjs
import deviltea from '@deviltea/eslint-config'

export default deviltea()

Add script for package.json

For example:

{
	"scripts": {
		"lint": "eslint .",
		"lint:fix": "eslint . --fix"
	}
}

VS Code support (auto fix)

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" },
		{ "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",
		"javascriptreact",
		"typescript",
		"typescriptreact",
		"vue",
		"html",
		"markdown",
		"json",
		"jsonc",
		"yaml",
		"toml",
		"xml",
		"gql",
		"graphql",
		"astro",
		"css",
		"less",
		"scss",
		"pcss",
		"postcss"
	]
}

Lint Staged

If you want to apply lint and auto-fix before every commit, you can add the following to your package.json:

{
	"simple-git-hooks": {
		"pre-commit": "pnpm lint-staged"
	},
	"lint-staged": {
		"*": "eslint --fix"
	}
}

and then

pnpm add -D lint-staged simple-git-hooks

// to active the hooks
pnpm exec simple-git-hooks
3.4.0

11 months ago

3.3.0

12 months ago

3.4.1

11 months ago

3.2.0

1 year ago

3.1.0

1 year ago

3.0.0

2 years ago

1.1.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.1

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.3

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago