Skip to content

Commit

Permalink
build(projects): 更换eslint依赖为eslint-config-soybeanjs-vue
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Aug 27, 2022
1 parent 7240be8 commit 07325a4
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
extends: ['@soybeanjs'],
extends: ['soybeanjs-vue'],
settings: {
'import/core-modules': ['uno.css', '~icons/*', 'virtual:svg-icons-register']
},
rules: {
'import/no-unresolved': ['error', { ignore: ['uno.css', '~icons/*', 'virtual:svg-icons-register'] }],
'import/order': [
'error',
{
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run typecheck
npm run lint:fix && npm run typecheck
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"typescript",
"typescriptreact",
"vue",
"html",
"json",
"jsonc",
"json5",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"build:vercel": "cross-env VITE_HASH_ROUTE=Y VITE_VERCEL=Y vite build",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit --skipLibCheck",
"lint": "eslint . --fix",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "husky install",
"postinstall": "patch-package",
"release": "standard-version",
Expand Down Expand Up @@ -84,7 +85,6 @@
"@iconify/json": "^2.1.97",
"@iconify/vue": "^3.2.1",
"@milahu/patch-package": "^6.4.14",
"@soybeanjs/eslint-config": "0.2.10",
"@types/bmapgl": "^0.0.5",
"@types/crypto-js": "^4.1.1",
"@types/node": "^18.7.13",
Expand All @@ -97,6 +97,7 @@
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^6.9.1",
"eslint": "^8.22.0",
"eslint-config-soybeanjs-vue": "^0.0.6",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"mockjs": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/custom/CountTo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function formatNumber(num: number | string) {
}
const { decimals, decimal, separator, suffix, prefix } = props;
let number = Number(num).toFixed(decimals);
number += '';
number = String(number);
const x = number.split('.');
let x1 = x[0];
Expand Down
28 changes: 16 additions & 12 deletions src/service/request/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export function createRequest(axiosConfig: AxiosRequestConfig, backendConfig?: S
const { url } = param;
const method = param.method || 'get';
const { instance } = customInstance;
const res = (await getRequestResponse(
const res = (await getRequestResponse({
instance,
method,
url,
param.data,
param.axiosConfig
)) as Service.RequestResult<T>;
data: param.data,
config: param.axiosConfig
})) as Service.RequestResult<T>;

return res;
}
Expand Down Expand Up @@ -132,7 +132,9 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
const method = param.method || 'get';
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 {
data,
Expand Down Expand Up @@ -187,13 +189,15 @@ export function createHookRequest(axiosConfig: AxiosRequestConfig, backendConfig
};
}

async function getRequestResponse(
instance: AxiosInstance,
method: RequestMethod,
url: string,
data?: any,
config?: AxiosRequestConfig
) {
async function getRequestResponse(params: {
instance: AxiosInstance;
method: RequestMethod;
url: string;
data?: any;
config?: AxiosRequestConfig;
}) {
const { instance, method, url, data, config } = params;

let res: any;
if (method === 'get' || method === 'delete') {
res = await instance[method](url, config);
Expand Down
2 changes: 1 addition & 1 deletion src/views/plugin/charts/antv/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function renderScatterChart() {
chart.axis('GDP', {
label: {
formatter(value) {
return `${(+value / 1000).toFixed(0)}k`;
return `${(Number(value) / 1000).toFixed(0)}k`;
} // 格式化坐标轴的显示
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/views/plugin/charts/echarts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const pictorialBarOption = ref<ECOption>(getPictorialBarOption());
const { domRef: pictorialBarRef } = useEcharts(pictorialBarOption);
function getPictorialBarOption(): ECOption {
const category: string[] = [];
let dottedBase = +new Date();
let dottedBase = Number(new Date());
const lineData: number[] = [];
const barData: number[] = [];
Expand Down

0 comments on commit 07325a4

Please sign in to comment.