Skip to content

Commit

Permalink
feat: introduce ESLint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
kingyue737 committed Mar 20, 2024
1 parent 6ed1db5 commit f0388a7
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 105 deletions.
14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
### Coding Style

- [Prettier](https://prettier.io/), single quotes, no semi
- [ESLint](https://eslint.org/) with adapted [@nuxt/eslint-config](https://github.com/nuxt/eslint-config)
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) with adapted [@nuxt/eslint](https://github.com/nuxt/eslint), future-proof

### Dev tools

Expand Down
2 changes: 1 addition & 1 deletion components/DialogConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defineExpose({ open })
<v-dialog v-model="dialog" max-width="400px">
<v-card style="z-index: -1">
<v-card-text class="font-weight-bold d-flex">
<v-icon class="mr-2" color="warning"> $warning </v-icon>
<v-icon class="mr-2" color="warning" icon="$warning" />
<span>{{ message }}</span>
</v-card-text>
<v-card-actions>
Expand Down
16 changes: 16 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import nuxt from './.nuxt/eslint.config.mjs'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
...nuxt,
// @nuxt/eslint may disable all stylistic rules by default in the future
// https://github.com/nuxt/eslint/issues/342#issuecomment-2009005053
// remove eslint-config-prettier at that time
eslintConfigPrettier,
{
rules: {
'vue/valid-v-slot': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
]
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default defineNuxtConfig({
'@vueuse/nuxt',
'vuetify-nuxt-module',
'nuxt-auth-utils',
'@nuxt/eslint',
'@nuxt/test-utils/module',
],
css: ['~/assets/styles/index.css'],
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
"generate": "nuxt generate",
"postinstall": "nuxt prepare",
"preview": "nuxt preview",
"prepare": "nuxt prepare",
"typecheck": "nuxt typecheck",
"test": "vitest",
"lint": "eslint . --fix --ignore-path .gitignore"
"lint": "eslint . --fix",
"format": "prettier . --write"
},
"devDependencies": {
"@mdi/js": "^7.4.47",
"@nuxt/devtools": "latest",
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/eslint": "0.3.0-alpha.1",
"@nuxt/test-utils": "^3.12.0",
"@vue/test-utils": "^2.4.5",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"happy-dom": "^13.9.0",
"nuxt": "^3.11.1",
"playwright-core": "^1.42.1",
Expand Down
Loading

0 comments on commit f0388a7

Please sign in to comment.