Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade prettier to 1.4.2. #434

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,649 changes: 5,649 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "rimraf build && NODE_ENV=production node_modules/.bin/webpack --progress --config webpack.prod.js && cp html/prod.html build/index.html",
"build:lib": "rimraf lib && NODE_ENV=production babel -d lib/ src/",
"build:readme": "toctoc README.md -w",
"cs-check": "prettier-check $npm_package_prettierOptions '{src,test}/**/*.js'",
"cs-check": "prettier -l $npm_package_prettierOptions '{src,test}/**/*.js'",
"cs-format": "prettier $npm_package_prettierOptions '{src,test}/**/*.js' --write",
"flow-check": "node_modules/.bin/flow check",
"lint": "node_modules/.bin/eslint src test test-browser",
Expand Down Expand Up @@ -93,8 +93,7 @@
"mocha": "^3.0.2",
"mocha-generators": "^1.2.0",
"nightmare": "^2.7.0",
"prettier": "^1.0.0",
"prettier-check": "^1.0.0",
"prettier": "^1.4.2",
"react-addons-test-utils": "^15.2.0",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
Expand Down
5 changes: 3 additions & 2 deletions src/actions/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ export function logout(): {
}

function navigateToFxA(server: string, redirect: string): NavigationResult {
document.location
.href = `${server}/fxa-oauth/login?redirect=${encodeURIComponent(redirect)}`;
document.location.href = `${server}/fxa-oauth/login?redirect=${encodeURIComponent(
redirect
)}`;
return { type: null };
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class App extends PureComponent {
content,
notificationList,
routes,
params,
params = {},
} = this.props;
const notificationsClass = notificationList.length
? " with-notifications"
Expand Down
4 changes: 2 additions & 2 deletions src/components/AuthForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class ServerHistory extends PureComponent {
? <li>
<a onClick={this.toggleMenu}><em>No server history</em></a>
</li>
: history.map((server, key) => (
: history.map((server, key) =>
<li key={key}>
<a href="#" onClick={this.select(server)}>{server}</a>
</li>
))}
)}
<li role="separator" className="divider" />
<li><a href="#" onClick={this.clear}>Clear</a></li>
</ul>
Expand Down
26 changes: 13 additions & 13 deletions src/components/HistoryTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ class HistoryRow extends PureComponent {
{busy
? <Spinner />
: previous
? <Diff source={entry.target} target={previous.target} />
: error
? <p className="alert alert-danger">{error}</p>
: <pre>{JSON.stringify(entry.target, null, 2)}</pre>}
? <Diff source={entry.target} target={previous.target} />
: error
? <p className="alert alert-danger">{error}</p>
: <pre>{JSON.stringify(entry.target, null, 2)}</pre>}
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -389,15 +389,15 @@ export default class HistoryTable extends PureComponent {
{cid && diffOverview && since
? <DiffOverview since={since} source={current} target={previous} />
: !historyLoaded
? <Spinner />
: <PaginatedTable
colSpan={6}
thead={thead}
tbody={tbody}
dataLoaded={historyLoaded}
hasNextPage={hasNextHistory}
listNextPage={listNextHistory}
/>}
? <Spinner />
: <PaginatedTable
colSpan={6}
thead={thead}
tbody={tbody}
dataLoaded={historyLoaded}
hasNextPage={hasNextHistory}
listNextPage={listNextHistory}
/>}
</div>
);
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function ServerProps({ node }: { node: Object }) {
? <ServerProps node={childNode} />
: typeof childNode === "string" &&
childNode.startsWith("http")
? <a href={childNode} target="_blank">{childNode}</a>
: String(childNode)}
? <a href={childNode} target="_blank">{childNode}</a>
: String(childNode)}
</td>
</tr>
);
Expand Down Expand Up @@ -75,15 +75,15 @@ export default class HomePage extends PureComponent {
{busy
? <Spinner />
: authenticated
? <SessionInfo session={session} />
: <AuthForm
setup={setup}
session={session}
settings={settings}
history={history}
clearHistory={clearHistory}
navigateToExternalAuth={navigateToExternalAuth}
/>}
? <SessionInfo session={session} />
: <AuthForm
setup={setup}
session={session}
settings={settings}
history={history}
clearHistory={clearHistory}
navigateToExternalAuth={navigateToExternalAuth}
/>}
</div>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export class Notification extends PureComponent {
onClick={this.expand}
title="Error details">
<i
className={`glyphicon glyphicon-triangle-${expanded ? "bottom" : "right"}`}
className={`glyphicon glyphicon-triangle-${expanded
? "bottom"
: "right"}`}
/>
</a>}
</p>
Expand Down
3 changes: 2 additions & 1 deletion src/components/PermissionsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default class PermissionsForm extends PureComponent {
if (readonly) {
return (
<div className="alert alert-warning">
You don't have the required permission to edit the permissions for this resource.
You don't have the required permission to edit the permissions for
this resource.
</div>
);
}
Expand Down
8 changes: 6 additions & 2 deletions src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,16 @@ class BucketsMenu extends PureComponent {
return (
<div
key={i}
className={`panel panel-${current ? "info" : "default"} bucket-menu`}>
className={`panel panel-${current
? "info"
: "default"} bucket-menu`}>
<div className="panel-heading">
{bucket.readonly
? <i className="glyphicon glyphicon-lock" />
: <i
className={`glyphicon glyphicon-folder-${current ? "open" : "close"}`}
className={`glyphicon glyphicon-folder-${current
? "open"
: "close"}`}
/>}
<strong>{id}</strong> bucket
<SideBarLink
Expand Down
6 changes: 4 additions & 2 deletions src/components/TagsField.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export default class TagsField extends PureComponent {

onChange = ({
target: { value: tagsString },
}: { target: { value: string } }) => {
}: {
target: { value: string },
}) => {
const { schema: { uniqueItems = false }, onChange } = this.props;
const tags = toTagList(tagsString, this.separator, uniqueItems);
this.setState({ tagsString });
Expand All @@ -79,7 +81,7 @@ export default class TagsField extends PureComponent {
value={tagsString}
placeholder={
uiSchema["ui:placeholder"] ||
toTagsString(["tag1", "tag2", "tag3"], this.separator)
toTagsString(["tag1", "tag2", "tag3"], this.separator)
}
onChange={this.onChange}
required={required}
Expand Down
9 changes: 7 additions & 2 deletions src/components/collection/CollectionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export default class CollectionCreate extends PureComponent {
};

render() {
const { params, session, bucket, collection, createCollection } = this
.props;
const {
params,
session,
bucket,
collection,
createCollection,
} = this.props;
const { bid } = params;
const { busy } = session;
if (busy) {
Expand Down
18 changes: 13 additions & 5 deletions src/components/collection/CollectionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,17 @@ const uiSchema = {
"attachment",
],
id: {
"ui:help": "The name should only contain letters, numbers, dashes or underscores.",
"ui:help":
"The name should only contain letters, numbers, dashes or underscores.",
},
schema: {
"ui:widget": JSONEditor,
"ui:help": (
<p>
This must be a valid
<a href="http://json-schema.org/" target="_blank"> JSON schema </a>
defining an object representing the structure of your collection records.
defining an object representing the structure of your collection
records.
You may find this
<a href="http://jsonschema.net/" target="_blank">
{" online schema builder "}
Expand All @@ -201,7 +203,8 @@ const uiSchema = {
"ui:help": "Enable attachment of a single file to records.",
},
required: {
"ui:help": "Require a file to be attached to each record in the collection.",
"ui:help":
"Require a file to be attached to each record in the collection.",
},
gzipped: {
"ui:help": "Enable gzipping file on server side on upload.",
Expand Down Expand Up @@ -339,8 +342,13 @@ export default class CollectionForm extends PureComponent {
};

render() {
const { cid, bucket, collection, formData = {}, deleteCollection } = this
.props;
const {
cid,
bucket,
collection,
formData = {},
deleteCollection,
} = this.props;
const creation = !formData.id;
const showDeleteForm = !creation && this.allowEditing;
const { asJSON } = this.state;
Expand Down
4 changes: 3 additions & 1 deletion src/components/collection/JSONCollectionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export default class JSONCollectionForm extends PureComponent {

onSubmit = ({
formData,
}: { formData: { id: string, data: string } }): void => {
}: {
formData: { id: string, data: string },
}): void => {
const collectionData = { ...JSON.parse(formData.data), id: formData.id };
this.props.onSubmit({ formData: collectionData });
};
Expand Down
10 changes: 8 additions & 2 deletions src/components/group/GroupForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,14 @@ export default class GroupForm extends PureComponent {
};

render() {
const { gid, session, bucket, group, formData = {}, deleteGroup } = this
.props;
const {
gid,
session,
bucket,
group,
formData = {},
deleteGroup,
} = this.props;
const creation = !formData.id;
const hasWriteAccess = creation
? canCreateGroup(session, bucket)
Expand Down
3 changes: 2 additions & 1 deletion src/components/record/RecordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ export default class RecordForm extends PureComponent {
<div>
{emptySchema &&
<div className="alert alert-warning">
This collection doesn't have any JSON schema defined, though you can
This collection doesn't have any JSON schema defined, though you
can
create free-form records entering raw JSON.
</div>}
<JSONRecordForm
Expand Down
3 changes: 1 addition & 2 deletions src/containers/collection/CollectionAttributesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import type { Dispatch, ActionCreatorOrObjectOfACs } from "redux";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";

import CollectionAttributes
from "../../components/collection/CollectionAttributes";
import CollectionAttributes from "../../components/collection/CollectionAttributes";
import * as BucketActions from "../../actions/bucket";

function mapStateToProps(state: AppState) {
Expand Down
3 changes: 1 addition & 2 deletions src/containers/collection/CollectionPermissionsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import type { Dispatch, ActionCreatorOrObjectOfACs } from "redux";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";

import CollectionPermissions
from "../../components/collection/CollectionPermissions";
import CollectionPermissions from "../../components/collection/CollectionPermissions";
import * as BucketActions from "../../actions/bucket";

function mapStateToProps(state: AppState) {
Expand Down
6 changes: 4 additions & 2 deletions src/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ export function preparePermissionsForm(
can be a user ID or a group URI
</a>
.
The write permissions is always granted to the user that edited the object.
The write permissions is always granted to the user that edited the
object.
</p>
),
type: "array",
Expand Down Expand Up @@ -337,7 +338,8 @@ export function preparePermissionsForm(
items: {
principal: {
classNames: "field-principal",
"ui:placeholder": "Principal, eg. basicauth:alice, /buckets/x/groups/y",
"ui:placeholder":
"Principal, eg. basicauth:alice, /buckets/x/groups/y",
},
permissions: {
"ui:widget": "checkboxes",
Expand Down
10 changes: 6 additions & 4 deletions src/plugins/signoff/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export default class SignoffToolBar extends React.Component {
: <div className="alert alert-warning">
<p>
<b>
Plugin which tracks history of changes is not enabled on this server.
Plugin which tracks history of changes is not enabled on this
server.
</b>
Please reach to the server administrator.
</p>
Expand Down Expand Up @@ -379,9 +380,10 @@ function DiffStats(props: { updated: number, deleted: number }) {
);
}

function ReviewButtons(
props: { onApprove: () => void, onDecline: () => void }
) {
function ReviewButtons(props: {
onApprove: () => void,
onDecline: () => void,
}) {
const { onApprove, onDecline } = props;
return (
<div className="btn-group">
Expand Down
12 changes: 4 additions & 8 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ import GroupCreatePage from "./containers/group/GroupCreatePage";
import GroupAttributesPage from "./containers/group/GroupAttributesPage";
import GroupPermissionsPage from "./containers/group/GroupPermissionsPage";
import GroupHistoryPage from "./containers/group/GroupHistoryPage";
import CollectionRecordsPage
from "./containers/collection/CollectionRecordsPage";
import CollectionHistoryPage
from "./containers/collection/CollectionHistoryPage";
import CollectionRecordsPage from "./containers/collection/CollectionRecordsPage";
import CollectionHistoryPage from "./containers/collection/CollectionHistoryPage";
import CollectionCreatePage from "./containers/collection/CollectionCreatePage";
import CollectionAttributesPage
from "./containers/collection/CollectionAttributesPage";
import CollectionPermissionsPage
from "./containers/collection/CollectionPermissionsPage";
import CollectionAttributesPage from "./containers/collection/CollectionAttributesPage";
import CollectionPermissionsPage from "./containers/collection/CollectionPermissionsPage";
import RecordCreatePage from "./containers/record/RecordCreatePage";
import RecordBulkPage from "./containers/record/RecordBulkPage";
import RecordAttributesPage from "./containers/record/RecordAttributesPage";
Expand Down
6 changes: 4 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export function validateSchema(jsonSchema: string) {
}

export function validateUiSchema(jsonUiSchema: string, jsonSchema: string) {
let uiSchema: Object, schema: Object = JSON.parse(jsonSchema);
let uiSchema: Object,
schema: Object = JSON.parse(jsonSchema);
try {
uiSchema = JSON.parse(jsonUiSchema);
} catch (err) {
Expand Down Expand Up @@ -182,7 +183,8 @@ export function renderDisplayField(record: Object, displayField: string): any {
if (typeof field === "string") {
return linkify(field);
} else if (
Array.isArray(field) && field.every(x => typeof x === "string")
Array.isArray(field) &&
field.every(x => typeof x === "string")
) {
return field.join(", ");
} else if (typeof field === "object") {
Expand Down
Loading