Eslint prefer-object-spread (#9466)

* The rule.

* The result
This commit is contained in:
Evan Rusackas
2020-04-03 17:05:16 -07:00
committed by GitHub
parent 265a2feb29
commit 1cdfb829d7
29 changed files with 211 additions and 266 deletions

View File

@@ -116,7 +116,7 @@ describe('AlteredSliceTag', () => {
let props;
beforeEach(() => {
props = Object.assign({}, defaultProps);
props = { ...defaultProps };
wrapper = shallow(<AlteredSliceTag {...props} />);
});
@@ -140,8 +140,8 @@ describe('AlteredSliceTag', () => {
it('sets new diffs when receiving new props', () => {
const newProps = {
currentFormData: Object.assign({}, props.currentFormData),
origFormData: Object.assign({}, props.origFormData),
currentFormData: { ...props.currentFormData },
origFormData: { ...props.origFormData },
};
newProps.currentFormData.beta = 10;
wrapper = shallow(<AlteredSliceTag {...props} />);

View File

@@ -30,7 +30,7 @@ describe('Checkbox', () => {
let wrapper;
const factory = o => {
const props = Object.assign({}, defaultProps, o);
const props = { ...defaultProps, ...o };
return shallow(<Checkbox {...props} />);
};
beforeEach(() => {

View File

@@ -39,7 +39,7 @@ describe('ColumnOption', () => {
const factory = o => <ColumnOption {...o} />;
beforeEach(() => {
wrapper = shallow(factory(defaultProps));
props = Object.assign({}, defaultProps);
props = { ...defaultProps };
});
it('is a valid element', () => {
expect(React.isValidElement(<ColumnOption {...defaultProps} />)).toBe(true);

View File

@@ -40,7 +40,7 @@ describe('MetricOption', () => {
const factory = o => <MetricOption {...o} />;
beforeEach(() => {
wrapper = shallow(factory(defaultProps));
props = Object.assign({}, defaultProps);
props = { ...defaultProps };
});
it('is a valid element', () => {
expect(React.isValidElement(<MetricOption {...defaultProps} />)).toBe(true);

View File

@@ -54,9 +54,9 @@ describe('OnPasteSelect', () => {
let evt;
let expected;
beforeEach(() => {
props = Object.assign({}, defaultProps);
props = { ...defaultProps };
wrapper = shallow(<OnPasteSelect {...props} />);
evt = Object.assign({}, defaultEvt);
evt = { ...defaultEvt };
});
it('renders the supplied selectWrap component', () => {

View File

@@ -34,7 +34,7 @@ describe('OptionDescription', () => {
let props;
beforeEach(() => {
props = { option: Object.assign({}, defaultProps.option) };
props = { option: { ...defaultProps.option } };
wrapper = shallow(<OptionDescription {...props} />);
});

View File

@@ -32,7 +32,7 @@ describe('PopoverSection', () => {
let wrapper;
const factory = overrideProps => {
const props = Object.assign({}, defaultProps, overrideProps || {});
const props = { ...defaultProps, ...(overrideProps || {}) };
return shallow(<PopoverSection {...props} />);
};
beforeEach(() => {

View File

@@ -48,7 +48,7 @@ describe('VirtualizedRendererWrap', () => {
let props;
beforeEach(() => {
wrapper = shallow(<RendererWrap {...defaultProps} />);
props = Object.assign({}, defaultProps);
props = { ...defaultProps };
});
it('uses the provided renderer', () => {