eslint配置迁移到扁平模式。暂时没bug。
This commit is contained in:
@@ -68,10 +68,8 @@ export default defineConfig([
|
|||||||
pluginVue.configs["flat/essential"],
|
pluginVue.configs["flat/essential"],
|
||||||
{
|
{
|
||||||
files: ["**/*.vue",],
|
files: ["**/*.vue",],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
sourceType: "module",
|
parserOptions: { parser: tseslint.parser, },
|
||||||
ecmaVersion: "latest",
|
|
||||||
parserOptions: { parser: tseslint.parser }
|
|
||||||
},
|
},
|
||||||
// rules: {
|
// rules: {
|
||||||
// "vue/html-indent": ["error", 4,],
|
// "vue/html-indent": ["error", 4,],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import stylistic from "@stylistic/eslint-plugin";
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts}",],
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}",],
|
||||||
plugins: { js, },
|
plugins: { js, },
|
||||||
extends: ["js/recommended",],
|
extends: ["js/recommended",],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
@@ -56,6 +56,55 @@ export default defineConfig([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
pluginVue.configs["flat/essential"],
|
pluginVue.configs["flat/essential"],
|
||||||
{ files: ["**/*.vue",],
|
{
|
||||||
languageOptions: { parserOptions: { parser: tseslint.parser, }, }, },
|
files: ["**/*.vue",],
|
||||||
|
plugins: {
|
||||||
|
"@stylistic": stylistic,
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: { parser: tseslint.parser, },
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"vue/html-indent": ["error", 4,],
|
||||||
|
"vue/max-attributes-per-line": ["error", {
|
||||||
|
"singleline": {
|
||||||
|
"max": 1,
|
||||||
|
},
|
||||||
|
"multiline": {
|
||||||
|
"max": 1,
|
||||||
|
},
|
||||||
|
},],
|
||||||
|
"spaced-comment": "error",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"semi-spacing": ["error", {"before": false,
|
||||||
|
"after": true,},],
|
||||||
|
"@typescript-eslint/no-unused-vars": "warn",
|
||||||
|
"@stylistic/indent": ["error", 4, { SwitchCase: 1, },],
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-extra-semi": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "warn",
|
||||||
|
"@typescript-eslint/member-delimiter-style": "off",
|
||||||
|
"@stylistic/semi": ["error", "always",], // 控制行尾部分号
|
||||||
|
"@stylistic/brace-style": ["error", "allman", { allowSingleLine: true, },],
|
||||||
|
"@stylistic/comma-dangle": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
arrays: "always",
|
||||||
|
objects: "always",
|
||||||
|
imports: "never",
|
||||||
|
exports: "never",
|
||||||
|
functions: "never",
|
||||||
|
},
|
||||||
|
], // 数组和对象键值对最后一个逗号
|
||||||
|
"@stylistic/quotes": ["error", "double",],
|
||||||
|
"@typescript-eslint/space-before-function-paren": "off",
|
||||||
|
"@typescript-eslint/comma-spacing": ["off", { before: false,
|
||||||
|
after: true, },], // 使用eslint的,不用ts的
|
||||||
|
// "@typescript-eslint/strict-boolean-expressions": ["error", {
|
||||||
|
// allowString: false,
|
||||||
|
// },],
|
||||||
|
"@stylistic/object-property-newline": "warn",
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a href="https://vite.dev" target="_blank">
|
<a href="https://vite.dev"
|
||||||
<img src="/vite.svg" class="logo"
|
target="_blank">
|
||||||
|
<img src="/vite.svg"
|
||||||
|
class="logo"
|
||||||
alt="Vite logo">
|
alt="Vite logo">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://vuejs.org/" target="_blank">
|
<a href="https://vuejs.org/"
|
||||||
<img src="./assets/vue.svg" class="logo vue"
|
target="_blank">
|
||||||
|
<img src="./assets/vue.svg"
|
||||||
|
class="logo vue"
|
||||||
alt="Vue logo">
|
alt="Vue logo">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
author: Kane Wang <wangkane@qq.com>
|
author: Kane Wang <wangkane@qq.com>
|
||||||
date: 2025-10-23 15:32:30
|
date: 2025-10-23 17:52:01
|
||||||
component: Header
|
component: Header
|
||||||
Copyright © CPIC All rights reserved
|
Copyright © CPIC All rights reserved
|
||||||
-->
|
-->
|
||||||
|
|||||||
Reference in New Issue
Block a user