Fix ESLinting errors and remove TSLint
This commit is contained in:
@ -7,9 +7,7 @@ describe("DocumentWrapper", () => {
|
||||
it("should create", () => {
|
||||
const file = new DocumentWrapper({ background: {} });
|
||||
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(file.View).to.be.ok;
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(file.Relationships).to.be.ok;
|
||||
});
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ import { IDrawingOptions } from "../drawing";
|
||||
import { TextWrappingType } from "../text-wrap";
|
||||
import { Anchor } from "./anchor";
|
||||
|
||||
function createAnchor(drawingOptions: IDrawingOptions): Anchor {
|
||||
const createAnchor = (drawingOptions: IDrawingOptions): Anchor => {
|
||||
return new Anchor(
|
||||
{
|
||||
fileName: "test.png",
|
||||
@ -34,7 +34,7 @@ function createAnchor(drawingOptions: IDrawingOptions): Anchor {
|
||||
},
|
||||
drawingOptions,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
describe("Anchor", () => {
|
||||
let anchor: Anchor;
|
||||
|
@ -6,7 +6,7 @@ import { Drawing, IDrawingOptions } from "./drawing";
|
||||
|
||||
const imageBase64Data = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAACzVBMVEUAAAAAAAAAAAAAAAA/AD8zMzMqKiokJCQfHx8cHBwZGRkuFxcqFSonJyckJCQiIiIfHx8eHh4cHBwoGhomGSYkJCQhISEfHx8eHh4nHR0lHBwkGyQjIyMiIiIgICAfHx8mHh4lHh4kHR0jHCMiGyIhISEgICAfHx8lHx8kHh4jHR0hHCEhISEgICAlHx8kHx8jHh4jHh4iHSIhHCEhISElICAkHx8jHx8jHh4iHh4iHSIhHSElICAkICAjHx8jHx8iHh4iHh4hHiEhHSEkICAjHx8iHx8iHx8hHh4hHiEkHSEjHSAjHx8iHx8iHx8hHh4kHiEkHiEjHSAiHx8hHx8hHh4kHiEjHiAjHSAiHx8iHx8hHx8kHh4jHiEjHiAjHiAiICAiHx8kH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od9FxyhqLoAqis5aPhwTDp9spRgEH2Q6KLbYoKqlaKTm6Isp0C/sJMnjFvhiERXPQvUNRe9p29lhR04CdBpC8Sl8YiuncIxEuzUUg4Dkgj+paVozygY9plPMh28SaymO9kabAopREGF3vt9MzeFFl8G7lRSZ8FFGK8XX4VA8QjEd7XrM3M0OXz8YCy+qKBLgq3wqnofiTorF0Ax56Rg1J1elW+BBAsVe+My6iYq7IK6keBdOIseV2qn5Pb8f3MqkWAXf9ThM8c8lAOIotuFsF875lRrH5klRcG0+xcPwQ1oLxfeRAP4heQTnGL78X2rqlw2DK59SXAV/zKaiGMAuko5InCt68mcOan5+ohf+z1pP8lQY/GHZQMV4YD3FpXDp4qerqbF/lBWBswyi+AL+ia+maLgcRRQj4IYlY/UpauqKBsPJAxQF8NM1TRQ/RudSPAD34rK3scOuR8/HGcspxsJfOVS8NZbiGXiUtPgINU3v3WFDmx8pEuG3EiqKKVbCC1vm2iZqap5LAtCtleQf8F9sFYWDohzeJczYyQ4V2bEZFGsQgJRGqqqhS2phHTWn9lDkIhBTqWqxQZ+IsRvtdHY9AvI2VX2hW68nfqGmuQsCEl3JdjfCF8OW1bPdtwhQ0gm2mQzfRE3a7KCYj0BNZJs8+Kxf/r6WtTEI2FIqlsMfFgRB5A6KUnSe/vUkX0AnuvUIt8SjM1m6wWQymUwmk8lkMgXRf5vi8rLQxtUhAAAAAElFTkSuQmCC`;
|
||||
|
||||
function createDrawing(drawingOptions?: IDrawingOptions): Drawing {
|
||||
const createDrawing = (drawingOptions?: IDrawingOptions): Drawing => {
|
||||
return new Drawing(
|
||||
{
|
||||
fileName: "test.jpg",
|
||||
@ -24,7 +24,7 @@ function createDrawing(drawingOptions?: IDrawingOptions): Drawing {
|
||||
},
|
||||
drawingOptions,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
describe("Drawing", () => {
|
||||
let currentBreak: Drawing;
|
||||
|
@ -1,8 +1,9 @@
|
||||
// http://officeopenxml.com/drwPicFloating-textWrap.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { ITextWrapping, TextWrappingSide } from ".";
|
||||
|
||||
import { IDistance } from "../drawing";
|
||||
import { IMargins } from "../floating";
|
||||
import { ITextWrapping, TextWrappingSide } from "./text-wrapping";
|
||||
|
||||
interface IWrapSquareAttributes extends IDistance {
|
||||
readonly wrapText?: TextWrappingSide;
|
||||
|
@ -397,7 +397,6 @@ describe("File", () => {
|
||||
sections: [],
|
||||
});
|
||||
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(doc.Comments).to.not.be.undefined;
|
||||
});
|
||||
});
|
||||
@ -409,7 +408,6 @@ describe("File", () => {
|
||||
sections: [],
|
||||
});
|
||||
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(doc.Numbering).to.not.be.undefined;
|
||||
});
|
||||
});
|
||||
|
@ -63,13 +63,7 @@ export class File {
|
||||
lastModifiedBy: options.lastModifiedBy ?? "Un-named",
|
||||
});
|
||||
|
||||
this.numbering = new Numbering(
|
||||
options.numbering
|
||||
? options.numbering
|
||||
: {
|
||||
config: [],
|
||||
},
|
||||
);
|
||||
this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
|
||||
|
||||
this.comments = new Comments(options.comments ?? { children: [] });
|
||||
this.fileRelationships = new Relationships();
|
||||
|
@ -7,9 +7,7 @@ describe("FootnotesWrapper", () => {
|
||||
it("should create", () => {
|
||||
const file = new FootnotesWrapper();
|
||||
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(file.View).to.be.ok;
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
expect(file.Relationships).to.be.ok;
|
||||
});
|
||||
});
|
||||
|
@ -68,7 +68,9 @@ export class Media {
|
||||
.map((c) => c.charCodeAt(0)),
|
||||
);
|
||||
} else {
|
||||
/* eslint @typescript-eslint/no-require-imports: 0 */
|
||||
const b = require("buf" + "fer");
|
||||
/* eslint @typescript-eslint/no-require-imports: 2 */
|
||||
return new b.Buffer(dataURI, "base64");
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { LevelFormat, LevelSuffix } from ".";
|
||||
import { AlignmentType } from "..";
|
||||
|
||||
import { Level } from "./level";
|
||||
import { Level, LevelFormat, LevelSuffix } from "./level";
|
||||
|
||||
describe("Level", () => {
|
||||
describe("#constructor", () => {
|
||||
|
@ -180,9 +180,6 @@ export class LevelBase extends XmlComponent {
|
||||
export class Level extends LevelBase {
|
||||
// This is the level that sits under abstractNum. We make a
|
||||
// handful of properties required
|
||||
public constructor(options: ILevelsOptions) {
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
|
||||
export class LevelForOverride extends LevelBase {}
|
||||
|
@ -19,12 +19,8 @@ import { TextRun } from "./run";
|
||||
|
||||
describe("Paragraph", () => {
|
||||
before(() => {
|
||||
stub(convenienceFunctions, "uniqueId").callsFake(() => {
|
||||
return "test-unique-id";
|
||||
});
|
||||
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => {
|
||||
return -101;
|
||||
});
|
||||
stub(convenienceFunctions, "uniqueId").callsFake(() => "test-unique-id");
|
||||
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => -101);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
@ -10,9 +10,7 @@ import { ImageRun } from "./image-run";
|
||||
|
||||
describe("ImageRun", () => {
|
||||
before(() => {
|
||||
stub(convenienceFunctions, "uniqueId").callsFake(() => {
|
||||
return "test-unique-id";
|
||||
});
|
||||
stub(convenienceFunctions, "uniqueId").callsFake(() => "test-unique-id");
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
@ -2,13 +2,11 @@ import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { BorderStyle } from "@file/border";
|
||||
// import { FootnoteReferenceRun } from "@file/footnotes/footnote/run/reference-run";
|
||||
import { ShadingType } from "@file/shading";
|
||||
import { SpaceType } from "@file/space-type";
|
||||
|
||||
import { Run } from "./";
|
||||
import { EmphasisMarkType } from "./emphasis-mark";
|
||||
import { PageNumber } from "./run";
|
||||
import { PageNumber, Run } from "./run";
|
||||
import { UnderlineType } from "./underline";
|
||||
|
||||
describe("Run", () => {
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { EmphasisMarkType } from "./emphasis-mark";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { EmphasisMarkType } from "./emphasis-mark";
|
||||
import { UnderlineType } from "./underline";
|
||||
|
||||
import { SymbolRun } from "./symbol-run";
|
||||
|
||||
describe("SymbolRun", () => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { DocumentDefaults } from "./document-defaults";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { DocumentDefaults } from "./document-defaults";
|
||||
|
||||
describe("DocumentDefaults", () => {
|
||||
it("#constructor", () => {
|
||||
const defaults = new DocumentDefaults({
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* tslint:disable */
|
||||
function createLsdException(name, uiPriority, qFormat?, semiHidden?, unhideWhenUsed?) {
|
||||
const createLsdException = (name, uiPriority, qFormat?, semiHidden?, unhideWhenUsed?) => {
|
||||
"use strict";
|
||||
|
||||
return [
|
||||
@ -13,9 +12,9 @@ function createLsdException(name, uiPriority, qFormat?, semiHidden?, unhideWhenU
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
export function DefaultStyle() {
|
||||
export const DefaultStyle = () => {
|
||||
var style = {
|
||||
"w:styles": [
|
||||
{
|
||||
@ -208,4 +207,4 @@ export function DefaultStyle() {
|
||||
};
|
||||
|
||||
return style;
|
||||
}
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
|
||||
import * as defaultStyles from "./default-styles";
|
||||
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
|
||||
describe("Default Styles", () => {
|
||||
it("HeadingStyle#constructor", () => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { GridCol, TableGrid } from "./grid";
|
||||
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
|
||||
describe("GridCol", () => {
|
||||
describe("#constructor", () => {
|
||||
|
@ -10,7 +10,7 @@ export interface ITableCellOptions extends ITableCellPropertiesOptions {
|
||||
}
|
||||
|
||||
export class TableCell extends XmlComponent {
|
||||
public constructor(readonly options: ITableCellOptions) {
|
||||
public constructor(public readonly options: ITableCellOptions) {
|
||||
super("w:tc");
|
||||
|
||||
this.root.push(new TableCellProperties(options));
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { expect } from "chai";
|
||||
import { Element, xml2js } from "xml-js";
|
||||
|
||||
import { EMPTY_OBJECT, ImportedXmlComponent } from "./";
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
|
||||
import { convertToXmlComponent, ImportedXmlComponent } from "./imported-xml-component";
|
||||
import { IContext } from "./base";
|
||||
import { convertToXmlComponent } from "./imported-xml-component";
|
||||
|
||||
const xmlString = `
|
||||
<w:p w:one="value 1" w:two="value 2">
|
||||
|
@ -1,6 +1,8 @@
|
||||
// tslint:disable:no-any
|
||||
import { Element as XmlElement, xml2js } from "xml-js";
|
||||
import { IXmlableObject, XmlAttributeComponent, XmlComponent } from ".";
|
||||
|
||||
import { IXmlableObject, XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { IContext } from "./base";
|
||||
|
||||
/**
|
||||
@ -8,7 +10,7 @@ import { IContext } from "./base";
|
||||
* @param element the xml element in json presentation
|
||||
*/
|
||||
|
||||
export function convertToXmlComponent(element: XmlElement): ImportedXmlComponent | string | undefined {
|
||||
export const convertToXmlComponent = (element: XmlElement): ImportedXmlComponent | string | undefined => {
|
||||
switch (element.type) {
|
||||
case undefined:
|
||||
case "element":
|
||||
@ -26,7 +28,7 @@ export function convertToXmlComponent(element: XmlElement): ImportedXmlComponent
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ImportedXmlComponentAttributes extends XmlAttributeComponent<any> {
|
||||
// noop
|
||||
|
Reference in New Issue
Block a user