Skip to content

style: format code with Prettier #169

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 5 additions & 6 deletions a.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import something from '.does-not-exist'
import b from './b'

let foo = {}
let bar = foo?.foobar
import something from ".does-not-exist";
import b from "./b";

let foo = {};
let bar = foo?.foobar;

function f(x) {
x = 1
x = 1;
}
70 changes: 34 additions & 36 deletions b.js
Original file line number Diff line number Diff line change
@@ -1,90 +1,88 @@
import a from './a'
import { unserialize as uns } from 'node-serialize'
import c from 'csurf'
import a from "./a";
import { unserialize as uns } from "node-serialize";
import c from "csurf";
import execa from "execa";
import nodemailer from 'nodemailer'
import nodemailer from "nodemailer";

const transporter = nodemailer.createTransport({ secure: false })

uns(xyz)
c({ cookie: { secure: false } })
const transporter = nodemailer.createTransport({ secure: false });

uns(xyz);
c({ cookie: { secure: false } });

const _ = (req, res) => {
const x = "ls " + req.body.args;

execa.command(x);
}
};

const _2 = (req, res) => {
const x = "ls " + req.body.args;

execa.command(x);
}
};

const express = require('express');
const helmet = require('helmet');
const express = require("express");
const helmet = require("helmet");

const app = express();

app.use(
helmet.referrerPolicy({
policy: ["no-referrer"]
})
policy: ["no-referrer"],
}),
);

const cp = require("child_process");
const { exec } = require("child_process");

const cp = require("child_process")
const { exec } = require("child_process")
const proc = "foobar";
cp.exec(proc); // unsafe

const proc = "foobar"
cp.exec(proc) // unsafe
cp.exec("ls"); // safe

cp.exec("ls") // safe
cp.execFile(proc); // unsafe

cp.execFile(proc) // unsafe

exec("fubar") // safe
exec("./" + proc) // unsafe
exec("fubar"); // safe
exec("./" + proc); // unsafe

export async function f(x) {
return async function g() {
return async function h() {
return !!!!!x
}
}
return !!!!!x;
};
};
}

export async function f2(xs) {
const ys = []
const ys = [];
for await (const x of xs) {
ys.push(x)
ys.push(x);
}
return ys
return ys;
}

export class BadClass {
async foo() {
return 1
return 1;
}
}

export const badObject = {
async f() {
return 1
return 1;
},

g: async function () {
return 2
return 2;
},

h: async () => 3
}
h: async () => 3,
};

if (!!(1 + 2)) {
// empty
}

export default 2
export default 2;

const x = import('x');
const x = import("x");
9 changes: 5 additions & 4 deletions bad-code.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node
if (x.length > 0) {
const a = Boolean(false);
const b = Number(false);
const c = String('hello');
if (x === null) { }
const a = Boolean(false);
const b = Number(false);
const c = String("hello");
if (x === null) {
}
}
4 changes: 2 additions & 2 deletions esm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import f from "./foo";
import b from 'b';
import a from 'a';
import b from "b";
import a from "a";

export const p = new Promise((resolve, _reject) => {
resolve(100);
Expand Down
51 changes: 28 additions & 23 deletions html/ember.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
// JS-0775
import { computed } from '@ember/object';
import Component from '@ember/component';
import { tracked } from '@glimmer/tracking';
import { computed } from "@ember/object";
import Component from "@ember/component";
import { tracked } from "@glimmer/tracking";
class Class1 extends Component {
@tracked x; // This is included just to make sure it gets ignored in the next class.
}
class Class2 extends Component {
@computed('x') get myProp() {}
myFunction() { this.x = 123; }
@computed("x") get myProp() {}
myFunction() {
this.x = 123;
}
}




export default class Router extends EmberRouter {
location = ''
rootURL = 'config.rootURL'
location = "";
rootURL = "config.rootURL";
}

// JS-0782
class Foo { init() { this._super.apply(this, arguments); } }
class Foo {
init() {
this._super.apply(this, arguments);
}
}

// JS-0785
const test = this.getWithDefault('key', []);
const test = this.getWithDefault("key", []);

// JS-0797
import { setupOnerror } from '@ember/test-helpers';
import { module as moduleVariable } from 'qunit';
moduleVariable('foo', function(hooks) {
hooks.beforeEach(function() {
import { setupOnerror } from "@ember/test-helpers";
import { module as moduleVariable } from "qunit";
moduleVariable("foo", function (hooks) {
hooks.beforeEach(function () {
setupOnerror(() => {});
});
});

// JS-0799
import { log } from 'ember-debug';
import { log } from "ember-debug";

// JS-0809
Router.map(function () {
this.route('about')
this.route("about");
// JS-0778:
this.route('Home')
this.route('SignUp')
this.route("Home");
this.route("SignUp");
// JS-0809: fixables
this.route('blog-posts', { path: '/blog-posts' })
})
this.route("blog-posts", { path: "/blog-posts" });
});

// JS-0812
computed(function() { return this.nested.children.mapBy('age'); })
computed(function () {
return this.nested.children.mapBy("age");
});
2 changes: 1 addition & 1 deletion html/foo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Inject, Fubar, Fu } from "foo";
export default class Foo {
// doc
constructor(@Inject(Fubar) private readonly fu: Fu) {
this.f()
this.f();
}

// doc comment
Expand Down
24 changes: 11 additions & 13 deletions html/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>

<body>
<b>
Foobar barbaz
</b>
</body>
</html>
<body>
<b> Foobar barbaz </b>
</body>
</html>
14 changes: 7 additions & 7 deletions html/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

let e = [
function foo() {
dosomething();
}, function bar() {
dosomething();
}
function foo() {
dosomething();
},
function bar() {
dosomething();
},
];

var foo = Boolean(bar);
var foo = Boolean(bar);
2 changes: 1 addition & 1 deletion html/index.vue
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// JS-0614
// JS-0614
24 changes: 9 additions & 15 deletions html/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
// JS-0293
let a: Array<number> = [];


// JS-0298
class Mx {
public static get foo() {
return 1;
}
public static get foo() {
return 1;
}
}

// JS-0301
type T = { x: number; };


type T = { x: number };

// JS-0316
new Array(0, 1, 2);

// JS-0324
function foo(bar?: { n: number }) {
return (bar)!?.n;
return bar!?.n;
}

// JS-0331
class Foo {
a: number = 5;
b: boolean = true;
c: string = 'foo';
a: number = 5;
b: boolean = true;
c: string = "foo";
}

// JS-0364
declare module foo {
declare module bar {}
declare module bar {}
}



Loading