Skip to content

Commit

Permalink
fix: 修复错误的eslint template 设置 升级eslint版本
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed May 13, 2023
1 parent 7dce364 commit a52bf9d
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
template
src/components/meKeepAlive
dist
vite.config.ts.*
vite.config.ts.*
.eslintrc.cjs
22 changes: 3 additions & 19 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ module.exports = {

// Script parser for `<script lang="ts">`
ts: '@typescript-eslint/parser',

// Script parser for vue directives (e.g. `v-if=` or `:attribute=`)
// and vue interpolations (e.g. `{{variable}}`).
// If not specified, the parser determined by `<script lang ="...">` is used.
'<template>': 'espree',
},
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
Expand All @@ -29,34 +24,23 @@ module.exports = {
overrides: [
{
files: ['*.vue'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
rules: {},
},
{
files: ['*.cjs'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
rules: {},
},
],
rules: {
// override/add rules settings here, such as:
'lines-around-comment': ['warn', { beforeBlockComment: true }],
'vue/multi-word-component-names': 'off',
'vue/no-template-shadow': 'off',
'vue/no-parsing-error': 'off',
'vue/require-default-prop': 'off',
'vue/no-v-html': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
// we are only using this rule to check for unused arguments since TS
// catches unused variables but not args.
{ varsIgnorePattern: '.*', args: 'none' },
],
'@typescript-eslint/no-unused-vars': ['error', { args: 'after-used' }],
'no-undef': 'off', // ts(2304)
'@typescript-eslint/naming-convention': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion mock/apiDemo/routeMenu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { success, fail } from '../helper';
import { success } from '../helper';

const menu = [
{
Expand Down
2 changes: 1 addition & 1 deletion mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function setupProdMockServer() {
eager: true,
});
let moduleArr: any[] = [];
Object.entries(modules).forEach(([key, module]: any) => {
Object.entries(modules).forEach(([, module]: any) => {
moduleArr = moduleArr.concat(module);
});
createProdMockServer([...moduleArr]);
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@
"@types/nprogress": "^0.2.0",
"@types/path-browserify": "^1.0.0",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-typescript": "^11.0.0",
"@yuntian001/vue-setup-extend": "^1.0.0",
"autoprefixer": "^10.4.8",
"core-js": "^3.25.3",
"eslint": "^8.22.0",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^9.3.0",
"eslint-plugin-vue": "^9.12.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"postcss-plugin-px2rem": "^0.8.1",
Expand All @@ -88,7 +88,7 @@
"vite-plugin-autogeneration-import-file": "^3.0.0",
"vite-plugin-compression": "^0.5.1",
"vite-svg-loader": "^3.4.0",
"vue-eslint-parser": "^9.0.3",
"vue-eslint-parser": "^9.2.1",
"vue-tsc": "^1.6.4",
"xregexp": "^5.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoImportApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default () =>
// 自动加载API
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
// 可以选择auto-imports.d.ts生成的位置,使用ts建议设置为'src/auto-imports.d.ts'
dts: false, // pathResolve('types/auto-imports.d.ts'),
dts: pathResolve('types/auto-imports.d.ts'),
resolvers: [ElementPlusResolver({ importStyle: false })],
});
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SetElGlobel from './setElGlobel';
const settingStore = useSettingStore();
const htmlDom = document.getElementsByTagName('html')[0];
watchEffect(() => {
Object.entries(SizeEnum).forEach(([key, value]) => {
Object.entries(SizeEnum).forEach(([, value]) => {
htmlDom.classList.remove('me-' + value);
});
htmlDom.classList.add('me-' + settingStore.themeConfig.size);
Expand Down
2 changes: 1 addition & 1 deletion src/layout/components/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:default-active="activeMenu"
:collapse="!globalStore.isMobile && themeConfig.menuCollapse"
>
<layout-menu-item v-for="route in routeStore.routes" :key="route.path" :item="route" />
<layout-menu-item v-for="item in routeStore.routes" :key="item.path" :item="item" />
</el-menu>
</el-scrollbar>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/locales/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const useLoadMessages = () => {
if (instance === null) {
throw new Error('必须在setup中调用');
}
const cache = new Set<any>();
const app = instance.appContext.app;
const loadMessages = (
options: (VNode & { __v_isVNode: true }) | ComponentOptions | string,
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import { PageEnum } from '@/dict/pageEnum';
import { App } from 'vue';
import { setupRouterGuard } from './guard';
Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/global.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Composer } from 'vue-i18n';
import { event, mitter } from '@/event';
import { LoadingOptions } from 'element-plus';
import { forOwn } from 'lodash-es';
const WIDTH = 992; // refer to Bootstrap's responsive design
const isMobile = ref(window.document.body.offsetWidth < WIDTH);
mitter.on(event.RESIZE, () => {
Expand Down
1 change: 0 additions & 1 deletion types/vue-router.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { _RouteRecordBase, RouteMeta } from 'vue-router';
declare module 'vue-router' {
export interface RouteMeta extends Record<string | number | symbol, unknown> {
// 标题设置该路由在侧边栏和面包屑中展示的名字
Expand Down

0 comments on commit a52bf9d

Please sign in to comment.