2.3.3 • Published 7 months ago
eslint-preset-astro v2.3.3
Shareable ESLint preset for astro.
Usage
- Install package:
pnpm add --save-dev eslint eslint-preset-basic eslint-preset-astro
- Create ESLint configuration file
eslint.config.js
:
import { defineFlatConfig, presetBasic } from 'eslint-preset-basic'
import { presetAstro } from 'eslint-preset-astro'
export default defineFlatConfig([
presetBasic({ enableTs: true }),
presetAstro({ enableTs: true }),
// {
// rules: {...}
// }
])
If your project does not specify
"type":"module"
in its package.json file, theneslint.config.js
must be in CommonJS format, such as:
module.exports = (async () => {
const { defineFlatConfig, presetBasic } = await import('eslint-preset-basic')
const { presetAstro } = await import('eslint-preset-astro')
return defineFlatConfig([
presetBasic({ enableTs: true }),
presetAstro({ enableTs: true }),
// {
// rules: {...}
// }
])
})()
- Add script for package.json:
{
"scripts": {
"lint": "eslint .",
}
}
VS Code support
Install VS Code ESLint extension
Add the following settings to your project setting .vscode/settings.json
:
{
// Auto fix
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
},
// Enable the flat config support
"eslint.experimental.useFlatConfig": true,
// Enable eslint for supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"astro"
]
}
Please support this project by simply putting a star.
And, enjoy :)
2.3.0
7 months ago
2.3.2
7 months ago
2.3.1
7 months ago
2.3.3
7 months ago
2.2.2
7 months ago
2.2.1
7 months ago
2.2.0
7 months ago
2.1.1
7 months ago
2.1.0
7 months ago
0.0.1
7 months ago
0.0.0
7 months ago
2.0.3
7 months ago
2.0.2
7 months ago
2.0.1
7 months ago
2.0.0
7 months ago
1.3.1
8 months ago
1.3.0
8 months ago
1.2.6
8 months ago
1.2.5
8 months ago
1.2.4
8 months ago
1.2.3
8 months ago
1.2.2
8 months ago
1.2.1
8 months ago