Skip to content

Commit 2e6a585

Browse files
committed
add prettier config back and apply this to the updated files
1 parent 6155eb4 commit 2e6a585

File tree

3 files changed

+157
-144
lines changed

3 files changed

+157
-144
lines changed

.prettierrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"overrides": [
5+
{
6+
"files": "./src/sass/**/*.scss",
7+
"options": {
8+
"semi": true,
9+
"singleQuote": false
10+
}
11+
}
12+
]
13+
}

src/rate-spread/CSVUpload.jsx

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
1-
import React, { Component } from "react";
2-
import fileSaver from "file-saver";
3-
import LoadingIcon from "../shared-components/LoadingIcon.jsx";
4-
import Alert from "../shared-components/Alert.jsx";
5-
import Header from "../shared-components/Header.jsx";
6-
import runFetch from "./runFetch.js";
1+
import React, { Component } from 'react'
2+
import fileSaver from 'file-saver'
3+
import LoadingIcon from '../shared-components/LoadingIcon.jsx'
4+
import Alert from '../shared-components/Alert.jsx'
5+
import Header from '../shared-components/Header.jsx'
6+
import runFetch from './runFetch.js'
77

8-
import "./CSVUpload.css";
8+
import './CSVUpload.css'
99

1010
const defaultState = {
1111
isFetching: false,
12-
filename: "",
12+
filename: '',
1313
error: false
14-
};
14+
}
1515

1616
class CSVUpload extends Component {
1717
constructor(props) {
18-
super(props);
19-
this.state = defaultState;
20-
this.handleCSVSelect = this.handleCSVSelect.bind(this);
18+
super(props)
19+
this.state = defaultState
20+
this.handleCSVSelect = this.handleCSVSelect.bind(this)
2121

22-
this.refScrollTo = React.createRef();
22+
this.refScrollTo = React.createRef()
2323
}
2424

2525
componentDidUpdate(prevProps, prevState) {
2626
if (this.state.isFetching) {
2727
window.scrollTo({
2828
top: this.refScrollTo.current.offsetTop,
29-
behavior: "smooth"
30-
});
29+
behavior: 'smooth'
30+
})
3131
}
3232
}
3333

3434
onCSVFetch() {
35-
this.setState({ isFetching: true, error: false });
35+
this.setState({ isFetching: true, error: false })
3636
}
3737

3838
onCSVCalculated(response, file) {
3939
if (response.status) {
4040
return this.setState({
4141
isFetching: false,
4242
error: true
43-
});
43+
})
4444
}
4545

46-
const filename = "calculated-" + file.name;
46+
const filename = 'calculated-' + file.name
4747

4848
this.setState({
4949
isFetching: false,
5050
filename: filename
51-
});
51+
})
5252

5353
return fileSaver.saveAs(
54-
new Blob([response], { type: "text/csv;charset=utf-16" }),
54+
new Blob([response], { type: 'text/csv;charset=utf-16' }),
5555
filename
56-
);
56+
)
5757
}
5858

5959
handleCSVSelect(event) {
60-
event.preventDefault();
61-
const file = event.target.files[0];
62-
if (!file) return;
60+
event.preventDefault()
61+
const file = event.target.files[0]
62+
if (!file) return
6363

64-
event.target.value = null;
64+
event.target.value = null
6565

66-
this.onCSVFetch();
67-
const CSV_URL = "https://ffiec-api.cfpb.gov/public/rateSpread/csv";
66+
this.onCSVFetch()
67+
const CSV_URL = 'https://ffiec-api.cfpb.gov/public/rateSpread/csv'
6868
runFetch(CSV_URL, this.prepareCSVBody(file), true).then(res => {
69-
this.onCSVCalculated(res, file);
70-
});
69+
this.onCSVCalculated(res, file)
70+
})
7171
}
7272

7373
prepareCSVBody(file) {
74-
const data = new FormData();
75-
data.append("file", file);
76-
return data;
74+
const data = new FormData()
75+
data.append('file', file)
76+
return data
7777
}
7878

7979
render() {
@@ -97,10 +97,10 @@ class CSVUpload extends Component {
9797
</label>
9898
</p>
9999
<p className="text-small">
100-
Please see{" "}
100+
Please see{' '}
101101
<a href="http://cfpb.github.io/hmda-platform/rate-spread/#batch">
102102
the batch section of the API documentation
103-
</a>{" "}
103+
</a>{' '}
104104
for information on csv formatting.
105105
</p>
106106
</div>
@@ -114,7 +114,7 @@ class CSVUpload extends Component {
114114
>
115115
<p>
116116
Please check your file format and try again later. If the
117-
problem persists, contact{" "}
117+
problem persists, contact{' '}
118118
<a href="mailto:[email protected]">HMDA Help</a>.
119119
</p>
120120
</Alert>
@@ -131,8 +131,8 @@ class CSVUpload extends Component {
131131
) : null}
132132
</div>
133133
</div>
134-
);
134+
)
135135
}
136136
}
137137

138-
export default CSVUpload;
138+
export default CSVUpload

0 commit comments

Comments
 (0)