ESLint9
This commit is contained in:
@ -1,18 +0,0 @@
|
|||||||
/* eslint-env node */
|
|
||||||
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: [
|
|
||||||
'plugin:vue/vue3-essential',
|
|
||||||
'eslint:recommended',
|
|
||||||
'@vue/eslint-config-typescript',
|
|
||||||
'@vue/eslint-config-prettier/skip-formatting',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'vue/multi-word-component-names': 'off',
|
|
||||||
},
|
|
||||||
};
|
|
43
eslint.config.mjs
Normal file
43
eslint.config.mjs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { includeIgnoreFile } from '@eslint/compat';
|
||||||
|
import pluginVitest from '@vitest/eslint-plugin';
|
||||||
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
||||||
|
import vueTsEslintConfig from '@vue/eslint-config-typescript';
|
||||||
|
import pluginVue from 'eslint-plugin-vue';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const gitignorePath = path.resolve(__dirname, '.gitignore');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type import('eslint').Linter.Config[]
|
||||||
|
*/
|
||||||
|
export default [
|
||||||
|
// --ignore-path .gitignore
|
||||||
|
includeIgnoreFile(gitignorePath),
|
||||||
|
{
|
||||||
|
name: 'app/files-to-lint',
|
||||||
|
files: ['**/*.{ts,mts,tsx,vue}'],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'app/files-to-ignore',
|
||||||
|
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
|
||||||
|
},
|
||||||
|
|
||||||
|
...pluginVue.configs['flat/essential'],
|
||||||
|
...vueTsEslintConfig(),
|
||||||
|
|
||||||
|
{
|
||||||
|
...pluginVitest.configs.recommended,
|
||||||
|
files: ['src/**/__tests__/*'],
|
||||||
|
},
|
||||||
|
skipFormatting,
|
||||||
|
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
];
|
15
package.json
15
package.json
@ -11,7 +11,7 @@
|
|||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
"type-check": "vue-tsc --build --force",
|
"type-check": "vue-tsc --build --force",
|
||||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
"lint": "eslint . --fix",
|
||||||
"format": "prettier --write src/",
|
"format": "prettier --write src/",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"dev+preview": "bunx dev-and-preview@1.0.0",
|
"dev+preview": "bunx dev-and-preview@1.0.0",
|
||||||
@ -57,11 +57,11 @@
|
|||||||
"vue-router": "^4.4.5"
|
"vue-router": "^4.4.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/compat": "^1.2.0",
|
||||||
"@faker-js/faker": "^9.0.3",
|
"@faker-js/faker": "^9.0.3",
|
||||||
"@iconify-json/carbon": "^1.2.2",
|
"@iconify-json/carbon": "^1.2.2",
|
||||||
"@iconify/utils": "^2.1.33",
|
"@iconify/utils": "^2.1.33",
|
||||||
"@playwright/test": "^1.48.0",
|
"@playwright/test": "^1.48.0",
|
||||||
"@rushstack/eslint-patch": "^1.10.4",
|
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
"@types/jsdom": "^21.1.7",
|
"@types/jsdom": "^21.1.7",
|
||||||
"@types/node": "^22.7.5",
|
"@types/node": "^22.7.5",
|
||||||
@ -72,14 +72,15 @@
|
|||||||
"@vant/auto-import-resolver": "^1.2.1",
|
"@vant/auto-import-resolver": "^1.2.1",
|
||||||
"@vitejs/plugin-vue": "^5.1.4",
|
"@vitejs/plugin-vue": "^5.1.4",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||||
"@vue/eslint-config-prettier": "^9.0.0",
|
"@vitest/eslint-plugin": "^1.1.7",
|
||||||
"@vue/eslint-config-typescript": "^13.0.0",
|
"@vue/eslint-config-prettier": "^10.0.0",
|
||||||
|
"@vue/eslint-config-typescript": "^14.0.1",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/tsconfig": "^0.5.1",
|
"@vue/tsconfig": "^0.5.1",
|
||||||
"depcheck": "^1.4.7",
|
"depcheck": "^1.4.7",
|
||||||
"eruda": "^3.4.0",
|
"eruda": "^3.4.0",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^9.12.0",
|
||||||
"eslint-plugin-vue": "^9.28.0",
|
"eslint-plugin-vue": "^9.29.0",
|
||||||
"husky": "^9.1.6",
|
"husky": "^9.1.6",
|
||||||
"jsdom": "^25.0.1",
|
"jsdom": "^25.0.1",
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
@ -88,7 +89,7 @@
|
|||||||
"npm-run-all2": "^6.2.3",
|
"npm-run-all2": "^6.2.3",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"surge": "latest",
|
"surge": "latest",
|
||||||
"typescript": "~5.6.3",
|
"typescript": "~5.5.4",
|
||||||
"unocss": "^0.63.4",
|
"unocss": "^0.63.4",
|
||||||
"unplugin-auto-import": "^0.18.3",
|
"unplugin-auto-import": "^0.18.3",
|
||||||
"unplugin-icons": "^0.19.3",
|
"unplugin-icons": "^0.19.3",
|
||||||
|
951
pnpm-lock.yaml
generated
951
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script lang="ts" setup>
|
||||||
// https://vue-macros.dev/zh-CN/features/reactivity-transform.html
|
// https://vue-macros.dev/zh-CN/features/reactivity-transform.html
|
||||||
let count = $ref(0);
|
let count = $ref(0);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const baseURL = '/fake-api';
|
const baseURL = '/fake-api';
|
||||||
|
|
||||||
let fakeApiResult = $ref<Record<string, any> | null>(null);
|
let fakeApiResult = $ref<Record<string, unknown> | null>(null);
|
||||||
|
|
||||||
fetch(`${baseURL}/mock/get-user-info`)
|
fetch(`${baseURL}/mock/get-user-info`)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
|
@ -36,7 +36,7 @@ const {
|
|||||||
watch(
|
watch(
|
||||||
pageData,
|
pageData,
|
||||||
(pageDataVal) => {
|
(pageDataVal) => {
|
||||||
let message = [`[watch]`, `pageDataVal :>> `, pageDataVal];
|
const message = [`[watch]`, `pageDataVal :>> `, pageDataVal];
|
||||||
if (pageDataVal === undefined) {
|
if (pageDataVal === undefined) {
|
||||||
// hot updated 会造成 pageDataVal 为 undefined
|
// hot updated 会造成 pageDataVal 为 undefined
|
||||||
console.warn(message);
|
console.warn(message);
|
||||||
|
@ -12,7 +12,7 @@ enum TestEnum {
|
|||||||
B,
|
B,
|
||||||
}
|
}
|
||||||
|
|
||||||
const visitValue = (value: any) => {
|
const visitValue = (value: Direction | null | undefined) => {
|
||||||
$enum.visitValue(value).with({
|
$enum.visitValue(value).with({
|
||||||
[Direction.Up]: () => {},
|
[Direction.Up]: () => {},
|
||||||
[Direction.Down]: () => {},
|
[Direction.Down]: () => {},
|
||||||
@ -24,7 +24,7 @@ const visitValue = (value: any) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapValue = (value: any) => {
|
const mapValue = (value: Direction | null | undefined) => {
|
||||||
return $enum.mapValue(value).with({
|
return $enum.mapValue(value).with({
|
||||||
[Direction.Up]: 'Up',
|
[Direction.Up]: 'Up',
|
||||||
[Direction.Down]: 'Down',
|
[Direction.Down]: 'Down',
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
declare module '@vue/runtime-dom' {
|
declare module '@vue/runtime-dom' {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||||
interface HTMLAttributes
|
interface HTMLAttributes
|
||||||
extends Partial<Record<import('@unocss/preset-attributify').AttributifyNames, string | boolean>> {}
|
extends Partial<Record<import('@unocss/preset-attributify').AttributifyNames, string | boolean>> {}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user