From 83c192ea3ed6e6cc0fb7fbfff846649689186ebd Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 28 Nov 2018 15:00:03 +0800 Subject: [PATCH] :lipstick: fix eslint problems --- .eslintrc.js | 31 ++--- components/affix/__tests__/Affix.test.js | 14 +-- components/alert/demo/banner.md | 3 +- components/alert/demo/basic.md | 3 +- components/alert/demo/closable.md | 5 +- components/alert/demo/close-text.md | 3 +- components/alert/demo/custom-icon.md | 3 +- components/alert/demo/description.md | 3 +- components/alert/demo/icon.md | 3 +- components/alert/demo/smooth-closed.md | 3 +- components/alert/demo/style.md | 3 +- components/anchor/__tests__/Anchor.test.js | 4 +- components/anchor/demo/basic.md | 3 +- components/anchor/demo/onClick.md | 3 +- components/anchor/demo/static.md | 3 +- components/auto-complete/demo/options.md | 4 +- .../auto-complete/demo/uncertain-category.md | 4 +- components/avatar/demo/badge.md | 3 +- components/avatar/demo/basic.md | 3 +- components/avatar/demo/type.md | 3 +- components/badge/demo/basic.md | 3 +- components/badge/demo/change.md | 4 +- components/badge/demo/dot.md | 3 +- components/badge/demo/link.md | 3 +- components/badge/demo/no-wrapper.md | 3 +- components/badge/demo/overflow.md | 3 +- components/badge/demo/status.md | 3 +- components/badge/demo/title.md | 3 +- .../breadcrumb/__tests__/router.test.js | 4 +- components/breadcrumb/demo/basic.md | 3 +- components/breadcrumb/demo/router-4.md | 7 +- components/breadcrumb/demo/router.md | 7 +- components/breadcrumb/demo/separator.md | 3 +- components/breadcrumb/demo/withIcon.md | 3 +- components/button/demo/basic.md | 3 +- components/button/demo/block.md | 3 +- components/button/demo/ghost.md | 3 +- components/button/demo/multiple.md | 4 +- components/calendar/demo/basic.md | 3 +- components/calendar/demo/card.md | 3 +- components/calendar/demo/notice-calendar.md | 3 +- components/card/demo/basic.md | 3 +- components/card/demo/border-less.md | 3 +- components/card/demo/flexible-content.md | 3 +- components/card/demo/grid-card.md | 3 +- components/card/demo/in-column.md | 3 +- components/card/demo/inner.md | 3 +- components/card/demo/loading.md | 4 +- components/card/demo/meta.md | 3 +- components/card/demo/simple.md | 3 +- components/carousel/__tests__/index.test.js | 2 +- components/carousel/demo/autoplay.md | 3 +- components/carousel/demo/basic.md | 3 +- components/carousel/demo/fade.md | 3 +- components/carousel/demo/vertical.md | 3 +- components/cascader/demo/basic.md | 3 +- components/cascader/demo/change-on-select.md | 3 +- components/cascader/demo/custom-render.md | 3 +- components/cascader/demo/default-value.md | 3 +- components/cascader/demo/disabled-option.md | 3 +- components/cascader/demo/fields-name.md | 3 +- components/cascader/demo/hover.md | 3 +- components/cascader/demo/size.md | 3 +- components/cascader/demo/suffix.md | 3 +- components/checkbox/demo/basic.md | 3 +- components/checkbox/demo/check-all.md | 32 +++--- components/checkbox/demo/controller.md | 30 ++--- components/checkbox/demo/disabled.md | 3 +- components/checkbox/demo/group.md | 3 +- components/collapse/demo/accordion.md | 3 +- components/collapse/demo/basic.md | 3 +- components/collapse/demo/borderless.md | 3 +- components/collapse/demo/custom.md | 3 +- components/collapse/demo/mix.md | 3 +- components/collapse/demo/noarrow.md | 3 +- .../date-picker/__tests__/DatePicker.test.js | 7 +- .../date-picker/__tests__/showTime.test.js | 8 +- components/date-picker/demo/basic.md | 3 +- components/date-picker/demo/date-render.md | 3 +- components/date-picker/demo/disabled.md | 3 +- components/date-picker/demo/extra-footer.md | 3 +- components/date-picker/demo/format.md | 3 +- components/date-picker/demo/mode.md | 3 +- components/date-picker/demo/suffix.md | 3 +- components/date-picker/demo/time.md | 3 +- components/divider/demo/horizontal.md | 3 +- components/divider/demo/orientation.md | 3 +- components/divider/demo/vertical.md | 3 +- components/drawer/demo/from-drawer.md | 4 +- components/drawer/demo/user-profile.md | 4 +- components/dropdown/demo/basic.md | 3 +- components/dropdown/demo/context-menu.md | 3 +- components/dropdown/demo/dropdown-button.md | 7 +- components/dropdown/demo/event.md | 9 +- components/dropdown/demo/item.md | 3 +- components/dropdown/demo/overlay-visible.md | 3 +- components/dropdown/demo/placement.md | 3 +- components/dropdown/demo/sub-menu.md | 3 +- components/dropdown/demo/trigger.md | 3 +- components/form/__tests__/index.test.js | 2 +- components/form/demo/advanced-search.md | 36 +++--- components/form/demo/coordinated.md | 4 +- .../form/demo/customized-form-controls.md | 6 +- components/form/demo/dynamic-form-item.md | 60 +++++----- components/form/demo/dynamic-rule.md | 4 +- components/form/demo/form-in-modal.md | 9 +- components/form/demo/horizontal-login.md | 8 +- components/form/demo/layout.md | 4 +- components/form/demo/normal-login.md | 4 +- components/form/demo/register.md | 4 +- components/form/demo/time-related-controls.md | 4 +- components/form/demo/validate-other.md | 5 +- components/form/demo/validate-static.md | 7 +- components/grid/demo/gutter.md | 3 +- components/grid/demo/responsive-more.md | 3 +- components/grid/demo/responsive.md | 3 +- components/icon/demo/old-icons.md | 3 +- components/input-number/demo/basic.md | 3 +- components/input-number/demo/digit.md | 3 +- components/input-number/demo/formatter.md | 3 +- components/input-number/demo/size.md | 3 +- components/input/demo/addon.md | 3 +- components/input/demo/autosize-textarea.md | 3 +- components/input/demo/group.md | 12 +- components/input/demo/search-input.md | 3 +- components/input/demo/size.md | 3 +- components/input/demo/tooltip.md | 2 +- components/layout/__tests__/index.test.js | 12 +- components/layout/demo/basic.md | 7 +- components/layout/demo/custom-trigger.md | 5 +- components/layout/demo/fixed-sider.md | 12 +- components/layout/demo/fixed.md | 3 +- components/layout/demo/responsive.md | 7 +- components/layout/demo/side.md | 8 +- components/layout/demo/top-side-2.md | 12 +- components/layout/demo/top-side.md | 11 +- components/layout/demo/top.md | 3 +- components/list/demo/basic.md | 3 +- components/list/demo/grid.md | 3 +- components/list/demo/infinite-load.md | 24 ++-- .../list/demo/infinite-virtualized-load.md | 48 +++++--- components/list/demo/loadmore.md | 9 +- components/list/demo/resposive.md | 7 +- components/list/demo/simple.md | 3 +- components/list/demo/vertical.md | 3 +- .../locale-provider/__tests__/index.test.js | 14 ++- components/locale-provider/demo/all.md | 6 +- components/locale-provider/demo/basic.md | 3 +- components/mention/demo/avatar.md | 7 +- components/mention/demo/basic.md | 3 +- components/mention/demo/custom-tag.md | 3 +- components/mention/demo/multilines.md | 3 +- components/mention/demo/multiple-trigger.md | 3 +- components/mention/demo/placement.md | 3 +- components/mention/demo/popupContainer.md | 4 +- components/mention/demo/readonly.md | 3 +- components/menu/demo/vertical.md | 3 +- components/message/demo/duration.md | 3 +- components/message/demo/info.md | 3 +- components/message/demo/loading.md | 3 +- components/message/demo/other.md | 3 +- components/message/demo/thenable.md | 3 +- components/modal/__tests__/Modal.test.js | 4 +- components/modal/demo/async.md | 3 +- components/modal/demo/confirm-promise.md | 3 +- components/modal/demo/confirm.md | 3 +- .../notification/__tests__/placement.test.js | 6 +- components/notification/demo/basic.md | 3 +- components/notification/demo/custom-icon.md | 3 +- components/notification/demo/custom-style.md | 3 +- components/notification/demo/duration.md | 3 +- components/notification/demo/placement.md | 3 +- components/notification/demo/update.md | 3 +- components/notification/demo/with-btn.md | 3 +- components/notification/demo/with-icon.md | 3 +- components/pagination/demo/changer.md | 3 +- components/pagination/demo/itemRender.md | 3 +- components/pagination/demo/mini.md | 3 +- components/pagination/demo/more.md | 3 +- components/pagination/demo/simple.md | 3 +- components/pagination/demo/total.md | 3 +- components/popconfirm/demo/basic.md | 3 +- components/popconfirm/demo/icon.md | 3 +- components/popconfirm/demo/locale.md | 3 +- components/popconfirm/demo/placement.md | 3 +- .../popover/demo/arrow-point-at-center.md | 3 +- components/popover/demo/basic.md | 3 +- components/popover/demo/placement.md | 3 +- components/popover/demo/triggerType.md | 3 +- components/progress/demo/circle-mini.md | 3 +- components/progress/demo/circle.md | 3 +- components/progress/demo/format.md | 3 +- components/progress/demo/line-mini.md | 3 +- components/progress/demo/line.md | 3 +- components/progress/demo/linecap.md | 3 +- components/progress/demo/segment.md | 3 +- components/radio/demo/radiobutton-solid.md | 3 +- components/radio/demo/radiobutton.md | 3 +- components/radio/demo/size.md | 3 +- components/rate/demo/character.md | 3 +- components/rate/demo/clear.md | 3 +- .../select/demo/automatic-tokenization.md | 3 +- components/select/demo/basic.md | 3 +- components/select/demo/label-in-value.md | 3 +- components/select/demo/multiple.md | 3 +- components/select/demo/optgroup.md | 3 +- components/select/demo/search-box.md | 3 +- components/select/demo/search.md | 3 +- components/select/demo/suffix.md | 3 +- components/select/demo/tags.md | 3 +- components/skeleton/demo/list.md | 4 +- components/slider/demo/input-number.md | 9 +- components/slider/demo/mark.md | 3 +- components/spin/demo/inside.md | 3 +- components/spin/demo/size.md | 3 +- components/spin/demo/tip.md | 3 +- .../steps/demo/customized-progress-dot.md | 3 +- components/steps/demo/error.md | 3 +- components/steps/demo/icon.md | 3 +- components/steps/demo/progress-dot.md | 3 +- components/steps/demo/simple.md | 3 +- components/steps/demo/small-size.md | 3 +- components/steps/demo/vertical-small.md | 3 +- components/steps/demo/vertical.md | 3 +- components/switch/demo/loading.md | 3 +- components/switch/demo/size.md | 3 +- components/switch/demo/text.md | 3 +- .../table/__tests__/SelectionBox.test.js | 10 +- .../table/__tests__/Table.filter.test.js | 18 +-- .../table/__tests__/Table.sorter.test.js | 14 +-- components/table/demo/ajax.md | 8 +- components/table/demo/bordered.md | 3 +- components/table/demo/custom-filter-panel.md | 8 +- components/table/demo/dynamic-settings.md | 10 +- components/table/demo/edit-cell.md | 22 ++-- components/table/demo/edit-row.md | 20 ++-- components/table/demo/expand-children.md | 3 +- components/table/demo/expand.md | 19 ++- components/table/demo/fixed-columns-header.md | 36 ++++-- components/table/demo/fixed-columns.md | 8 +- components/table/demo/fixed-header.md | 3 +- components/table/demo/grouping-columns.md | 3 +- components/table/demo/head.md | 3 +- components/table/demo/jsx.md | 3 +- components/table/demo/nested-table.md | 4 +- components/table/demo/row-selection.md | 3 +- components/table/demo/size.md | 3 +- components/tabs/demo/basic.md | 3 +- components/tabs/demo/card-top.md | 3 +- components/tabs/demo/card.md | 3 +- components/tabs/demo/custom-tab-bar.md | 3 +- components/tabs/demo/disabled.md | 3 +- components/tabs/demo/editable-card.md | 4 +- components/tabs/demo/extra.md | 3 +- components/tabs/demo/icon.md | 3 +- components/tag/demo/checkable.md | 3 +- components/tag/demo/colorful.md | 3 +- components/tag/demo/control.md | 4 +- components/time-picker/demo/12hours.md | 3 +- components/time-picker/demo/disabled.md | 3 +- components/time-picker/demo/hide-column.md | 3 +- .../time-picker/demo/interval-options.md | 3 +- components/time-picker/demo/size.md | 3 +- components/timeline/demo/alternate.md | 3 +- components/timeline/demo/basic.md | 3 +- components/timeline/demo/color.md | 3 +- components/timeline/demo/custom.md | 3 +- components/timeline/demo/right.md | 3 +- components/tooltip/__tests__/tooltip.test.js | 8 +- .../tooltip/demo/arrow-point-at-center.md | 3 +- .../tooltip/demo/auto-adjust-overflow.md | 3 +- components/tooltip/demo/basic.md | 3 +- components/tooltip/demo/placement.md | 3 +- components/transfer/__tests__/index.test.js | 20 +++- components/transfer/demo/advanced.md | 18 ++- components/transfer/demo/search.md | 4 +- components/tree/__tests__/directory.test.js | 3 +- components/tree/__tests__/util.test.js | 2 +- components/tree/demo/basic-controlled.md | 24 ++-- components/tree/demo/basic.md | 2 +- components/tree/demo/customized-icon.md | 45 ++++---- components/tree/demo/directory.md | 2 +- components/tree/demo/draggable.md | 2 +- components/tree/demo/dynamic.md | 58 +++++----- components/tree/demo/line.md | 2 +- components/tree/demo/search.md | 2 +- components/upload/demo/basic.md | 7 +- components/upload/demo/defaultFileList.md | 3 +- components/upload/demo/directory.md | 3 +- components/upload/demo/drag.md | 3 +- components/upload/demo/picture-style.md | 3 +- components/upload/demo/upload-manually.md | 4 +- package.json | 2 + scripts/sort-api-table.js | 19 ++- scripts/update-rc.js | 4 +- site/.eslintrc.js | 11 ++ site/bisheng.config.js | 5 + site/theme/index.js | 11 +- site/theme/template/Color/Palette.jsx | 6 +- site/theme/template/Content/Article.jsx | 4 +- site/theme/template/Content/ComponentDoc.jsx | 7 +- site/theme/template/Content/Demo.jsx | 20 ++-- site/theme/template/Content/MainContent.jsx | 108 +++++++++--------- site/theme/template/Home/Page1.jsx | 8 +- site/theme/template/Home/Page3.jsx | 4 +- site/theme/template/Home/index.jsx | 2 +- site/theme/template/Layout/Footer.jsx | 4 +- site/theme/template/Layout/Header.jsx | 15 ++- site/theme/template/Layout/index.jsx | 10 +- tests/__mocks__/rc-trigger.js | 5 +- tests/dekko/lib.test.js | 8 +- tests/setup.js | 11 +- webpack.config.js | 3 +- 313 files changed, 1122 insertions(+), 730 deletions(-) create mode 100644 site/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index b104d2adb6..c0d2c19f91 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,33 +14,18 @@ const eslintrc = { 'babel', ], rules: { - 'func-names': 0, - 'arrow-body-style': 0, - 'react/sort-comp': 0, - 'react/prop-types': 0, - 'react/jsx-first-prop-new-line': 0, 'react/jsx-one-expression-per-line': 0, + 'react/prop-types': 0, 'react/forbid-prop-types': 0, + 'import/no-extraneous-dependencies': ['error', { + devDependencies: ['site/**', 'tests/**', 'scripts/**', '**/*.test.js', '**/__tests__/*', '*.config.js', '**/*.md'], + }], 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.md'] }], - 'import/extensions': 0, - 'import/no-unresolved': 0, - 'import/no-extraneous-dependencies': 0, - 'prefer-destructuring': 0, - 'no-param-reassign': 0, - 'no-return-assign': 0, - 'max-len': 0, - 'consistent-return': 0, - 'no-redeclare': 0, - 'react/require-extension': 0, 'jsx-a11y/no-static-element-interactions': 0, 'jsx-a11y/anchor-has-content': 0, 'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/anchor-is-valid': 0, - 'react/no-danger': 0, 'comma-dangle': ['error', 'always-multiline'], - 'function-paren-newline': 0, - 'object-curly-newline': 0, - 'no-restricted-globals': 0, }, }; @@ -61,9 +46,13 @@ if (process.env.RUN_ENV === 'DEMO') { 'react/no-access-state-in-setstate': 0, 'react/destructuring-assignment': 0, 'react/no-multi-comp': 0, - 'react/prefer-stateless-function': 0, 'jsx-a11y/href-no-hash': 0, - 'import/newline-after-import': 0, + 'prefer-destructuring': 0, // TODO: remove later + 'max-len': 0, // TODO: remove later + 'consistent-return': 0, // TODO: remove later + 'no-return-assign': 0, // TODO: remove later + 'no-param-reassign': 0, // TODO: remove later + 'import/no-extraneous-dependencies': 0, }); } diff --git a/components/affix/__tests__/Affix.test.js b/components/affix/__tests__/Affix.test.js index cd5124af55..b135454f32 100644 --- a/components/affix/__tests__/Affix.test.js +++ b/components/affix/__tests__/Affix.test.js @@ -12,9 +12,7 @@ class AffixMounter extends React.Component { }); } - getTarget = () => { - return this.container; - } + getTarget = () => this.container render() { return ( @@ -34,7 +32,7 @@ class AffixMounter extends React.Component { > this.container} - ref={ele => this.affix = ele} + ref={(ele) => { this.affix = ele; }} {...this.props} > , - mountNode); + mountNode +); ````