Skip to content

Commit 2f39219

Browse files
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/
1 parent 6a6fa81 commit 2f39219

File tree

8 files changed

+69
-73
lines changed

8 files changed

+69
-73
lines changed

index.js

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,69 @@
1-
function isEven(x){
2-
if(x = 2 || x % 2 == 0){
3-
console.log(`${x} is even`)
4-
} else
5-
console.log(`${x} is odd`)
1+
function isEven(x) {
2+
if ((x = 2 || x % 2 == 0)) {
3+
console.log(`${x} is even`);
4+
} else console.log(`${x} is odd`);
65
}
76

8-
function isNumber(num){
9-
let x = undefined
10-
x= num % 2
11-
if(false) {
12-
console.log("Number is false")
13-
} else if (!!x) {
14-
console.log(`Number: ${x}`)
15-
} else if(2 == x){}
7+
function isNumber(num) {
8+
let x = undefined;
9+
x = num % 2;
10+
if (false) {
11+
console.log("Number is false");
12+
} else if (!!x) {
13+
console.log(`Number: ${x}`);
14+
} else if (2 == x) {
15+
}
1616
}
1717

1818
function isTruthy(x) {
19-
debugger;
20-
return Boolean(x);
21-
};
19+
debugger;
20+
return Boolean(x);
21+
}
2222

2323
function area(r) {
24-
let math = Math()
25-
return math.PI * r * r;
24+
let math = Math();
25+
return math.PI * r * r;
2626
}
2727

28-
function isFooAvailable(obj){
29-
console.log(`Value of obj[foo]: ${obj['foo']}`)
30-
return obj.hasOwnProperty('foo')
28+
function isFooAvailable(obj) {
29+
console.log(`Value of obj[foo]: ${obj["foo"]}`);
30+
return obj.hasOwnProperty("foo");
3131
}
3232

33-
function findFooBar(){
34-
var re = /=foo bar/;
35-
re.test('foobar')
33+
function findFooBar() {
34+
var re = /=foo bar/;
35+
re.test("foobar");
3636
}
3737

38-
function consoleFoo(num){
39-
while((num != 3)){
40-
break;
41-
console.log(num--)
42-
}
43-
38+
function consoleFoo(num) {
39+
while (num != 3) {
40+
break;
41+
console.log(num--);
42+
}
4443
}
4544

46-
function isGreaterThan(arr, x){
47-
if(Array.isArray(arr)){
48-
arr.map((n) => {
49-
return !(n > x) ? n : arguments.callee(n-1) * n;
50-
});
51-
};
45+
function isGreaterThan(arr, x) {
46+
if (Array.isArray(arr)) {
47+
arr.map((n) => {
48+
return !(n > x) ? n : arguments.callee(n - 1) * n;
49+
});
50+
}
5251
}
5352

54-
function callHiEveryMinutes(x){
55-
if(!window && x){
56-
setTimeout("alert('Hi')", x * 1000)
57-
58-
} else window.setTimeout("alert('Hi')", x * 1000)
53+
function callHiEveryMinutes(x) {
54+
if (!window && x) {
55+
setTimeout("alert('Hi')", x * 1000);
56+
} else window.setTimeout("alert('Hi')", x * 1000);
5957
}
6058

6159
let result = isFooAvailable({
62-
'bar': 'bar',
63-
'z': 'z'
64-
})
60+
bar: "bar",
61+
z: "z",
62+
})((function () {})(), 0);
6563

66-
(function(){ }(), 0);
67-
68-
function checkYoda(){
69-
let yoda = true;
70-
if(true == yoda){
71-
console.log("I am yoda")
72-
}
73-
}
64+
function checkYoda() {
65+
let yoda = true;
66+
if (true == yoda) {
67+
console.log("I am yoda");
68+
}
69+
}

packages/demo-react/src/App.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { render, screen } from '@testing-library/react';
2-
import App from './App';
1+
import { render, screen } from "@testing-library/react";
2+
import App from "./App";
33

4-
test('renders learn react link', () => {
4+
test("renders learn react link", () => {
55
render(<App />);
66
const linkElement = screen.getByText(/learn react/i);
77
expect(linkElement).toBeInTheDocument();

packages/demo-react/src/components/header.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { Component } from "react";
22

33
class Header extends Component {
44
render() {
5-
<div class={this.props.class_name}>Header Component is {this.props.title}</div>;
5+
<div class={this.props.class_name}>
6+
Header Component is {this.props.title}
7+
</div>;
68
}
79
}
810

911
Header.proptypes = {
10-
title: PropTypes.string.isRequired
12+
title: PropTypes.string.isRequired,
1113
};
1214

1315
export default Header;

packages/demo-react/src/components/home.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component } from "react";
22

33
type Props = {
44
title: string,
5-
isHero: boolean
6-
}
5+
isHero: boolean,
6+
};
77

88
class Hello extends Component<Props> {
99
constructor(props) {
@@ -21,6 +21,4 @@ class Hello extends Component<Props> {
2121
}
2222
}
2323

24-
25-
2624
export default Hello;

packages/demo-react/src/index.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
body {
22
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
3+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4+
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
55
sans-serif;
66
-webkit-font-smoothing: antialiased;
77
-moz-osx-font-smoothing: grayscale;
88
}
99

1010
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
1212
monospace;
1313
}

packages/demo-react/src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom';
3-
import './index.css';
4-
import App from './App';
5-
import reportWebVitals from './reportWebVitals';
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
import "./index.css";
4+
import App from "./App";
5+
import reportWebVitals from "./reportWebVitals";
66

77
ReactDOM.render(
88
<React.StrictMode>
99
<App />
1010
</React.StrictMode>,
11-
document.getElementById('root')
11+
document.getElementById("root")
1212
);
1313

1414
// If you want to start measuring performance in your app, pass a function

packages/demo-react/src/reportWebVitals.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const reportWebVitals = onPerfEntry => {
1+
const reportWebVitals = (onPerfEntry) => {
22
if (onPerfEntry && onPerfEntry instanceof Function) {
3-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
3+
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
44
getCLS(onPerfEntry);
55
getFID(onPerfEntry);
66
getFCP(onPerfEntry);

packages/demo-react/src/setupTests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
// allows you to do things like:
33
// expect(element).toHaveTextContent(/react/i)
44
// learn more: https://github.com/testing-library/jest-dom
5-
import '@testing-library/jest-dom';
5+
import "@testing-library/jest-dom";

0 commit comments

Comments
 (0)