From 2f39219801e0cc1deb332b7189ab76a8bcbc315e Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 6 Jan 2021 14:03:37 +0000 Subject: [PATCH] Format code with prettier This commit fixes the style issues introduced in 6a6fa81 according to the output from prettier. Details: https://deepsource.io/gh/moulik-deepsource/demo-javascript/transform/67bf48eb-1475-4d9f-8c53-b0ba375891c2/ --- index.js | 100 +++++++++---------- packages/demo-react/src/App.test.js | 6 +- packages/demo-react/src/components/header.js | 6 +- packages/demo-react/src/components/home.js | 6 +- packages/demo-react/src/index.css | 6 +- packages/demo-react/src/index.js | 12 +-- packages/demo-react/src/reportWebVitals.js | 4 +- packages/demo-react/src/setupTests.js | 2 +- 8 files changed, 69 insertions(+), 73 deletions(-) diff --git a/index.js b/index.js index 6c6d6b10..86cbae45 100644 --- a/index.js +++ b/index.js @@ -1,73 +1,69 @@ -function isEven(x){ - if(x = 2 || x % 2 == 0){ - console.log(`${x} is even`) - } else - console.log(`${x} is odd`) +function isEven(x) { + if ((x = 2 || x % 2 == 0)) { + console.log(`${x} is even`); + } else console.log(`${x} is odd`); } -function isNumber(num){ - let x = undefined - x= num % 2 - if(false) { - console.log("Number is false") - } else if (!!x) { - console.log(`Number: ${x}`) - } else if(2 == x){} +function isNumber(num) { + let x = undefined; + x = num % 2; + if (false) { + console.log("Number is false"); + } else if (!!x) { + console.log(`Number: ${x}`); + } else if (2 == x) { + } } function isTruthy(x) { - debugger; - return Boolean(x); -}; + debugger; + return Boolean(x); +} function area(r) { - let math = Math() - return math.PI * r * r; + let math = Math(); + return math.PI * r * r; } -function isFooAvailable(obj){ - console.log(`Value of obj[foo]: ${obj['foo']}`) - return obj.hasOwnProperty('foo') +function isFooAvailable(obj) { + console.log(`Value of obj[foo]: ${obj["foo"]}`); + return obj.hasOwnProperty("foo"); } -function findFooBar(){ - var re = /=foo bar/; - re.test('foobar') +function findFooBar() { + var re = /=foo bar/; + re.test("foobar"); } -function consoleFoo(num){ - while((num != 3)){ - break; - console.log(num--) - } - +function consoleFoo(num) { + while (num != 3) { + break; + console.log(num--); + } } -function isGreaterThan(arr, x){ - if(Array.isArray(arr)){ - arr.map((n) => { - return !(n > x) ? n : arguments.callee(n-1) * n; - }); - }; +function isGreaterThan(arr, x) { + if (Array.isArray(arr)) { + arr.map((n) => { + return !(n > x) ? n : arguments.callee(n - 1) * n; + }); + } } -function callHiEveryMinutes(x){ - if(!window && x){ - setTimeout("alert('Hi')", x * 1000) - - } else window.setTimeout("alert('Hi')", x * 1000) +function callHiEveryMinutes(x) { + if (!window && x) { + setTimeout("alert('Hi')", x * 1000); + } else window.setTimeout("alert('Hi')", x * 1000); } let result = isFooAvailable({ - 'bar': 'bar', - 'z': 'z' -}) + bar: "bar", + z: "z", +})((function () {})(), 0); -(function(){ }(), 0); - -function checkYoda(){ - let yoda = true; - if(true == yoda){ - console.log("I am yoda") - } -} \ No newline at end of file +function checkYoda() { + let yoda = true; + if (true == yoda) { + console.log("I am yoda"); + } +} diff --git a/packages/demo-react/src/App.test.js b/packages/demo-react/src/App.test.js index 1f03afee..9382b9ad 100644 --- a/packages/demo-react/src/App.test.js +++ b/packages/demo-react/src/App.test.js @@ -1,7 +1,7 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; +import { render, screen } from "@testing-library/react"; +import App from "./App"; -test('renders learn react link', () => { +test("renders learn react link", () => { render(); const linkElement = screen.getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); diff --git a/packages/demo-react/src/components/header.js b/packages/demo-react/src/components/header.js index c1704793..ae0a76f1 100644 --- a/packages/demo-react/src/components/header.js +++ b/packages/demo-react/src/components/header.js @@ -2,12 +2,14 @@ import { Component } from "react"; class Header extends Component { render() { -
Header Component is {this.props.title}
; +
+ Header Component is {this.props.title} +
; } } Header.proptypes = { - title: PropTypes.string.isRequired + title: PropTypes.string.isRequired, }; export default Header; diff --git a/packages/demo-react/src/components/home.js b/packages/demo-react/src/components/home.js index 3f7d8e7c..af53099e 100644 --- a/packages/demo-react/src/components/home.js +++ b/packages/demo-react/src/components/home.js @@ -2,8 +2,8 @@ import { Component } from "react"; type Props = { title: string, - isHero: boolean -} + isHero: boolean, +}; class Hello extends Component { constructor(props) { @@ -21,6 +21,4 @@ class Hello extends Component { } } - - export default Hello; diff --git a/packages/demo-react/src/index.css b/packages/demo-react/src/index.css index ec2585e8..4a1df4db 100644 --- a/packages/demo-react/src/index.css +++ b/packages/demo-react/src/index.css @@ -1,13 +1,13 @@ body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } diff --git a/packages/demo-react/src/index.js b/packages/demo-react/src/index.js index ef2edf8e..ad9cbbbf 100644 --- a/packages/demo-react/src/index.js +++ b/packages/demo-react/src/index.js @@ -1,14 +1,14 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +import React from "react"; +import ReactDOM from "react-dom"; +import "./index.css"; +import App from "./App"; +import reportWebVitals from "./reportWebVitals"; ReactDOM.render( , - document.getElementById('root') + document.getElementById("root") ); // If you want to start measuring performance in your app, pass a function diff --git a/packages/demo-react/src/reportWebVitals.js b/packages/demo-react/src/reportWebVitals.js index 5253d3ad..9ecd33f9 100644 --- a/packages/demo-react/src/reportWebVitals.js +++ b/packages/demo-react/src/reportWebVitals.js @@ -1,6 +1,6 @@ -const reportWebVitals = onPerfEntry => { +const reportWebVitals = (onPerfEntry) => { if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); getFID(onPerfEntry); getFCP(onPerfEntry); diff --git a/packages/demo-react/src/setupTests.js b/packages/demo-react/src/setupTests.js index 8f2609b7..1dd407a6 100644 --- a/packages/demo-react/src/setupTests.js +++ b/packages/demo-react/src/setupTests.js @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; +import "@testing-library/jest-dom";