build(projects): 更换eslint依赖为eslint-config-soybeanjs-vue

This commit is contained in:
Soybean 2022-08-28 14:48:00 +08:00
parent 7240be8495
commit 07325a4236
8 changed files with 27 additions and 21 deletions

View File

@ -1,7 +1,9 @@
module.exports = { module.exports = {
extends: ['@soybeanjs'], extends: ['soybeanjs-vue'],
settings: {
'import/core-modules': ['uno.css', '~icons/*', 'virtual:svg-icons-register']
},
rules: { rules: {
'import/no-unresolved': ['error', { ignore: ['uno.css', '~icons/*', 'virtual:svg-icons-register'] }],
'import/order': [ 'import/order': [
'error', 'error',
{ {

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
npm run lint && npm run typecheck npm run lint:fix && npm run typecheck

View File

@ -16,7 +16,6 @@
"typescript", "typescript",
"typescriptreact", "typescriptreact",
"vue", "vue",
"html",
"json", "json",
"jsonc", "jsonc",
"json5", "json5",

View File

@ -44,7 +44,8 @@
"build:vercel": "cross-env VITE_HASH_ROUTE=Y VITE_VERCEL=Y vite build", "build:vercel": "cross-env VITE_HASH_ROUTE=Y VITE_VERCEL=Y vite build",
"preview": "vite preview", "preview": "vite preview",
"typecheck": "vue-tsc --noEmit --skipLibCheck", "typecheck": "vue-tsc --noEmit --skipLibCheck",
"lint": "eslint . --fix", "lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "husky install", "prepare": "husky install",
"postinstall": "patch-package", "postinstall": "patch-package",
"release": "standard-version", "release": "standard-version",
@ -84,7 +85,6 @@
"@iconify/json": "^2.1.97", "@iconify/json": "^2.1.97",
"@iconify/vue": "^3.2.1", "@iconify/vue": "^3.2.1",
"@milahu/patch-package": "^6.4.14", "@milahu/patch-package": "^6.4.14",
"@soybeanjs/eslint-config": "0.2.10",
"@types/bmapgl": "^0.0.5", "@types/bmapgl": "^0.0.5",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/node": "^18.7.13", "@types/node": "^18.7.13",
@ -97,6 +97,7 @@
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^6.9.1", "cz-customizable": "^6.9.1",
"eslint": "^8.22.0", "eslint": "^8.22.0",
"eslint-config-soybeanjs-vue": "^0.0.6",
"husky": "^8.0.1", "husky": "^8.0.1",
"lint-staged": "^13.0.3", "lint-staged": "^13.0.3",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",

View File

@ -82,7 +82,7 @@ function formatNumber(num: number | string) {
} }
const { decimals, decimal, separator, suffix, prefix } = props; const { decimals, decimal, separator, suffix, prefix } = props;
let number = Number(num).toFixed(decimals); let number = Number(num).toFixed(decimals);
number += ''; number = String(number);
const x = number.split('.'); const x = number.split('.');
let x1 = x[0]; let x1 = x[0];

View File

@ -33,13 +33,13 @@ export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: S
const { url } = param; const { url } = param;
const method = param.method || 'get'; const method = param.method || 'get';
const { instance } = customInstance; const { instance } = customInstance;
const res = (await getRequestResponse( const res = (await getRequestResponse({
instance, instance,
method, method,
url, url,
param.data, data: param.data,
param.axiosConfig config: param.axiosConfig
)) as Service.RequestResult<T>; })) as Service.RequestResult<T>;
return res; return res;
} }
@ -132,7 +132,9 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
const method = param.method || 'get'; const method = param.method || 'get';
const { instance } = customInstance; const { instance } = customInstance;
getRequestResponse(instance, method, url, param.data, param.axiosConfig).then(handleRequestResult); getRequestResponse({ instance, method, url, data: param.data, config: param.axiosConfig }).then(
handleRequestResult
);
return { return {
data, data,
@ -187,13 +189,15 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
}; };
} }
async function getRequestResponse( async function getRequestResponse(params: {
instance: AxiosInstance, instance: AxiosInstance;
method: RequestMethod, method: RequestMethod;
url: string, url: string;
data?: any, data?: any;
config?: AxiosRequestConfig config?: AxiosRequestConfig;
) { }) {
const { instance, method, url, data, config } = params;
let res: any; let res: any;
if (method === 'get' || method === 'delete') { if (method === 'get' || method === 'delete') {
res = await instance[method](url, config); res = await instance[method](url, config);

View File

@ -287,7 +287,7 @@ function renderScatterChart() {
chart.axis('GDP', { chart.axis('GDP', {
label: { label: {
formatter(value) { formatter(value) {
return `${(+value / 1000).toFixed(0)}k`; return `${(Number(value) / 1000).toFixed(0)}k`;
} // } //
} }
}); });

View File

@ -294,7 +294,7 @@ const pictorialBarOption = ref<ECOption>(getPictorialBarOption());
const { domRef: pictorialBarRef } = useEcharts(pictorialBarOption); const { domRef: pictorialBarRef } = useEcharts(pictorialBarOption);
function getPictorialBarOption(): ECOption { function getPictorialBarOption(): ECOption {
const category: string[] = []; const category: string[] = [];
let dottedBase = +new Date(); let dottedBase = Number(new Date());
const lineData: number[] = []; const lineData: number[] = [];
const barData: number[] = []; const barData: number[] = [];