You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2021/07/21 01:57:55 UTC
[apisix-dashboard] branch master updated: feat: added husky for
pre-commit (#1957)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 4f0ef8c feat: added husky for pre-commit (#1957)
4f0ef8c is described below
commit 4f0ef8cf6db20190d65b0e065a52ab1ca83a6c1c
Author: Ayush das <ay...@gmail.com>
AuthorDate: Wed Jul 21 07:27:48 2021 +0530
feat: added husky for pre-commit (#1957)
---
web/.eslintignore | 3 ++-
web/.husky/.gitignore | 1 +
web/.husky/pre-commit | 5 +++++
web/package.json | 2 ++
web/src/global.tsx | 4 ++--
web/src/pages/Consumer/Create.tsx | 22 ++++++++++++----------
web/src/pages/Plugin/List.tsx | 7 +++++--
web/tsconfig.json | 5 +----
web/yarn.lock | 5 +++++
9 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/web/.eslintignore b/web/.eslintignore
index 16116a2..f3ff8d5 100644
--- a/web/.eslintignore
+++ b/web/.eslintignore
@@ -1,4 +1,5 @@
/lambda/
/scripts
/config
-.history
\ No newline at end of file
+.history
+.eslintrc.js
diff --git a/web/.husky/.gitignore b/web/.husky/.gitignore
new file mode 100644
index 0000000..31354ec
--- /dev/null
+++ b/web/.husky/.gitignore
@@ -0,0 +1 @@
+_
diff --git a/web/.husky/pre-commit b/web/.husky/pre-commit
new file mode 100755
index 0000000..99c3bc8
--- /dev/null
+++ b/web/.husky/pre-commit
@@ -0,0 +1,5 @@
+#!/bin/sh
+. "$(dirname "$0")/_/husky.sh"
+
+cd web
+yarn lint-staged
diff --git a/web/package.json b/web/package.json
index 50277c3..d039dee 100644
--- a/web/package.json
+++ b/web/package.json
@@ -4,6 +4,7 @@
"private": true,
"description": "Dashboard for Apache APISIX",
"scripts": {
+ "prepare": "cd .. && husky install web/.husky",
"analyze": "cross-env ANALYZE=1 yarn run build",
"build": "cp -R ./node_modules/monaco-editor ./public/ && umi build",
"dev": "yarn run start:dev",
@@ -127,6 +128,7 @@
"eslint": "^7.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"express": "^4.17.1",
+ "husky": "^6.0.0",
"lint-staged": "^10.0.0",
"mockjs": "^1.0.1-beta3",
"monaco-editor": "^0.24.0",
diff --git a/web/src/global.tsx b/web/src/global.tsx
index e921c31..398baa4 100644
--- a/web/src/global.tsx
+++ b/web/src/global.tsx
@@ -25,8 +25,8 @@ import defaultSettings from '../config/defaultSettings';
// see https://github.com/suren-atoyan/monaco-react/issues/168
loader.config({ paths: { vs: '/monaco-editor/min/vs' } });
-if (getLocale() === 'zh-CN'){
- loader.config({ "vs/nls": { availableLanguages: { "*": 'zh-cn' } } });
+if (getLocale() === 'zh-CN') {
+ loader.config({ 'vs/nls': { availableLanguages: { '*': 'zh-cn' } } });
}
const { pwa } = defaultSettings;
diff --git a/web/src/pages/Consumer/Create.tsx b/web/src/pages/Consumer/Create.tsx
index 6350fa8..8f8f765 100644
--- a/web/src/pages/Consumer/Create.tsx
+++ b/web/src/pages/Consumer/Create.tsx
@@ -52,12 +52,13 @@ const Page: React.FC = (props) => {
(username ? update(username, data) : create(data))
.then(() => {
notification.success({
- message: `${username
- ? formatMessage({ id: 'component.global.edit' })
- : formatMessage({ id: 'component.global.create' })
- } ${formatMessage({ id: 'menu.consumer' })} ${formatMessage({
- id: 'component.status.success',
- })}`,
+ message: `${
+ username
+ ? formatMessage({ id: 'component.global.edit' })
+ : formatMessage({ id: 'component.global.create' })
+ } ${formatMessage({ id: 'menu.consumer' })} ${formatMessage({
+ id: 'component.status.success',
+ })}`,
});
history.push('/consumer/list');
})
@@ -98,10 +99,11 @@ const Page: React.FC = (props) => {
return (
<>
<PageContainer
- title={`${(props as any).match.params.username
- ? formatMessage({ id: 'page.consumer.configure' })
- : formatMessage({ id: 'page.consumer.create' })
- }`}
+ title={`${
+ (props as any).match.params.username
+ ? formatMessage({ id: 'page.consumer.configure' })
+ : formatMessage({ id: 'page.consumer.create' })
+ }`}
>
<Card bordered={false}>
<Steps current={step - 1} style={{ marginBottom: 30 }}>
diff --git a/web/src/pages/Plugin/List.tsx b/web/src/pages/Plugin/List.tsx
index 1df3f1e..3118f8f 100644
--- a/web/src/pages/Plugin/List.tsx
+++ b/web/src/pages/Plugin/List.tsx
@@ -22,7 +22,7 @@ import type { ActionType, ProColumns } from '@ant-design/pro-table';
import { Button, Popconfirm, Space, notification } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { omit } from 'lodash';
-import querystring from 'query-string'
+import querystring from 'query-string';
import PluginDetail from '@/components/Plugin/PluginDetail';
@@ -146,7 +146,10 @@ const Page: React.FC = () => {
);
return (
- <PageHeaderWrapper title={formatMessage({ id: 'page.plugin.list' })} content={formatMessage({ id: 'page.plugin.list.enabled' })}>
+ <PageHeaderWrapper
+ title={formatMessage({ id: 'page.plugin.list' })}
+ content={formatMessage({ id: 'page.plugin.list.enabled' })}
+ >
<ProTable<PluginModule.TransformedPlugin>
actionRef={ref}
rowKey="id"
diff --git a/web/tsconfig.json b/web/tsconfig.json
index b0f8453..fd04515 100644
--- a/web/tsconfig.json
+++ b/web/tsconfig.json
@@ -22,9 +22,6 @@
"@@/*": ["./src/.umi/*"]
}
},
- "include": [
- "src",
- "node_modules/monaco-editor/monaco.d.ts"
- ],
+ "include": ["cypress", "src", "node_modules/monaco-editor/monaco.d.ts"],
"exclude": ["node_modules", "build", "dist", "scripts", "src/.umi/*", "webpack", "jest"]
}
diff --git a/web/yarn.lock b/web/yarn.lock
index fcedfed..df958ba 100644
--- a/web/yarn.lock
+++ b/web/yarn.lock
@@ -9009,6 +9009,11 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
+husky@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e"
+ integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==
+
iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.8:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"