Fix Prettier errors

This commit is contained in:
Dolan Miu
2022-10-16 00:20:16 +01:00
parent d053baef03
commit 70a3b25d54
3 changed files with 17 additions and 15 deletions

View File

@ -8,7 +8,7 @@ describe("LeftTabStop", () => {
let tabStop: TabStop;
beforeEach(() => {
tabStop = new TabStop({ type: TabStopType.LEFT, position: 100});
tabStop = new TabStop({ type: TabStopType.LEFT, position: 100 });
});
describe("#constructor()", () => {
@ -32,7 +32,7 @@ describe("RightTabStop", () => {
let tabStop: TabStop;
beforeEach(() => {
tabStop = new TabStop({ type: TabStopType.RIGHT, position: 100, leader: LeaderType.DOT});
tabStop = new TabStop({ type: TabStopType.RIGHT, position: 100, leader: LeaderType.DOT });
});
describe("#constructor()", () => {

View File

@ -2,21 +2,23 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export interface TabStopDefinition {
type: TabStopType,
position: number | TabStopPosition,
leader?: LeaderType
}
type: TabStopType;
position: number | TabStopPosition;
leader?: LeaderType;
}
export class TabStop extends XmlComponent {
public constructor(tabDefs: (TabStopDefinition[] | TabStopDefinition | TabStopType), position?: number, leader?: LeaderType) {
public constructor(tabDefs: TabStopDefinition[] | TabStopDefinition | TabStopType, position?: number, leader?: LeaderType) {
super("w:tabs");
if (typeof tabDefs === "string"){
if (typeof tabDefs === "string") {
this.root.push(new TabStopItem(tabDefs, position, leader));
} else {
if (Array.isArray(tabDefs)) {
tabDefs.forEach((function(tabDef) {
this.root.push(new TabStopItem(tabDef));
}).bind(this));
tabDefs.forEach(
function (tabDef) {
this.root.push(new TabStopItem(tabDef));
}.bind(this),
);
} else {
this.root.push(new TabStopItem(tabDefs));
}
@ -57,7 +59,7 @@ export class TabAttributes extends XmlAttributeComponent<{
}
export class TabStopItem extends XmlComponent {
public constructor(tabDef: (TabStopDefinition | TabStopType), position?: number, leader?: LeaderType) {
public constructor(tabDef: TabStopDefinition | TabStopType, position?: number, leader?: LeaderType) {
super("w:tab");
if (typeof tabDef === "string") {
if (typeof position === "number")
@ -75,7 +77,7 @@ export class TabStopItem extends XmlComponent {
val: tabDef.type,
pos: tabDef.position,
leader: tabDef.leader,
})
}),
);
}
}

View File

@ -138,7 +138,7 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
*/
let tabDefs: TabStopDefinition[] = [];
if (options.rightTabStop) {
tabDefs.push({ type: TabStopType.RIGHT, position: options.rightTabStop});
tabDefs.push({ type: TabStopType.RIGHT, position: options.rightTabStop });
}
if (options.tabStops) {
@ -153,7 +153,7 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
this.push(new TabStop(tabDefs));
}
/**
* FIX - END
* FIX - END
*/
if (options.bidirectional !== undefined) {