Skip to content

Commit

Permalink
feat: eslint flat config (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingyue737 committed Mar 22, 2024
1 parent bb44eca commit e4e35f4
Show file tree
Hide file tree
Showing 16 changed files with 247 additions and 176 deletions.
31 changes: 0 additions & 31 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/auto-imports.d.ts
src/components.d.ts
src/typed-router.d.ts
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
}
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules/typescript/lib"
"eslint.experimental.useFlatConfig": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Currently I want to keep this template as light as possible, see [Vitify Admin](
### Coding Style

- [Prettier](https://prettier.io/), single quotes, no semi
- [ESLint](https://eslint.org/) with adapted [@vue/eslint-config-typescript](https://github.com/vuejs/eslint-config-typescript)
- [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
28 changes: 28 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
createConfigForNuxt,
defineFlatConfigs,
} from '@nuxt/eslint-config/flat'
import playwright from 'eslint-plugin-playwright'

export default defineFlatConfigs(
createConfigForNuxt({
dirs: {
// components: ['src/components'], // this will turn off multi-word component name
pages: ['src/pages'],
composables: ['src/composables', 'src/utils'],
layouts: ['src/layouts'],
plugins: ['src/plugins'],
},
}),
{
...playwright.configs['flat/recommended'],
files: ['e2e/**/*.{js,ts,jsx,tsx}'],
},
{
rules: {
'vue/valid-v-slot': ['error', { allowModifiers: true }],
'vue/no-multiple-template-root': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
)
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test:unit": "vitest",
"test:e2e": "playwright test",
"typecheck": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
"lint": "eslint . --fix",
"format": "prettier . --write"
},
"dependencies": {
"@vueuse/core": "^10.9.0",
Expand All @@ -23,21 +23,18 @@
},
"devDependencies": {
"@mdi/js": "^7.4.47",
"@nuxt/eslint-config": "0.3.0-beta.3",
"@pinia/testing": "^0.1.3",
"@playwright/test": "^1.42.1",
"@rushstack/eslint-patch": "^1.8.0",
"@testing-library/vue": "^8.0.3",
"@tsconfig/node20": "^20.1.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.11.30",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-playwright": "^1.5.3",
"eslint-plugin-vue": "^9.23.0",
"eslint-plugin-playwright": "^1.5.4",
"jsdom": "^24.0.0",
"prettier": "^3.2.5",
"rollup-plugin-regexp": "^5.0.1",
Expand Down

0 comments on commit e4e35f4

Please sign in to comment.