diff --git a/.eslintrc.js b/.eslintrc.js index b1ec7be375..97e9d90b42 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -56,6 +56,8 @@ const eslintrc = { 'jsx-a11y/anchor-is-valid': 0, 'comma-dangle': ['error', 'always-multiline'], 'react/jsx-filename-extension': 0, + 'react/state-in-constructor': 0, + 'react/jsx-props-no-spreading': 0, 'prefer-destructuring': 0, // TODO: remove later 'consistent-return': 0, // TODO: remove later 'no-return-assign': 0, // TODO: remove later @@ -78,6 +80,8 @@ const eslintrc = { 'react/display-name': 0, // ban this for Number.isNaN needs polyfill 'no-restricted-globals': 0, + 'max-classes-per-file': 0, + 'react/static-property-placement': 0, }, }; @@ -100,6 +104,7 @@ if (process.env.RUN_ENV === 'DEMO') { 'react/no-multi-comp': 0, 'jsx-a11y/href-no-hash': 0, 'import/no-extraneous-dependencies': 0, + 'jsx-a11y/control-has-associated-label': 0, }); } diff --git a/components/_util/__tests__/util.test.js b/components/_util/__tests__/util.test.js index 2f581d8089..6f35f47be1 100644 --- a/components/_util/__tests__/util.test.js +++ b/components/_util/__tests__/util.test.js @@ -143,7 +143,7 @@ describe('Test utils function', () => { it('bindAnimationEvent should return when node is null', () => { const wrapper = mount( - , ).instance(); expect(wrapper.bindAnimationEvent()).toBe(undefined); @@ -152,7 +152,7 @@ describe('Test utils function', () => { it('bindAnimationEvent.onClick should return when children is hidden', () => { const wrapper = mount( - , ).instance(); expect(wrapper.bindAnimationEvent()).toBe(undefined); diff --git a/components/_util/throttleByAnimationFrame.tsx b/components/_util/throttleByAnimationFrame.tsx index 155366c6dc..78e9ee0367 100644 --- a/components/_util/throttleByAnimationFrame.tsx +++ b/components/_util/throttleByAnimationFrame.tsx @@ -20,6 +20,7 @@ export default function throttleByAnimationFrame(fn: (...args: any[]) => void) { } export function throttleByAnimationFrameDecorator() { + // eslint-disable-next-line func-names return function(target: any, key: string, descriptor: any) { const fn = descriptor.value; let definingProperty = false; diff --git a/components/badge/__tests__/__snapshots__/index.test.js.snap b/components/badge/__tests__/__snapshots__/index.test.js.snap index f1997291bb..d2ca4b512e 100644 --- a/components/badge/__tests__/__snapshots__/index.test.js.snap +++ b/components/badge/__tests__/__snapshots__/index.test.js.snap @@ -2907,7 +2907,9 @@ exports[`Badge should support offset when count is a ReactNode 1`] = ` + > + head + { it('should support offset when count is a ReactNode', () => { const wrapper = render( } offset={[10, 20]}> - + head , ); expect(wrapper).toMatchSnapshot(); diff --git a/components/carousel/__tests__/index.test.js b/components/carousel/__tests__/index.test.js index 85d4726854..e5a7407b08 100644 --- a/components/carousel/__tests__/index.test.js +++ b/components/carousel/__tests__/index.test.js @@ -87,7 +87,6 @@ describe('Carousel', () => {
, ); - jest.runAllTimers(); expect(wrapper.render()).toMatchSnapshot(); }); }); @@ -117,6 +116,11 @@ describe('Carousel', () => { }); it('should keep initialSlide', () => { + // react unsafe lifecycle don't works in React 15 + // https://github.com/akiran/react-slick/commit/97988e897750e1d8f7b10a86b655f50d75d38298 + if (process.env.REACT === '15') { + return; + } const wrapper = mount(); wrapper.setProps({ children: [
,
,
], diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 03708295f1..1b5c9645f9 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -221,7 +221,7 @@ export default class Form extends React.Component { static createFormField = createFormField; - static create = function( + static create = function create( options: FormCreateOption = {}, ): FormWrappedProps { return createDOMForm({ diff --git a/components/form/demo/customized-form-controls.md b/components/form/demo/customized-form-controls.md index 8063c8fec9..2f438b87d1 100644 --- a/components/form/demo/customized-form-controls.md +++ b/components/form/demo/customized-form-controls.md @@ -73,24 +73,27 @@ class PriceInput extends React.Component { // Should provide an event to pass value to Form. const { onChange } = this.props; if (onChange) { - onChange(Object.assign({}, this.state, changedValue)); + onChange({ + ...this.state, + ...changedValue, + }); } }; render() { const { size } = this.props; - const { state } = this; + const { currency, number } = this.state; return (