Initial ESlint conversion

This commit is contained in:
Dolan Miu
2022-08-31 07:52:27 +01:00
parent d7a9cb2168
commit 1bdf9a4987
210 changed files with 4685 additions and 333 deletions

View File

@ -26,7 +26,7 @@ import { XmlComponent } from "@file/xml-components";
// </xsd:restriction>
// </xsd:simpleType>
export class Break extends XmlComponent {
constructor() {
public constructor() {
super("w:br");
}
}

View File

@ -96,7 +96,7 @@ class RootCommentsAttributes extends XmlAttributeComponent<{
}
export class CommentRangeStart extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentRangeStart");
this.root.push(new CommentRangeAttributes({ id }));
@ -104,7 +104,7 @@ export class CommentRangeStart extends XmlComponent {
}
export class CommentRangeEnd extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentRangeEnd");
this.root.push(new CommentRangeAttributes({ id }));
@ -112,7 +112,7 @@ export class CommentRangeEnd extends XmlComponent {
}
export class CommentReference extends XmlComponent {
constructor(id: number) {
public constructor(id: number) {
super("w:commentReference");
this.root.push(new CommentRangeAttributes({ id }));
@ -120,7 +120,7 @@ export class CommentReference extends XmlComponent {
}
export class Comment extends XmlComponent {
constructor({ id, initials, author, date = new Date(), text }: ICommentOptions) {
public constructor({ id, initials, author, date = new Date(), text }: ICommentOptions) {
super("w:comment");
this.root.push(
@ -136,7 +136,7 @@ export class Comment extends XmlComponent {
}
}
export class Comments extends XmlComponent {
constructor({ children }: ICommentsOptions) {
public constructor({ children }: ICommentsOptions) {
super("w:comments");
this.root.push(

View File

@ -16,13 +16,13 @@ export abstract class BaseEmphasisMark extends XmlComponent {
}
export class EmphasisMark extends BaseEmphasisMark {
constructor(emphasisMarkType: EmphasisMarkType = EmphasisMarkType.DOT) {
public constructor(emphasisMarkType: EmphasisMarkType = EmphasisMarkType.DOT) {
super(emphasisMarkType);
}
}
export class DotEmphasisMark extends BaseEmphasisMark {
constructor() {
public constructor() {
super(EmphasisMarkType.DOT);
}
}

View File

@ -11,21 +11,21 @@ class FidCharAttrs extends XmlAttributeComponent<{ readonly type: FieldCharacter
}
export class Begin extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.BEGIN, dirty }));
}
}
export class Separate extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.SEPARATE, dirty }));
}
}
export class End extends XmlComponent {
constructor(dirty?: boolean) {
public constructor(dirty?: boolean) {
super("w:fldChar");
this.root.push(new FidCharAttrs({ type: FieldCharacterType.END, dirty }));
}

View File

@ -2,7 +2,7 @@ import { Attributes, XmlComponent } from "@file/xml-components";
import { hexColorValue, signedTwipsMeasureValue } from "@util/values";
export class CharacterSpacing extends XmlComponent {
constructor(value: number | string) {
public constructor(value: number | string) {
super("w:spacing");
this.root.push(
new Attributes({
@ -19,7 +19,7 @@ export class CharacterSpacing extends XmlComponent {
// <xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
// </xsd:complexType>
export class Color extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:color");
this.root.push(
new Attributes({
@ -51,7 +51,7 @@ export class Color extends XmlComponent {
// </xsd:restriction>
// </xsd:simpleType>
export class Highlight extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:highlight");
this.root.push(
new Attributes({
@ -62,7 +62,7 @@ export class Highlight extends XmlComponent {
}
export class HighlightComplexScript extends XmlComponent {
constructor(color: string) {
public constructor(color: string) {
super("w:highlightCs");
this.root.push(
new Attributes({

View File

@ -17,7 +17,7 @@ export class ImageRun extends Run {
private readonly key = `${uniqueId()}.png`;
private readonly imageData: IMediaData;
constructor(options: IImageOptions) {
public constructor(options: IImageOptions) {
super({});
const newData = typeof options.data === "string" ? this.convertDataURIToBinary(options.data) : options.data;

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";
export class Page extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("PAGE");
@ -12,7 +12,7 @@ export class Page extends XmlComponent {
}
export class NumberOfPages extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("NUMPAGES");
@ -20,7 +20,7 @@ export class NumberOfPages extends XmlComponent {
}
export class NumberOfPagesSection extends XmlComponent {
constructor() {
public constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("SECTIONPAGES");

View File

@ -99,7 +99,7 @@ export interface IRunPropertiesChangeOptions extends IRunPropertiesOptions, ICha
// </xsd:choice>
// </xsd:group>
export class RunProperties extends IgnoreIfEmptyXmlComponent {
constructor(options?: IRunPropertiesOptions) {
public constructor(options?: IRunPropertiesOptions) {
super("w:rPr");
if (!options) {
@ -225,7 +225,7 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
}
export class RunPropertiesChange extends XmlComponent {
constructor(options: IRunPropertiesChangeOptions) {
public constructor(options: IRunPropertiesChangeOptions) {
super("w:rPrChange");
this.root.push(
new ChangeAttributes({

View File

@ -11,7 +11,7 @@ class SymbolAttributes extends XmlAttributeComponent<{
}
export class Symbol extends XmlComponent {
constructor(char: string = "", symbolfont: string = "Wingdings") {
public constructor(char: string = "", symbolfont: string = "Wingdings") {
super("w:sym");
this.root.push(new SymbolAttributes({ char: char, symbolfont: symbolfont }));
}

View File

@ -4,7 +4,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "../text-attributes";
export class Text extends XmlComponent {
constructor(text: string) {
public constructor(text: string) {
super("w:t");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));

View File

@ -19,12 +19,12 @@ class RunFontAttributes extends XmlAttributeComponent<IFontAttributesProperties>
}
export class RunFonts extends XmlComponent {
constructor(name: string, hint?: string);
constructor(attrs: string | IFontAttributesProperties);
constructor(nameOrAttrs: string | IFontAttributesProperties, hint?: string) {
public constructor(name: string, hint?: string);
public constructor(attrs: string | IFontAttributesProperties);
public constructor(nameOrAttrs: string | IFontAttributesProperties, hint?: string) {
super("w:rFonts");
if (typeof nameOrAttrs === "string") {
// use constructor(name: string, hint?: string);
// use public constructor(name: string, hint?: string);
const name = nameOrAttrs;
this.root.push(
new RunFontAttributes({
@ -36,7 +36,7 @@ export class RunFonts extends XmlComponent {
}),
);
} else {
// use constructor(attrs: IRunFontAttributesProperties);
// use public constructor(attrs: IRunFontAttributesProperties);
const attrs = nameOrAttrs;
this.root.push(new RunFontAttributes(attrs));
}

View File

@ -26,7 +26,7 @@ export enum PageNumber {
export class Run extends XmlComponent {
protected readonly properties: RunProperties;
constructor(options: IRunOptions) {
public constructor(options: IRunOptions) {
super("w:r");
this.properties = new RunProperties(options);
this.root.push(this.properties);

View File

@ -1,7 +1,7 @@
import { Attributes, XmlComponent } from "@file/xml-components";
export abstract class VerticalAlign extends XmlComponent {
constructor(type: string) {
public constructor(type: string) {
super("w:vertAlign");
this.root.push(
new Attributes({
@ -12,13 +12,13 @@ export abstract class VerticalAlign extends XmlComponent {
}
export class SuperScript extends VerticalAlign {
constructor() {
public constructor() {
super("superscript");
}
}
export class SubScript extends VerticalAlign {
constructor() {
public constructor() {
super("subscript");
}
}

View File

@ -5,7 +5,7 @@ import { XmlComponent } from "@file/xml-components";
import { TextAttributes } from "./text-attributes";
export class SequentialIdentifierInstruction extends XmlComponent {
constructor(identifier: string) {
public constructor(identifier: string) {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push(`SEQ ${identifier}`);

View File

@ -3,7 +3,7 @@ import { Begin, End, Separate } from "@file/paragraph/run/field";
import { SequentialIdentifierInstruction } from "./sequential-identifier-instruction";
export class SequentialIdentifier extends Run {
constructor(identifier: string) {
public constructor(identifier: string) {
super({});
this.root.push(new Begin(true));
this.root.push(new SequentialIdentifierInstruction(identifier));

View File

@ -7,7 +7,7 @@ class FldSimpleAttrs extends XmlAttributeComponent<{ readonly instr: string }> {
}
export class SimpleField extends XmlComponent {
constructor(instruction: string, cachedValue?: string) {
public constructor(instruction: string, cachedValue?: string) {
super("w:fldSimple");
this.root.push(new FldSimpleAttrs({ instr: instruction }));
if (cachedValue !== undefined) {
@ -17,7 +17,7 @@ export class SimpleField extends XmlComponent {
}
export class SimpleMailMergeField extends SimpleField {
constructor(fieldName: string) {
public constructor(fieldName: string) {
super(` MERGEFIELD ${fieldName} `, `«${fieldName}»`);
}
}

View File

@ -7,7 +7,7 @@ export interface ISymbolRunOptions extends IRunOptions {
}
export class SymbolRun extends Run {
constructor(options: ISymbolRunOptions | string) {
public constructor(options: ISymbolRunOptions | string) {
if (typeof options === "string") {
super({});
this.root.push(new Symbol(options));

View File

@ -7,7 +7,7 @@ import { XmlComponent } from "@file/xml-components";
// TODO: this is unused and undocumented currently.
// I think the intended use was for users to import, and insert as a child of `Run`.
export class Tab extends XmlComponent {
constructor() {
public constructor() {
super("w:tab");
}
}

View File

@ -2,7 +2,7 @@ import { IRunOptions, Run } from "./run";
import { Text } from "./run-components/text";
export class TextRun extends Run {
constructor(options: IRunOptions | string) {
public constructor(options: IRunOptions | string) {
if (typeof options === "string") {
super({});
this.root.push(new Text(options));

View File

@ -22,7 +22,7 @@ export enum UnderlineType {
}
export class Underline extends XmlComponent {
constructor(underlineType: UnderlineType = UnderlineType.SINGLE, color?: string) {
public constructor(underlineType: UnderlineType = UnderlineType.SINGLE, color?: string) {
super("w:u");
this.root.push(
new Attributes({