Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add eslint config for astro framework #410

Merged
merged 11 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
- Respects `.gitignore` by default
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss) support
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro) support
- Optional [formatters](#formatters) support for CSS, HTML, etc.
- **Style principle**: Minimal for reading, stable for diff, consistent

Expand Down Expand Up @@ -431,6 +431,25 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
npm i -D eslint-plugin-svelte
```

#### Astro

To enable astro support, you need to explicitly turn it on:

```js
// eslint.config.js
import antfu from '@antfu/eslint-config'

export default antfu({
astro: true,
})
```

Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:

```bash
npm i -D eslint-plugin-astro
```

#### UnoCSS

To enable UnoCSS support, you need to explicitly turn it on:
Expand Down
7 changes: 7 additions & 0 deletions fixtures/input/astro.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
const content = "hi!";
---

<article>
<div>{content}</div>
</article>
7 changes: 7 additions & 0 deletions fixtures/output/all/astro.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
const content = 'hi!';
---

<article>
<div>{content}</div>
</article>
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
},
"peerDependencies": {
"@unocss/eslint-plugin": ">=0.50.0",
"astro-eslint-parser": "^0.16.3",
"eslint": ">=8.40.0",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-format": ">=0.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand All @@ -51,6 +53,12 @@
"@unocss/eslint-plugin": {
"optional": true
},
"astro-eslint-parser": {
"optional": true
},
"eslint-plugin-astro": {
"optional": true
},
"eslint-plugin-format": {
"optional": true
},
Expand Down Expand Up @@ -122,9 +130,11 @@
"@types/prompts": "^2.4.9",
"@types/yargs": "^17.0.32",
"@unocss/eslint-plugin": "^0.58.5",
"astro-eslint-parser": "^0.16.3",
"bumpp": "^9.3.0",
"eslint": "npm:eslint-ts-patch@^8.56.0-0",
"eslint-flat-config-viewer": "^0.1.11",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-format": "^0.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
Loading
Loading