提交 6890dd72 编写于 作者: V vben

perf: 新包使用更严格的eslint

上级 762e5dee
module.exports = {
root: true,
extends: ['@vben'],
extends: ['@vben/eslint-config/strict'],
};
import baseLintConfig from './index';
export default {
extends: [baseLintConfig],
extends: ['@vben'],
plugins: ['simple-import-sort'],
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/ban-ts-ignore': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
'ts-check': false,
},
],
/**
* 【强制】关键字前后有一个空格
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
*/
'keyword-spacing': 'off',
'@typescript-eslint/keyword-spacing': [
'error',
{
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true },
},
},
],
/**
* 禁止出现空函数,普通函数(非 async/await/generator)、箭头函数、类上的方法除外
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
*/
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['arrowFunctions', 'functions', 'methods'],
},
],
/**
* 优先使用 interface 而不是 type 定义对象类型
* @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
*/
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
'vue/attributes-order': 'error',
'vue/require-default-prop': 'error',
......
module.exports = {
root: true,
extends: ['@vben'],
extends: ['@vben/eslint-config/strict'],
};
module.exports = {
root: true,
extends: ['@vben'],
extends: ['@vben/eslint-config/strict'],
};
import { type UserConfig, defineConfig, mergeConfig, loadEnv } from 'vite';
import { resolve } from 'node:path';
import dayjs from 'dayjs';
import { readPackageJSON } from 'pkg-types';
import { defineConfig, loadEnv, mergeConfig, type UserConfig } from 'vite';
import { createPlugins } from '../plugins';
import { generateModifyVars } from '../utils/modifyVars';
import { commonConfig } from './common';
import { createPlugins } from '../plugins';
import dayjs from 'dayjs';
interface DefineOptions {
overrides?: UserConfig;
options?: {};
options?: {
//
};
}
function defineApplicationConfig(defineOptions: DefineOptions = {}) {
......
import { type UserConfig } from 'vite';
import UnoCSS from 'unocss/vite';
import { presetTypography, presetUno } from 'unocss';
import UnoCSS from 'unocss/vite';
import { type UserConfig } from 'vite';
const commonConfig: UserConfig = {
server: {
......
import { type UserConfig, defineConfig, mergeConfig } from 'vite';
import { readPackageJSON } from 'pkg-types';
import { commonConfig } from './common';
import { defineConfig, mergeConfig, type UserConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { commonConfig } from './common';
interface DefineOptions {
overrides?: UserConfig;
options?: {};
options?: {
//
};
}
function definePackageConfig(defineOptions: DefineOptions = {}) {
......
import colors from 'picocolors';
import { readPackageJSON } from 'pkg-types';
import { type PluginOption } from 'vite';
import { getEnvConfig } from '../utils/env';
import { createContentHash } from '../utils/hash';
import { readPackageJSON } from 'pkg-types';
import colors from 'picocolors';
const GLOBAL_CONFIG_FILE_NAME = '_app.config.js';
const PLUGIN_NAME = 'app-config';
......
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
// @ts-ignore: type unless
import DefineOptions from 'unplugin-vue-define-options/vite';
import { type PluginOption } from 'vite';
import purgeIcons from 'vite-plugin-purge-icons';
import { createAppConfigPlugin } from './appConfig';
import { configCompressPlugin } from './compress';
import { configHtmlPlugin } from './html';
import { configMockPlugin } from './mock';
import { configCompressPlugin } from './compress';
import { configVisualizerConfig } from './visualizer';
import { configSvgIconsPlugin } from './svgSprite';
import { createAppConfigPlugin } from './appConfig';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import purgeIcons from 'vite-plugin-purge-icons';
// @ts-ignore
import DefineOptions from 'unplugin-vue-define-options/vite';
import { configVisualizerConfig } from './visualizer';
interface Options {
isBuild: boolean;
......
......@@ -3,9 +3,10 @@
* https://github.com/anncwb/vite-plugin-svg-icons
*/
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import { resolve } from 'node:path';
import type { PluginOption } from 'vite';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
export function configSvgIconsPlugin({ isBuild }: { isBuild: boolean }) {
const svgIconsPlugin = createSvgIconsPlugin({
......
/**
* Package file volume analysis
*/
import { type PluginOption } from 'vite';
import visualizer from 'rollup-plugin-visualizer';
import { type PluginOption } from 'vite';
export function configVisualizerConfig() {
return visualizer({
......
import { join } from 'node:path';
import dotenv from 'dotenv';
import { readFile } from 'fs-extra';
import { join } from 'node:path';
/**
* 获取当前环境下生效的配置文件名
......
import { generate } from '@ant-design/colors';
import { resolve } from 'node:path';
// @ts-ignore
import { generate } from '@ant-design/colors';
// @ts-ignore: typo
import { getThemeVariables } from 'ant-design-vue/dist/theme';
const primaryColor = '#0960bd';
......
module.exports = {
root: true,
extends: ['@vben'],
extends: ['@vben/eslint-config/strict'],
};
export * from './onMountedOrActivated';
export * from './useAttrs';
export * from './useRefs';
export { useTimeoutFn } from '@vueuse/core';
import { type AnyFunction } from '@vben/types';
import { nextTick, onMounted, onActivated } from 'vue';
import { nextTick, onActivated, onMounted } from 'vue';
/**
* 在 OnMounted 或者 OnActivated 时触发
......
import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue';
import { type Recordable } from '@vben/types';
import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue';
interface Options {
excludeListeners?: boolean;
......
import type { Ref } from 'vue';
import { ref, onBeforeUpdate } from 'vue';
import { onBeforeUpdate, ref } from 'vue';
export function useRefs(): [Ref<HTMLElement[]>, (index: number) => (el: HTMLElement) => void] {
const refs = ref([]) as Ref<HTMLElement[]>;
......
module.exports = {
root: true,
extends: ['@vben'],
extends: ['@vben/eslint-config/strict'],
};
......@@ -31,9 +31,9 @@ type Recordable<T> = Record<string, T>;
/**
* 字符串类型对象(只读)
*/
type ReadonlyRecordable<T = any> = {
interface ReadonlyRecordable<T = any> {
readonly [key: string]: T;
};
}
/**
* setTimeout 返回值类型
......@@ -47,12 +47,12 @@ type IntervalHandle = ReturnType<typeof setInterval>;
export {
type AnyFunction,
type AnyPromiseFunction,
type AnyNormalFunction,
type Nullable,
type AnyPromiseFunction,
type IntervalHandle,
type NonNullable,
type Recordable,
type Nullable,
type ReadonlyRecordable,
type Recordable,
type TimeoutHandle,
type IntervalHandle,
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册