0.2.6 • Published 6 months ago
@thinkbuff/eslint-config v0.2.6
@thinkbuff/eslint-config
Thinkbuff's ESLint config preset
Thanks to antfu/eslint-config for the inspiration and reference.
Usage
- Requires Node.js
>=20
. - Requires ESLint
>=9
.
Install
pnpm i -D eslint @thinkbuff/eslint-config
Create config file (eslint.config.js
)
See the ESLint docs for more information about extending config files.
ES Module (Recommended)
With "type": "module"
in package.json
(recommended):
// eslint.config.js
import { defineFlatConfigAsync } from '@thinkbuff/eslint-config'
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat();
export default defineFlatConfigAsync({
astro: true,
unocss: true,
// Additional ESlint Flat Config
extends: [
{
files: ['src/**/*.ts'],
rules: {
'perfectionist/sort-objects': 'error',
},
},
// Legacy config
...compat.config({
extends: [
'eslint:recommended',
// Other extends...
],
}),
]
}
CommonJS
// eslint.config.js
const { defineFlatConfigAsync } = require('@thinkbuff/eslint-config')
const { FlatCompat } = require('@eslint/eslintrc')
const compat = new FlatCompat()
module.exports = defineFlatConfigAsync({
astro: true,
unocss: true,
// Additional ESlint Flat Config
extends: [
{
files: ['src/**/*.ts'],
rules: {
'perfectionist/sort-objects': 'error',
},
},
// Legacy config
...compat.config({
extends: [
'eslint:recommended',
// Other extends...
],
}),
]
})
Add script for package.json
For example:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
VS Code support
Install VS Code ESLint extension
Add the following settings to your .vscode/settings.json
:
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Enable eslint for supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"astro"
]
}
Maintainer
License
0.2.6
6 months ago
0.2.3
6 months ago
0.2.5
6 months ago
0.2.4
6 months ago
0.2.1
12 months ago
0.2.0
1 year ago
0.2.2
10 months ago
0.1.5
1 year ago
0.1.4
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.3
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago