Skip to content

Commit

Permalink
Upgrade Prettier
Browse files Browse the repository at this point in the history
In version 2 Prettier has changed the default values for trailingComma
and arrowParens. I've reverted them so Prettier won't make major
formatting changes to existing code.
  • Loading branch information
Nateowami committed Sep 21, 2020
1 parent 75eb02e commit 89fc907
Show file tree
Hide file tree
Showing 32 changed files with 90 additions and 7,247 deletions.
2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
trailingComma: "none"
arrowParens: "avoid"
overrides:
- files: "*.html"
options:
Expand Down
7 changes: 2 additions & 5 deletions src/SIL.XForge.Scripture/ClientApp/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ exports.config = {
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
print: function () {}
},
SELENIUM_PROMISE_MANAGER: false,
onPrepare() {
browser.driver
.manage()
.window()
.maximize();
browser.driver.manage().window().maximize();

require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
Expand Down
5 changes: 1 addition & 4 deletions src/SIL.XForge.Scripture/ClientApp/e2e/src/login.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ export class LoginPage {
await this.usernameInput.sendKeys(username);
await this.passwordInput.sendKeys(password);
if (shouldSubmitByEnterkey) {
await browser
.actions()
.sendKeys(protractor.Key.ENTER)
.perform();
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
} else {
await this.loginButton.click();
}
Expand Down
7,177 changes: 3 additions & 7,174 deletions src/SIL.XForge.Scripture/ClientApp/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/SIL.XForge.Scripture/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"karma-teamcity-reporter": "^1.1.0",
"lint-staged": "^10.2.11",
"npm": "6.14.6",
"prettier": "1.15.3",
"prettier": "^2.1.1",
"protractor": "^5.4.3",
"ts-mockito": "^2.5.0",
"ts-node": "~8.8.1",
Expand Down
4 changes: 2 additions & 2 deletions src/SIL.XForge.Scripture/ClientApp/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<mdc-icon mdcTopAppBarNavIcon>menu</mdc-icon>
</a>
<a (click)="goHome()">
<mdc-icon mdcTopAppBarNavIcon><img id="nav-logo" src="/assets/images/logo-sf.svg" height="30"/></mdc-icon>
<mdc-icon mdcTopAppBarNavIcon><img id="nav-logo" src="/assets/images/logo-sf.svg" height="30" /></mdc-icon>
</a>
<mdc-top-app-bar-title *ngIf="!topAppBar.isCollapsed()" (click)="goHome()" fxHide.xs>
Scripture Forge
Expand Down Expand Up @@ -223,7 +223,7 @@
</mdc-list-item>
</ng-container>
</div>
<div *ngIf="(isProjectAdmin$ | async)">
<div *ngIf="isProjectAdmin$ | async">
<mdc-list-divider *ngIf="isCheckingEnabled"></mdc-list-divider>
<mdc-list-item
[appRouterLink]="['/projects', selectedProjectId, 'sync']"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ const mockedPwaService = mock(PwaService);
const mockedFileService = mock(FileService);

@Component({
template: `
<div>Mock</div>
`
template: `<div>Mock</div>`
})
class MockComponent {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ class TestEnvironment {
{
bookNum: 40,
hasSource: false,
chapters: [{ number: 1, lastVerse: 25, isValid: true }, { number: 3, lastVerse: 17, isValid: true }]
chapters: [
{ number: 1, lastVerse: 25, isValid: true },
{ number: 3, lastVerse: 17, isValid: true }
]
},
{ bookNum: 42, hasSource: false, chapters: [{ number: 1, lastVerse: 80, isValid: true }] }
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ class TestEnvironment {
texts: [
{
bookNum: 40,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: true
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,10 @@ class TestEnvironment {
{
bookNum: 43,
hasSource: false,
chapters: [{ number: 1, lastVerse: 18, isValid: true }, { number: 2, lastVerse: 25, isValid: true }]
chapters: [
{ number: 1, lastVerse: 18, isValid: true },
{ number: 2, lastVerse: 25, isValid: true }
]
},
{
bookNum: 40,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ interface Summary {
export class CheckingComponent extends DataLoadingComponent implements OnInit, OnDestroy {
userDoc?: UserDoc;
scriptureFontSize?: string;
@ViewChild('answerPanelContainer') set answersPanelElement(
answersPanelContainerElement: ElementRef
) {
@ViewChild('answerPanelContainer') set answersPanelElement(answersPanelContainerElement: ElementRef) {
// Need to trigger the calculation for the slider after DOM has been updated
this.answersPanelContainerElement = answersPanelContainerElement;
this.calculateScriptureSliderPosition(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,10 @@ class TestEnvironment {
MAT: {
bookNum: 40,
hasSource: false,
chapters: [{ number: 1, lastVerse: 25, isValid: true }, { number: 2, lastVerse: 23, isValid: true }]
chapters: [
{ number: 1, lastVerse: 25, isValid: true },
{ number: 2, lastVerse: 23, isValid: true }
]
},
LUK: { bookNum: 42, hasSource: false, chapters: [{ number: 1, lastVerse: 80, isValid: true }] },
JHN: { bookNum: 43, hasSource: false, chapters: [{ number: 1, lastVerse: 0, isValid: true }] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ class TestEnvironment {
matthewText: TextInfo = {
bookNum: 40,
hasSource: false,
chapters: [{ number: 1, lastVerse: 25, isValid: true }, { number: 3, lastVerse: 17, isValid: true }]
chapters: [
{ number: 1, lastVerse: 25, isValid: true },
{ number: 3, lastVerse: 17, isValid: true }
]
};
readonly PROJECT01: string = 'project01';
adminUser: UserInfo = { id: 'user01', role: SFProjectRole.ParatextAdministrator };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ class TestEnvironment {
sync: { queuedCount: 0 },
texts:
args.hasTexts == null || args.hasTexts
? [{ bookNum: 40, chapters: [], hasSource: false }, { bookNum: 41, chapters: [], hasSource: false }]
? [
{ bookNum: 40, chapters: [], hasSource: false },
{ bookNum: 41, chapters: [], hasSource: false }
]
: [],
userRoles: { user01: args.role == null ? SFProjectRole.ParatextTranslator : args.role }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</mdc-dialog-title>
<mdc-dialog-content>
<div class="reference">
{{ getBookName(data.booksAndChaptersToShow[(data.rangeStart?.book)]) }} {{ data.rangeStart?.chapter }}
{{ getBookName(data.booksAndChaptersToShow[data.rangeStart?.book]) }} {{ data.rangeStart?.chapter }}
</div>
<button
*ngFor="let verse of versesOf(data.rangeStart?.book, data.rangeStart?.chapter, data.rangeStart?.verse)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,18 @@ describe('ScriptureChooserDialog', () => {
let textsInProject: TextInfo[] = [
{
bookNum: 2,
chapters: [{ number: 39, lastVerse: 43, isValid: true }, { number: 40, lastVerse: 38, isValid: true }],
chapters: [
{ number: 39, lastVerse: 43, isValid: true },
{ number: 40, lastVerse: 38, isValid: true }
],
hasSource: false
},
{
bookNum: 40,
chapters: [{ number: 1, lastVerse: 25, isValid: true }, { number: 2, lastVerse: 23, isValid: true }],
chapters: [
{ number: 1, lastVerse: 25, isValid: true },
{ number: 2, lastVerse: 23, isValid: true }
],
hasSource: false
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ const mockedCookieService = mock(CookieService);
const mockedPwaService = mock(PwaService);

@Component({
template: `
<div>Mock</div>
`
template: `<div>Mock</div>`
})
class MockComponent {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ export function registerScripture(): string[] {
return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
}
if (lastOp.attributes != null) {
return Object.keys(lastOp.attributes).some(function(attr) {
return Object.keys(lastOp.attributes).some(function (attr) {
return Parchment.query(attr, Parchment.Scope.BLOCK) != null;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ class TestEnvironment {
static matthewText: TextInfo = {
bookNum: 40,
hasSource: false,
chapters: [{ number: 1, lastVerse: 25, isValid: true }, { number: 3, lastVerse: 17, isValid: true }]
chapters: [
{ number: 1, lastVerse: 25, isValid: true },
{ number: 3, lastVerse: 17, isValid: true }
]
};
static textsByBookId = { ['MAT']: TestEnvironment.matthewText };
static testProject: SFProject = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,13 +1068,19 @@ class TestEnvironment {
texts: [
{
bookNum: 40,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: true
},
{ bookNum: 41, chapters: [{ number: 1, lastVerse: 3, isValid: false }], hasSource: true },
{
bookNum: 42,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: false
},
{
Expand Down Expand Up @@ -1201,10 +1207,7 @@ class TestEnvironment {

typeCharacters(str: string): number {
const selection = this.targetEditor.getSelection()!;
const delta = new Delta()
.retain(selection.index)
.delete(selection.length)
.insert(str);
const delta = new Delta().retain(selection.index).delete(selection.length).insert(str);
this.targetEditor.updateContents(delta, 'user');
const selectionIndex = selection.index + str.length;
this.targetEditor.setSelection(selectionIndex, 'user');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class SuggestionsComponent extends SubscriptionDisposable implements OnDe
return false;
}
const keyCode = event.key.charCodeAt(0);
return (event.ctrlKey || event.metaKey) && (keyCode >= 48 && keyCode <= 57);
return (event.ctrlKey || event.metaKey) && keyCode >= 48 && keyCode <= 57;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,34 @@ class TestEnvironment {
texts: [
{
bookNum: 40,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: true
},
{
bookNum: 41,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: true
},
{
bookNum: 42,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: true
},
{
bookNum: 43,
chapters: [{ number: 1, lastVerse: 3, isValid: true }, { number: 2, lastVerse: 3, isValid: true }],
chapters: [
{ number: 1, lastVerse: 3, isValid: true },
{ number: 2, lastVerse: 3, isValid: true }
],
hasSource: false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ export class CollaboratorsComponent extends DataLoadingComponent implements OnIn
return (
userRow.user &&
((userRow.user.displayName && userRow.user.displayName.toLowerCase().includes(term)) ||
(userRow.role &&
this.i18n
.localizeRole(userRow.role)
.toLowerCase()
.includes(term)) ||
(userRow.role && this.i18n.localizeRole(userRow.role).toLowerCase().includes(term)) ||
(userRow.user.email && userRow.user.email.toLowerCase().includes(term)))
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/SIL.XForge.Scripture/ClientApp/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="#343a31" />
</head>
<body style="margin: 0;" class="mdc-typography">
<body style="margin: 0" class="mdc-typography">
<noscript>Please enable JavaScript to run this application.</noscript>
<app-root>
<div style="margin: 50px 8px; font-family: sans-serif; line-height: 1.5; text-align:center;">Loading...</div>
<div style="margin: 50px 8px; font-family: sans-serif; line-height: 1.5; text-align: center">Loading...</div>
</app-root>
</body>
</html>
2 changes: 1 addition & 1 deletion src/SIL.XForge.Scripture/ClientApp/src/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function(config) {
module.exports = function (config) {
const isTC =
config.browsers && config.browsers.length === 1 && config.browsers[0] === 'xForgeChromiumHeadless' && !config.watch;

Expand Down
4 changes: 2 additions & 2 deletions src/SIL.XForge.Scripture/ClientApp/src/offline.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
if (localStorage.getItem("user_id") != null) {
window.location.href = "/projects";
} else {
setTimeout(function() {
setTimeout(function () {
window.location.href = "/";
}, 5000);
}
Expand All @@ -57,7 +57,7 @@ <h1>Looks like you're currently offline</h1>
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 100 100"
preserveAspectRatio="xMidYMid"
style="background: none;"
style="background: none"
>
<g transform="rotate(0 50 50)">
<rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#1d3f72">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,7 @@ export class AuthService {
if (err.code === 'login_required') {
resolve(null);
} else if (retryUponTimeout && err.code === 'timeout') {
this.checkSession(false)
.then(resolve)
.catch(reject);
this.checkSession(false).then(resolve).catch(reject);
} else {
reject(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ class TestEnvironment {
class DialogTestModule {}

@Component({
template: `
<button (click)="openDialog()"></button>
`
template: `<button (click)="openDialog()"></button>`
})
class DialogOpenerComponent {
publicName: string = 'Simon Says';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ export abstract class ProjectService<
term$: Observable<string>,
queryParameters$: Observable<QueryParameters>
): Observable<RealtimeQuery<TDoc>> {
const debouncedTerm$ = term$.pipe(
debounceTime(400),
distinctUntilChanged()
);
const debouncedTerm$ = term$.pipe(debounceTime(400), distinctUntilChanged());

return combineLatest(debouncedTerm$, queryParameters$).pipe(
switchMap(([term, queryParameters]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,7 @@ class TestEnvironment {
}

syncDisabledControl(row: number): DebugElement {
return this.cell(row, this.syncDisabledColumn)
.query(By.css('mdc-checkbox'))
.query(By.css('input'));
return this.cell(row, this.syncDisabledColumn).query(By.css('mdc-checkbox')).query(By.css('input'));
}

changeSelectValue(select: DebugElement, option: number): void {
Expand Down
Loading

0 comments on commit 89fc907

Please sign in to comment.