Sfoglia il codice sorgente

Fix prettier glob (#2673)

* SelectLang: languages options don't need to be translated

* fix e2e tests when `PORT` is set in `.env`

* prettier: fix glob by adding single quotes.

* prettier: running prettier after glob fix
Rayron Victor 7 anni fa
parent
commit
e7c447ab34

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
     "test": "umi test",
     "test:component": "umi test ./src/components",
     "test:all": "node ./tests/run-tests.js",
-    "prettier": "prettier --write ./src/**/**/**/*",
+    "prettier": "prettier --write './src/**/*'",
     "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
     "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
     "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",

+ 1 - 1
src/components/NoticeIcon/NoticeIconTab.d.ts

@@ -1,6 +1,6 @@
 import * as React from 'react';
 export interface INoticeIconData {
-  avatar?: string|React.ReactNode;
+  avatar?: string | React.ReactNode;
   title?: React.ReactNode;
   description?: React.ReactNode;
   datetime?: React.ReactNode;

+ 1 - 1
src/components/PageHeader/index.d.ts

@@ -17,7 +17,7 @@ export interface IPageHeaderProps {
   style?: React.CSSProperties;
   home?: React.ReactNode;
   wide?: boolean;
-  hiddenBreadcrumb?:boolean;
+  hiddenBreadcrumb?: boolean;
 }
 
 export default class PageHeader extends React.Component<IPageHeaderProps, any> {}

+ 5 - 1
src/layouts/Header.js

@@ -43,7 +43,11 @@ class HeaderView extends PureComponent {
   };
 
   handleNoticeClear = type => {
-    message.success(`${formatMessage({ id: 'component.noticeIcon.cleared' })} ${formatMessage({ id: `component.globalHeader.${type}` })}`);
+    message.success(
+      `${formatMessage({ id: 'component.noticeIcon.cleared' })} ${formatMessage({
+        id: `component.globalHeader.${type}`,
+      })}`
+    );
     const { dispatch } = this.props;
     dispatch({
       type: 'global/clearNotices',

+ 3 - 3
src/pages/404.js

@@ -1,13 +1,13 @@
 import React from 'react';
 import Link from 'umi/link';
-import { formatMessage } from "umi/locale";
+import { formatMessage } from 'umi/locale';
 import Exception from '@/components/Exception';
 
 export default () => (
   <Exception
     type="404"
     linkElement={Link}
-    desc={formatMessage({id: 'app.exception.description.404'})}
-    backText={formatMessage({id: 'app.exception.back'})}
+    desc={formatMessage({ id: 'app.exception.description.404' })}
+    backText={formatMessage({ id: 'app.exception.back' })}
   />
 );

+ 3 - 3
src/pages/List/List.js

@@ -21,12 +21,12 @@ class SearchList extends Component {
       default:
         break;
     }
-  }
+  };
 
-  handleFormSubmit = (value) => {
+  handleFormSubmit = value => {
     // eslint-disable-next-line
     console.log(value);
-  }
+  };
 
   render() {
     const tabList = [

+ 2 - 8
src/pages/List/Projects.js

@@ -125,10 +125,7 @@ class CoverCardList extends PureComponent {
                 <Col lg={8} md={10} sm={10} xs={24}>
                   <FormItem {...formItemLayout} label="作者">
                     {getFieldDecorator('author', {})(
-                      <Select
-                        placeholder="不限"
-                        style={{ maxWidth: 200, width: '100%' }}
-                      >
+                      <Select placeholder="不限" style={{ maxWidth: 200, width: '100%' }}>
                         <Option value="lisa">王昭君</Option>
                       </Select>
                     )}
@@ -137,10 +134,7 @@ class CoverCardList extends PureComponent {
                 <Col lg={8} md={10} sm={10} xs={24}>
                   <FormItem {...formItemLayout} label="好评度">
                     {getFieldDecorator('rate', {})(
-                      <Select
-                        placeholder="不限"
-                        style={{ maxWidth: 200, width: '100%' }}
-                      >
+                      <Select placeholder="不限" style={{ maxWidth: 200, width: '100%' }}>
                         <Option value="good">优秀</Option>
                         <Option value="normal">普通</Option>
                       </Select>

+ 3 - 1
src/pages/User/Login.js

@@ -92,7 +92,9 @@ class LoginPage extends Component {
             {login.status === 'error' &&
               login.type === 'mobile' &&
               !submitting &&
-              this.renderMessage(formatMessage({ id: 'app.login.message-invalid-verification-code' }))}
+              this.renderMessage(
+                formatMessage({ id: 'app.login.message-invalid-verification-code' })
+              )}
             <Mobile name="mobile" />
             <Captcha name="captcha" countDown={120} onGetCaptcha={this.onGetCaptcha} />
           </Tab>

+ 1 - 4
src/utils/request.js

@@ -63,10 +63,7 @@ const cachedSave = (response, hashcode) => {
  * @param  {object} [option] The options we want to pass to "fetch"
  * @return {object}           An object containing either "data" or "err"
  */
-export default function request(
-  url,
-  option,
-) {
+export default function request(url, option) {
   const options = {
     expirys: isAntdPro(),
     ...option,

+ 0 - 2
src/utils/utils.test.js

@@ -22,7 +22,6 @@ describe('fixedZero tests', () => {
     expect(fixedZero(8)).toEqual('08');
     expect(fixedZero(9)).toEqual('09');
   });
-
 });
 
 describe('isUrl tests', () => {
@@ -60,5 +59,4 @@ describe('isUrl tests', () => {
     expect(isUrl('http://www.example.com/test/123?foo=bar')).toBeTruthy();
     expect(isUrl('https://www.example.com/test/123?foo=bar')).toBeTruthy();
   });
-
 });