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; let tabStop: TabStop;
beforeEach(() => { beforeEach(() => {
tabStop = new TabStop({ type: TabStopType.LEFT, position: 100}); tabStop = new TabStop({ type: TabStopType.LEFT, position: 100 });
}); });
describe("#constructor()", () => { describe("#constructor()", () => {
@ -32,7 +32,7 @@ describe("RightTabStop", () => {
let tabStop: TabStop; let tabStop: TabStop;
beforeEach(() => { 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()", () => { describe("#constructor()", () => {

View File

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

View File

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