@@ -76,7 +76,7 @@ const HomeSplash = props => {
};
HomeSplash.propTypes = {
- language: PropTypes.string
+ language: PropTypes.string,
};
const TldrSection = ({ language }) => (
@@ -86,7 +86,7 @@ const TldrSection = ({ language }) => (
style={{
display: "flex",
flexFlow: "row wrap",
- justifyContent: "space-evenly"
+ justifyContent: "space-evenly",
}}
>
@@ -115,7 +115,7 @@ const TldrSection = ({ language }) => (
);
TldrSection.propTypes = {
- language: PropTypes.string
+ language: PropTypes.string,
};
const Language = ({ name, nameLink, showName, image, variants }) => (
@@ -124,7 +124,7 @@ const Language = ({ name, nameLink, showName, image, variants }) => (
style={{
display: "flex",
alignItems: "flex-start",
- paddingBottom: "1em"
+ paddingBottom: "1em",
}}
>

@@ -134,7 +134,7 @@ const Language = ({ name, nameLink, showName, image, variants }) => (
{nameLink ?
{name} : name}
)}
- {variants.map(variant => (
+ {variants.map((variant) => (
{variant}
@@ -148,7 +148,7 @@ Language.propTypes = {
nameLink: PropTypes.string,
showName: PropTypes.bool,
image: PropTypes.string,
- variants: PropTypes.array
+ variants: PropTypes.array,
};
const LanguagesSection = () => {
@@ -182,12 +182,12 @@ const LanguagesSection = () => {
style={{
display: "flex",
flexFlow: "row wrap",
- justifyContent: "space-around"
+ justifyContent: "space-around",
}}
>
{languageChunks.map((languageChunk, index) => (
- {languageChunk.map(language => (
+ {languageChunk.map((language) => (
))}
@@ -211,7 +211,7 @@ const Editor = ({ content = "", image, name }) => (
Editor.propTypes = {
content: PropTypes.string,
image: PropTypes.string.isRequired,
- name: PropTypes.string.isRequired
+ name: PropTypes.string.isRequired,
};
const EditorSupportSection = () => (
@@ -222,10 +222,10 @@ const EditorSupportSection = () => (
style={{
display: "flex",
flexFlow: "row wrap",
- justifyContent: "space-around"
+ justifyContent: "space-around",
}}
>
- {siteConfig.editors.map(editor => (
+ {siteConfig.editors.map((editor) => (
))}
@@ -245,13 +245,13 @@ const EditorSupportSection = () => (
const bash = (...args) => `~~~bash\n${String.raw(...args)}\n~~~`;
-const json = object => `~~~json\n${JSON.stringify(object, null, 2)}\n~~~`;
+const json = (object) => `~~~json\n${JSON.stringify(object, null, 2)}\n~~~`;
class GetStartedSection extends React.Component {
constructor(props) {
super(props);
this.state = {
- npmClient: "yarn"
+ npmClient: "yarn",
};
}
@@ -265,7 +265,7 @@ class GetStartedSection extends React.Component {
display: "flex",
flexFlow: "row",
alignItems: "baseline",
- justifyContent: "space-between"
+ justifyContent: "space-between",
}}
>
@@ -314,9 +314,9 @@ class GetStartedSection extends React.Component {
{json({
husky: {
hooks: {
- "pre-commit": "pretty-quick --staged"
- }
- }
+ "pre-commit": "pretty-quick --staged",
+ },
+ },
})}
@@ -328,7 +328,7 @@ class GetStartedSection extends React.Component {
flexDirection: "column",
alignItems: "flex-end",
flexGrow: 1,
- marginLeft: "-75px"
+ marginLeft: "-75px",
}}
>
@@ -342,7 +342,7 @@ class GetStartedSection extends React.Component {
@@ -356,7 +356,7 @@ class GetStartedSection extends React.Component {
const UsersSection = ({ language }) => {
const showcase = siteConfig.users
- .filter(user => {
+ .filter((user) => {
return user.pinned;
})
.map((user, i) => {
@@ -376,7 +376,7 @@ const UsersSection = ({ language }) => {
style={{
display: "flex",
flexFlow: "row wrap",
- justifyContent: "space-around"
+ justifyContent: "space-around",
}}
>
{showcase}
@@ -403,7 +403,7 @@ const UsersSection = ({ language }) => {
style={{
display: "flex",
justifyContent: "space-around",
- flexFlow: "row wrap"
+ flexFlow: "row wrap",
}}
>
@@ -446,7 +446,7 @@ const UsersSection = ({ language }) => {
};
UsersSection.propTypes = {
- language: PropTypes.string
+ language: PropTypes.string,
};
class Index extends React.Component {
@@ -470,7 +470,7 @@ class Index extends React.Component {
}
Index.propTypes = {
- language: PropTypes.string
+ language: PropTypes.string,
};
module.exports = Index;
diff --git a/website/pages/en/users/index.js b/website/pages/en/users/index.js
index 2a7dbd835..3e2a55281 100644
--- a/website/pages/en/users/index.js
+++ b/website/pages/en/users/index.js
@@ -52,7 +52,7 @@ class Users extends React.Component {
}
Users.defaultProps = {
- language: "en"
+ language: "en",
};
Users.title = "Who's using Prettier?";
diff --git a/website/playground/BottomBar.js b/website/playground/BottomBar.js
index 52219bbfb..365479e95 100644
--- a/website/playground/BottomBar.js
+++ b/website/playground/BottomBar.js
@@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
const root = document.getElementById("bottom-bar");
-export default function({ left, right }) {
+export default function ({ left, right }) {
return ReactDOM.createPortal(
{left}
diff --git a/website/playground/EditorState.js b/website/playground/EditorState.js
index 9b4c73630..034b8a06f 100644
--- a/website/playground/EditorState.js
+++ b/website/playground/EditorState.js
@@ -15,7 +15,7 @@ export default class extends React.Component {
toggleAst: () => this.setState(stateToggler("showAst")),
toggleDoc: () => this.setState(stateToggler("showDoc")),
toggleSecondFormat: () => this.setState(stateToggler("showSecondFormat")),
- ...storage.get("editor_state")
+ ...storage.get("editor_state"),
};
}
diff --git a/website/playground/Playground.js b/website/playground/Playground.js
index 4b0f90831..55e910af9 100644
--- a/website/playground/Playground.js
+++ b/website/playground/Playground.js
@@ -21,7 +21,7 @@ const CATEGORIES_ORDER = [
"JavaScript",
"Markdown",
"HTML",
- "Special"
+ "Special",
];
const ENABLED_OPTIONS = [
"parser",
@@ -40,7 +40,7 @@ const ENABLED_OPTIONS = [
"htmlWhitespaceSensitivity",
"insertPragma",
"requirePragma",
- "vueIndentScriptAndStyle"
+ "vueIndentScriptAndStyle",
];
const ISSUES_URL = "https://github.com/prettier/prettier/issues/new?body=";
const MAX_LENGTH = 8000 - ISSUES_URL.length; // it seems that GitHub limit is 8195
@@ -65,16 +65,16 @@ class Playground extends React.Component {
this.handleOptionValueChange = this.handleOptionValueChange.bind(this);
- this.setContent = content => this.setState({ content });
+ this.setContent = (content) => this.setState({ content });
this.clearContent = this.setContent.bind(this, "");
this.resetOptions = () => this.setState({ options: defaultOptions });
this.enabledOptions = orderOptions(props.availableOptions, ENABLED_OPTIONS);
this.rangeStartOption = props.availableOptions.find(
- opt => opt.name === "rangeStart"
+ (opt) => opt.name === "rangeStart"
);
this.rangeEndOption = props.availableOptions.find(
- opt => opt.name === "rangeEnd"
+ (opt) => opt.name === "rangeEnd"
);
}
@@ -89,7 +89,7 @@ class Playground extends React.Component {
}
handleOptionValueChange(option, value) {
- this.setState(state => {
+ this.setState((state) => {
const options = { ...state.options };
if (option.type === "int" && isNaN(value)) {
@@ -130,7 +130,7 @@ class Playground extends React.Component {
return (
- {editorState => (
+ {(editorState) => (
optionsByName[name]);
+ return order.map((name) => optionsByName[name]);
}
function getReportLink(reportBody) {
diff --git a/website/playground/PrettierFormat.js b/website/playground/PrettierFormat.js
index bb29d81fe..16cd4c268 100644
--- a/website/playground/PrettierFormat.js
+++ b/website/playground/PrettierFormat.js
@@ -26,12 +26,12 @@ export default class PrettierFormat extends React.Component {
options,
debugAst: ast,
debugDoc: doc,
- reformat
+ reformat,
} = this.props;
worker
.format(code, options, { ast, doc, reformat })
- .then(result => this.setState(result));
+ .then((result) => this.setState(result));
}
render() {
diff --git a/website/playground/VersionLink.js b/website/playground/VersionLink.js
index 060b557d5..c6d8b5b68 100644
--- a/website/playground/VersionLink.js
+++ b/website/playground/VersionLink.js
@@ -3,7 +3,7 @@ import ReactDOM from "react-dom";
const root = document.getElementById("version");
-export default function({ version }) {
+export default function ({ version }) {
const match = version.match(/^pr-(\d+)$/);
let href;
if (match) {
diff --git a/website/playground/WorkerApi.js b/website/playground/WorkerApi.js
index d85055f92..8deae41df 100644
--- a/website/playground/WorkerApi.js
+++ b/website/playground/WorkerApi.js
@@ -1,9 +1,9 @@
-export default function(source) {
+export default function (source) {
const worker = new Worker(source);
let counter = 0;
const handlers = {};
- worker.addEventListener("message", event => {
+ worker.addEventListener("message", (event) => {
const { uid, message, error } = event.data;
if (!handlers[uid]) {
@@ -35,6 +35,6 @@ export default function(source) {
format(code, options, debug) {
return postMessage({ type: "format", code, options, debug });
},
- postMessage
+ postMessage,
};
}
diff --git a/website/playground/buttons.js b/website/playground/buttons.js
index c7dbcc65a..f104752c7 100644
--- a/website/playground/buttons.js
+++ b/website/playground/buttons.js
@@ -18,7 +18,7 @@ export class ClipboardButton extends React.Component {
text: () => {
const { copy } = this.props;
return typeof copy === "function" ? copy() : copy;
- }
+ },
});
this.clipboard.on("success", () => this.showTooltip("Copied!"));
this.clipboard.on("error", () => this.showTooltip("Press ctrl+c to copy"));
diff --git a/website/playground/codeSamples.js b/website/playground/codeSamples.js
index f2fa576f8..74b170a72 100644
--- a/website/playground/codeSamples.js
+++ b/website/playground/codeSamples.js
@@ -1,4 +1,4 @@
-export default function(parser) {
+export default function (parser) {
switch (parser) {
case "babel":
return [
@@ -22,7 +22,7 @@ export default function(parser) {
"",
" ;",
"",
- "}"
+ "}",
].join("\n");
case "flow":
case "babel-flow":
@@ -34,7 +34,7 @@ export default function(parser) {
" mutate: Function|void",
" }>>",
"",
- 'declare type FetchPolicy = "cache-first" | "cache-and-network" | "network-only" | "cache-only"'
+ 'declare type FetchPolicy = "cache-first" | "cache-and-network" | "network-only" | "cache-only"',
].join("\n");
case "typescript":
case "babel-ts":
@@ -57,7 +57,7 @@ export default function(parser) {
" }",
"}",
"",
- "type RequestType = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'OPTIONS' | 'CONNECT' | 'DELETE' | 'TRACE'"
+ "type RequestType = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'OPTIONS' | 'CONNECT' | 'DELETE' | 'TRACE'",
].join("\n");
case "css":
// Excerpted from the Bootstrap source, which is licensed under the MIT license:
@@ -72,7 +72,7 @@ export default function(parser) {
" padding-left: .75rem;",
" ",
" }",
- "}"
+ "}",
].join("\n");
case "scss":
// Excerpted from the Bootstrap source, which is licensed under the MIT license:
@@ -95,7 +95,7 @@ export default function(parser) {
" color: color-yiq($value);",
" background-color: #{$value};",
" }",
- "}"
+ "}",
].join("\n");
case "less":
// Copied from http://lesscss.org/features/#detached-rulesets-feature
@@ -109,7 +109,7 @@ export default function(parser) {
" };",
"@media (orientation:portrait) {",
" @my-ruleset();",
- "}"
+ "}",
].join("\n");
case "json":
case "json5":
@@ -129,7 +129,7 @@ export default function(parser) {
' {"type": "office",',
' "trailing": "commas by accident"},',
" ],",
- "}"
+ "}",
].join("\n");
case "graphql":
return [
@@ -141,7 +141,7 @@ export default function(parser) {
" price",
" }",
" }",
- "}"
+ "}",
].join("\n");
case "markdown":
return [
@@ -169,7 +169,7 @@ export default function(parser) {
" [another one]: http://example.com 'Example title'",
"",
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
- "Curabitur consectetur maximus risus, sed maximus tellus tincidunt et."
+ "Curabitur consectetur maximus risus, sed maximus tellus tincidunt et.",
].join("\n");
case "mdx":
// modified from https://github.com/mdx-js/mdx/blob/master/packages/mdx/test/fixtures/blog-post.md
@@ -215,7 +215,7 @@ export default function(parser) {
"| Col1 | Col2 |",
"",
"export default ({children }) => < div>{ children}",
- ""
+ "",
].join("\n");
case "vue":
return [
@@ -230,7 +230,7 @@ export default function(parser) {
"",
""
+ "",
].join("\n");
case "yaml":
// modified from http://yaml.org/start.html
@@ -273,7 +273,7 @@ export default function(parser) {
" Late afternoon is best.",
" Backup contact is Nancy",
" Billsmer @ 338-4338.",
- ""
+ "",
].join("\n");
case "glimmer":
// modified from http://handlebarsjs.com/
@@ -282,7 +282,7 @@ export default function(parser) {
"
{{ title }}
",
'
',
" {{ body }}",
- "
"
+ " ",
].join("\n");
case "html":
case "angular":
@@ -303,7 +303,7 @@ export default function(parser) {
" ",
' ',
" ",
- "