chore: Match ui/desktop prettier config to ui/core

This commit is contained in:
Susmitha Girumala committed 2020-11-12 10:33:13 -05:00
1 parent 865207c190
commit 85ef0915fd
29 files changed
+1043 -1290

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"printWidth": 80
}
+4 -4
View File
@@ -1,7 +1,7 @@
import Application from "@ember/application";
import Resolver from "ember-resolver";
import loadInitializers from "ember-load-initializers";
import config from "./config/environment";
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
export default class App extends Application {
modulePrefix = config.modulePrefix;
+2 -2
View File
@@ -1,5 +1,5 @@
import { helper } from "@ember/component/helper";
import config from "../config/environment";
import { helper } from '@ember/component/helper';
import config from '../config/environment';
export default helper(function appName() {
return config.appName;
+5 -5
View File
@@ -1,5 +1,5 @@
import EmberRouter from "@ember/routing/router";
import config from "./config/environment";
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
export default class Router extends EmberRouter {
location = config.locationType;
@@ -7,9 +7,9 @@ export default class Router extends EmberRouter {
}
Router.map(function () {
this.route("scopes", function () {
this.route("scope", { path: ":scope_id" }, function () {
this.route("targets", function () {});
this.route('scopes', function () {
this.route('scope', { path: ':scope_id' }, function () {
this.route('targets', function () {});
});
});
});
+5 -5
View File
@@ -1,5 +1,5 @@
import Route from "@ember/routing/route";
import { inject as service } from "@ember/service";
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class IndexRoute extends Route {
// =services
@@ -13,8 +13,8 @@ export default class IndexRoute extends Route {
* @return {Promise}
*/
model() {
return this.ipc.invoke("getFoobars", {
id: "1",
return this.ipc.invoke('getFoobars', {
id: '1',
});
}
@@ -22,6 +22,6 @@ export default class IndexRoute extends Route {
* Redirects to scopes route for further processing.
*/
redirect() {
this.transitionTo("scopes");
this.transitionTo('scopes');
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
import Route from "@ember/routing/route";
import { A } from "@ember/array";
import Route from '@ember/routing/route';
import { A } from '@ember/array';
export default class ScopesRoute extends Route {
// =methods
@@ -16,6 +16,6 @@ export default class ScopesRoute extends Route {
model() {
// NOTE: In the absence of a `scope_id` query parameter, this endpoint is
// expected to default to the global scope, thus returning org scopes.
return this.store.findAll("scope").catch(() => A([]));
return this.store.findAll('scope').catch(() => A([]));
}
}
+14 -14
View File
@@ -1,6 +1,6 @@
import Route from "@ember/routing/route";
import { inject as service } from "@ember/service";
import { A } from "@ember/array";
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { A } from '@ember/array';
export default class ScopesScopeRoute extends Route {
// =services
@@ -22,14 +22,14 @@ export default class ScopesScopeRoute extends Route {
model({ scope_id: id }) {
// Since only global and org scopes are authenticatable, we can infer type
// from ID because global has a fixed ID.
const type = id === "global" ? "global" : "org";
return this.store.findRecord("scope", id).catch(() => {
console.error("caught error");
const maybeExistingScope = this.store.peekRecord("scope", id);
const type = id === 'global' ? 'global' : 'org';
return this.store.findRecord('scope', id).catch(() => {
console.error('caught error');
const maybeExistingScope = this.store.peekRecord('scope', id);
const scopeOptions = { id, type };
return (
maybeExistingScope || this.store.createRecord("scope", scopeOptions)
maybeExistingScope || this.store.createRecord('scope', scopeOptions)
);
});
}
@@ -43,7 +43,7 @@ export default class ScopesScopeRoute extends Route {
// Load all orgs
let orgs;
orgs = await this.store
.query("scope", { scope_id: "global" })
.query('scope', { scope_id: 'global' })
.catch(() => A([]));
// Then pull out the "selected" scopes, if relevant
let selectedOrg;
@@ -51,10 +51,10 @@ export default class ScopesScopeRoute extends Route {
let projects;
if (model.isGlobal) {
projects = orgs.map((id) => this.store.query("scope", { scope_id: id }));
projects = orgs.map((id) => this.store.query('scope', { scope_id: id }));
}
if (model.isOrg) {
projects = this.store.query("scope", { scope_id: model.id });
projects = this.store.query('scope', { scope_id: model.id });
}
// Update the scope service with the current scope(s);
@@ -81,9 +81,9 @@ export default class ScopesScopeRoute extends Route {
*/
renderTemplate() {
super.renderTemplate(...arguments);
this.render("scopes/scope/-header-nav", {
into: "application",
outlet: "header-nav",
this.render('scopes/scope/-header-nav', {
into: 'application',
outlet: 'header-nav',
});
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
import Route from "@ember/routing/route";
import Route from '@ember/routing/route';
export default class ScopesScopeIndexRoute extends Route {
// =methods
@@ -7,6 +7,6 @@ export default class ScopesScopeIndexRoute extends Route {
* Redirects to scopes route for further processing.
*/
redirect() {
this.transitionTo("scopes.scope.targets");
this.transitionTo('scopes.scope.targets');
}
}
@@ -1,6 +1,6 @@
import Route from "@ember/routing/route";
import { all } from "rsvp";
import { inject as service } from "@ember/service";
import Route from '@ember/routing/route';
import { all } from 'rsvp';
import { inject as service } from '@ember/service';
export default class ScopesScopeTargetsRoute extends Route {
// =services
@@ -16,14 +16,14 @@ export default class ScopesScopeTargetsRoute extends Route {
async model() {
let projectTargets = await all(
this.scope.projects.map(({ id: scope_id }) =>
this.store.query("target", { scope_id })
this.store.query('target', { scope_id })
)
);
let targets = projectTargets.map((target) => target.toArray()).flat();
return targets.map((target) => {
return {
target,
project: this.store.peekRecord("scope", target.scopeID),
project: this.store.peekRecord('scope', target.scopeID),
};
});
}
@@ -1,3 +1,3 @@
import Route from "@ember/routing/route";
import Route from '@ember/routing/route';
export default class ScopesScopeTargetsIndexRoute extends Route {}
+5 -5
View File
@@ -1,7 +1,7 @@
import Service from "@ember/service";
import { getOwner } from "@ember/application";
import { Promise } from "rsvp";
import config from "../config/environment";
import Service from '@ember/service';
import { getOwner } from '@ember/application';
import { Promise } from 'rsvp';
import config from '../config/environment';
/**
* An IPC request is a promise-like object that issues a request via
@@ -130,7 +130,7 @@ export default class IpcService extends Service {
*/
get window() {
// The Ember way of accessing globals...
const document = getOwner(this).lookup("service:-document").documentElement;
const document = getOwner(this).lookup('service:-document').documentElement;
// defaultView === window, but without using globals directly
return document.parentNode.defaultView;
}
+2 -2
View File
@@ -1,5 +1,5 @@
import Service from "@ember/service";
import { tracked } from "@glimmer/tracking";
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
/**
* This simple non-functional service is used to retain references to
+1 -1
View File
@@ -1 +1 @@
@import "rose";
@import 'rose';
+14 -26
View File
@@ -1,26 +1,14 @@
"use strict";
'use strict';
const APP_NAME = process.env.APP_NAME || "Boundary";
const API_HOST = process.env.API_HOST || "";
const APP_NAME = process.env.APP_NAME || 'Boundary';
const API_HOST = process.env.API_HOST || '';
module.exports = function (environment) {
let ENV = {
modulePrefix: "desktop",
modulePrefix: 'desktop',
environment,
rootURL: process.env.EMBER_CLI_ELECTRON
? ""
: process.env.EMBER_CLI_ELECTRON
? ""
: process.env.EMBER_CLI_ELECTRON
? ""
: "/",
locationType: process.env.EMBER_CLI_ELECTRON
? "hash"
: process.env.EMBER_CLI_ELECTRON
? "hash"
: process.env.EMBER_CLI_ELECTRON
? "hash"
: "auto",
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : '/',
locationType: process.env.EMBER_CLI_ELECTRON ? 'hash' : 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
@@ -40,19 +28,19 @@ module.exports = function (environment) {
api: {
host: API_HOST,
namespace: "v1",
namespace: 'v1',
},
ipc: {
defaultOrigin: process.env.EMBER_CLI_ELECTRON
? "serve://boundary"
: "http://localhost:4200",
? 'serve://boundary'
: 'http://localhost:4200',
},
appName: APP_NAME,
};
if (environment === "development") {
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
@@ -60,19 +48,19 @@ module.exports = function (environment) {
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === "test") {
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = "none";
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = "#ember-testing";
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}
if (environment === "production") {
if (environment === 'production') {
// here you can enable a production-specific feature
}
+6 -6
View File
@@ -1,16 +1,16 @@
"use strict";
'use strict';
const browsers = [
"last 1 Chrome versions",
"last 1 Firefox versions",
"last 1 Safari versions",
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions',
];
const isCI = Boolean(process.env.CI);
const isProduction = process.env.EMBER_ENV === "production";
const isProduction = process.env.EMBER_ENV === 'production';
if (isCI || isProduction) {
browsers.push("ie 11");
browsers.push('ie 11');
}
module.exports = {
+5 -5
View File
@@ -1,19 +1,19 @@
"use strict";
'use strict';
const EmberApp = require("ember-cli/lib/broccoli/ember-app");
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
let app = new EmberApp(defaults, {
babel: {
sourceMaps: "inline",
sourceMaps: 'inline',
},
sourcemaps: {
enabled: true,
extensions: ["js"],
extensions: ['js'],
},
sassOptions: {
onlyIncluded: true,
extension: "scss",
extension: 'scss',
},
});
+1 -3
View File
@@ -79,6 +79,7 @@
"qunit-dom": "^1.2.0",
"rose": "*",
"sass": "^1.29.0",
"sass-lint": "^1.13.1",
"sinon": "^9.2.1"
},
"engines": {
@@ -86,8 +87,5 @@
},
"ember": {
"edition": "octane"
},
"dependencies": {
"sass-lint": "^1.13.1"
}
}
+11 -11
View File
@@ -1,24 +1,24 @@
module.exports = {
test_page: "tests/index.html?hidepassed",
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launchers: {
Electron: require("ember-electron/lib/test-runner"),
Electron: require('ember-electron/lib/test-runner'),
},
launch_in_ci: ["Electron"],
launch_in_dev: ["Electron"],
launch_in_ci: ['Electron'],
launch_in_dev: ['Electron'],
browser_args: {
Electron: {
// Note: Some these Chrome options may not be supported in Electron
// See https://electronjs.org/docs/api/chrome-command-line-switches
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? "--no-sandbox" : null,
"--headless",
"--disable-dev-shm-usage",
"--disable-software-rasterizer",
"--mute-audio",
"--remote-debugging-port=0",
"--window-size=1440,900",
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900',
].filter(Boolean),
},
},
+11 -11
View File
@@ -1,22 +1,22 @@
"use strict";
'use strict';
module.exports = {
test_page: "tests/index.html?hidepassed",
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: ["Chrome"],
launch_in_dev: ["Chrome"],
launch_in_ci: ['Chrome'],
launch_in_dev: ['Chrome'],
browser_start_timeout: 120,
browser_args: {
Chrome: {
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? "--no-sandbox" : null,
"--headless",
"--disable-dev-shm-usage",
"--disable-software-rasterizer",
"--mute-audio",
"--remote-debugging-port=0",
"--window-size=1440,900",
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900',
].filter(Boolean),
},
},
+4 -4
View File
@@ -1,7 +1,7 @@
import Application from "../app";
import config from "../config/environment";
import { setApplication } from "@ember/test-helpers";
import { start } from "ember-qunit";
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
setApplication(Application.create(config.APP));
+5 -5
View File
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | index", function (hooks) {
module('Unit | Route | index', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:index");
test('it exists', function (assert) {
let route = this.owner.lookup('route:index');
assert.ok(route);
});
});
+5 -5
View File
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | scopes", function (hooks) {
module('Unit | Route | scopes', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:scopes");
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes');
assert.ok(route);
});
});
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | scopes/scope", function (hooks) {
module('Unit | Route | scopes/scope', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:scopes/scope");
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope');
assert.ok(route);
});
});
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | scopes/scope/index", function (hooks) {
module('Unit | Route | scopes/scope/index', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:scopes/scope/index");
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope/index');
assert.ok(route);
});
});
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | scopes/scope/targets", function (hooks) {
module('Unit | Route | scopes/scope/targets', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:scopes/scope/targets");
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope/targets');
assert.ok(route);
});
});
@@ -1,11 +1,11 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Route | scopes/scope/targets/index", function (hooks) {
module('Unit | Route | scopes/scope/targets/index', function (hooks) {
setupTest(hooks);
test("it exists", function (assert) {
let route = this.owner.lookup("route:scopes/scope/targets/index");
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope/targets/index');
assert.ok(route);
});
});
+17 -17
View File
@@ -1,55 +1,55 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { IPCRequest } from "desktop/services/ipc";
import sinon from "sinon";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { IPCRequest } from 'desktop/services/ipc';
import sinon from 'sinon';
module("Unit | Service | ipc", function (hooks) {
module('Unit | Service | ipc', function (hooks) {
setupTest(hooks);
hooks.beforeEach(() => {
// IPC requests talk to the main process indirectly via window.postMessage
// proxy layer (mediated by preload.js).
// But we don't want to send these for real in tests.
sinon.stub(window, "postMessage");
sinon.stub(window, 'postMessage');
});
hooks.afterEach(() => {
sinon.restore();
});
test("it creates new IPCRequest objects", function (assert) {
test('it creates new IPCRequest objects', function (assert) {
assert.expect(1);
const service = this.owner.lookup("service:ipc");
const request = service.invoke("hello", "world", "http://localhost:4200");
const service = this.owner.lookup('service:ipc');
const request = service.invoke('hello', 'world', 'http://localhost:4200');
assert.equal(request.constructor, IPCRequest);
});
test("IPCRequest objects post messages on their window objects", function (assert) {
test('IPCRequest objects post messages on their window objects', function (assert) {
assert.expect(2);
const myWindow = {
postMessage(request) {
assert.equal(request.method, "hello");
assert.equal(request.payload, "world");
assert.equal(request.method, 'hello');
assert.equal(request.payload, 'world');
},
};
new IPCRequest("hello", "world", myWindow);
new IPCRequest('hello', 'world', myWindow);
});
test("IPCRequest objects resolve to the value posted via a response message port", async function (assert) {
test('IPCRequest objects resolve to the value posted via a response message port', async function (assert) {
assert.expect(1);
const myWindow = {
postMessage(request, origin, [port]) {
// Post back a message on the response port
port.postMessage({
foo: "bar",
foo: 'bar',
test: 42,
});
},
};
const request = new IPCRequest("hello", "world", myWindow);
const request = new IPCRequest('hello', 'world', myWindow);
const response = await request;
assert.deepEqual(response, {
foo: "bar",
foo: 'bar',
test: 42,
});
});
+5 -5
View File
@@ -1,12 +1,12 @@
import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module("Unit | Service | scope", function (hooks) {
module('Unit | Service | scope', function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test("it exists", function (assert) {
let service = this.owner.lookup("service:scope");
test('it exists', function (assert) {
let service = this.owner.lookup('service:scope');
assert.ok(service);
});
});
+886 -1123
View File
File diff suppressed because it is too large. Load diff