Skip to content

Commit d8d129a

Browse files
authored
chore(compass-query-bar): Prettier reformat (#3104)
1 parent 9fe494b commit d8d129a

25 files changed

+945
-756
lines changed

packages/compass-query-bar/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
Setting values via configure:
1010

1111
```js
12-
import Plugin, { configureStore, configureActions } from '@mongodb-js/compass-query-bar';
12+
import Plugin, {
13+
configureStore,
14+
configureActions,
15+
} from '@mongodb-js/compass-query-bar';
1316

1417
const actions = configureActions();
1518
const store = configureStore({
@@ -20,7 +23,7 @@ const store = configureStore({
2023
fields: [],
2124
});
2225

23-
<Plugin store={store} actions={actions} />
26+
<Plugin store={store} actions={actions} />;
2427
```
2528

2629
### Hadron/Electron
@@ -38,10 +41,10 @@ const store = configureStore({
3841
actions: actions,
3942
namespace: 'db.coll',
4043
serverVersion: '4.2.0',
41-
fields: []
44+
fields: [],
4245
});
4346

44-
<Plugin store={store} actions={actions} />
47+
<Plugin store={store} actions={actions} />;
4548
```
4649

4750
### Fields

packages/compass-query-bar/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
"typecheck": "tsc --noEmit",
4343
"eslint": "eslint",
4444
"prettier": "prettier",
45-
"lint": "npm run eslint .",
46-
"lint-skipped-for-now": "&& npm run prettier -- --check .",
45+
"lint": "npm run eslint . && npm run prettier -- --check .",
4746
"depcheck": "depcheck",
4847
"check": "npm run typecheck && npm run lint && npm run depcheck",
4948
"check-ci": "npm run check",

packages/compass-query-bar/src/actions/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const configureActions = () => {
8888
*/
8989
exportToLanguage: { sync: true },
9090
toggleQueryHistory: { sync: true },
91-
refreshEditor: { sync: true }
91+
refreshEditor: { sync: true },
9292
});
9393

9494
return actions;

packages/compass-query-bar/src/components/option-editor/option-editor.jsx

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { QueryAutoCompleter } from 'mongodb-ace-autocompleter';
4-
import { Editor, EditorVariant, EditorTextCompleter } from '@mongodb-js/compass-components';
4+
import {
5+
Editor,
6+
EditorVariant,
7+
EditorTextCompleter,
8+
} from '@mongodb-js/compass-components';
59

610
import styles from './option-editor.module.less';
711
class OptionEditor extends Component {
@@ -16,15 +20,15 @@ class OptionEditor extends Component {
1620
onChange: PropTypes.func,
1721
onApply: PropTypes.func,
1822
placeholder: PropTypes.string,
19-
schemaFields: PropTypes.array
23+
schemaFields: PropTypes.array,
2024
};
2125

2226
static defaultProps = {
2327
label: '',
2428
value: '',
2529
serverVersion: '3.6.0',
2630
autoPopulated: false,
27-
schemaFields: []
31+
schemaFields: [],
2832
};
2933

3034
/**
@@ -34,7 +38,11 @@ class OptionEditor extends Component {
3438
*/
3539
constructor(props) {
3640
super(props);
37-
this.completer = new QueryAutoCompleter(props.serverVersion, EditorTextCompleter, props.schemaFields);
41+
this.completer = new QueryAutoCompleter(
42+
props.serverVersion,
43+
EditorTextCompleter,
44+
props.schemaFields
45+
);
3846
this.boundOnFieldsChanged = this.onFieldsChanged.bind(this);
3947
}
4048

@@ -55,7 +63,10 @@ class OptionEditor extends Component {
5563
*/
5664
shouldComponentUpdate(nextProps) {
5765
this.boundOnFieldsChanged(nextProps.schemaFields);
58-
return nextProps.autoPopulated || nextProps.serverVersion !== this.props.serverVersion;
66+
return (
67+
nextProps.autoPopulated ||
68+
nextProps.serverVersion !== this.props.serverVersion
69+
);
5970
}
6071

6172
/**
@@ -77,8 +88,8 @@ class OptionEditor extends Component {
7788
onChangeQuery = (newCode) => {
7889
this.props.onChange({
7990
target: {
80-
value: newCode
81-
}
91+
value: newCode,
92+
},
8293
});
8394
};
8495

@@ -96,14 +107,14 @@ class OptionEditor extends Component {
96107
text={this.props.value}
97108
onChangeText={this.onChangeQuery}
98109
name={`query-bar-option-input-${this.props.label}`}
99-
options={({
110+
options={{
100111
useSoftTabs: true,
101112
minLines: 1,
102113
maxLines: 10,
103114
highlightActiveLine: false,
104115
showPrintMargin: false,
105-
showGutter: false
106-
})}
116+
showGutter: false,
117+
}}
107118
completer={this.completer}
108119
placeholder={this.props.placeholder}
109120
onLoad={(editor) => {
@@ -112,13 +123,15 @@ class OptionEditor extends Component {
112123
this.editor.commands.addCommand({
113124
name: 'executeQuery',
114125
bindKey: {
115-
win: 'Enter', mac: 'Enter'
126+
win: 'Enter',
127+
mac: 'Enter',
116128
},
117129
exec: () => {
118130
this.props.onApply();
119-
}
131+
},
120132
});
121-
}} />
133+
}}
134+
/>
122135
);
123136
}
124137
}

packages/compass-query-bar/src/components/option-editor/option-editor.spec.jsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ import configureActions from '../../actions';
88

99
import styles from './option-editor.module.less';
1010

11-
describe('OptionEditor [Component]', function() {
11+
describe('OptionEditor [Component]', function () {
1212
let onChangeSpy;
1313
let onApplySpy;
1414
let component;
1515

16-
beforeEach(function() {
16+
beforeEach(function () {
1717
onChangeSpy = sinon.spy();
1818
onApplySpy = sinon.spy();
1919
});
2020

21-
afterEach(function() {
21+
afterEach(function () {
2222
onChangeSpy = null;
2323
onApplySpy = null;
2424
});
2525

26-
context('when rendering the component', function() {
27-
before(function() {
26+
context('when rendering the component', function () {
27+
before(function () {
2828
component = mount(
2929
<OptionEditor
3030
label="Apply"
@@ -34,19 +34,20 @@ describe('OptionEditor [Component]', function() {
3434
value="{ name: 'testing' }"
3535
onChange={onChangeSpy}
3636
onApply={onApplySpy}
37-
schemaFields={[]} />
37+
schemaFields={[]}
38+
/>
3839
);
3940
});
4041

41-
after(function() {
42+
after(function () {
4243
component = null;
4344
});
4445

45-
it('renders the editor', function() {
46+
it('renders the editor', function () {
4647
expect(component.find('#query-bar-option-input-Apply')).to.be.present();
4748
});
4849

49-
it('has the correct class', function() {
50+
it('has the correct class', function () {
5051
expect(component.find(`.${styles['option-editor']}`)).to.be.present();
5152
});
5253
});

packages/compass-query-bar/src/components/options-toggle/options-toggle.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class OptionsToggle extends PureComponent {
1111
static propTypes = {
1212
actions: PropTypes.object.isRequired,
1313
className: PropTypes.string,
14-
expanded: PropTypes.bool.isRequired
14+
expanded: PropTypes.bool.isRequired,
1515
};
1616

1717
static defaultProps = {
18-
className: ''
18+
className: '',
1919
};
2020

2121
onClick = () => {
@@ -31,7 +31,7 @@ class OptionsToggle extends PureComponent {
3131
'btn-default',
3232
'btn-xs',
3333
styles.component,
34-
{ [ styles['is-open'] ]: expanded },
34+
{ [styles['is-open']]: expanded },
3535
className
3636
);
3737

packages/compass-query-bar/src/components/options-toggle/options-toggle.spec.jsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,47 @@ import FontAwesome from 'react-fontawesome';
66

77
import OptionsToggle from '.';
88

9-
describe('OptionsToggle [Component]', function() {
9+
describe('OptionsToggle [Component]', function () {
1010
let actions;
1111

12-
beforeEach(function(done) {
12+
beforeEach(function (done) {
1313
actions = { toggleQueryOptions: sinon.stub() };
1414
done();
1515
});
1616

17-
afterEach(function(done) {
17+
afterEach(function (done) {
1818
actions = null;
1919
done();
2020
});
2121

22-
describe('#rendering', function() {
23-
it('should render the correct icon when it is not expanded', function() {
24-
const component = shallow(<OptionsToggle actions={actions} expanded={false} />);
22+
describe('#rendering', function () {
23+
it('should render the correct icon when it is not expanded', function () {
24+
const component = shallow(
25+
<OptionsToggle actions={actions} expanded={false} />
26+
);
2527
expect(component.find(FontAwesome)).to.have.prop('name', 'caret-right');
2628
});
2729

28-
it('should render the correct icon when it is expanded', function() {
30+
it('should render the correct icon when it is expanded', function () {
2931
const component = shallow(<OptionsToggle actions={actions} expanded />);
3032
expect(component.find(FontAwesome)).to.have.prop('name', 'caret-down');
3133
});
3234

33-
it('should render the correct text', function() {
34-
const component = shallow(<OptionsToggle actions={actions} expanded={false} />);
35-
expect(component.find('[data-test-id="query-bar-options-toggle-text"]')).to.have.text('Options');
35+
it('should render the correct text', function () {
36+
const component = shallow(
37+
<OptionsToggle actions={actions} expanded={false} />
38+
);
39+
expect(
40+
component.find('[data-test-id="query-bar-options-toggle-text"]')
41+
).to.have.text('Options');
3642
});
3743
});
3844

39-
describe('#behaviour', function() {
40-
it('should trigger the toggleQueryOptions action when clicked', function() {
41-
const component = shallow(<OptionsToggle actions={actions} expanded={false} />);
45+
describe('#behaviour', function () {
46+
it('should trigger the toggleQueryOptions action when clicked', function () {
47+
const component = shallow(
48+
<OptionsToggle actions={actions} expanded={false} />
49+
);
4250

4351
component.simulate('click');
4452
expect(actions.toggleQueryOptions).to.be.calledOnce;

0 commit comments

Comments
 (0)