Use new eslint-plugin-functional instead of tslint-immutable

This commit is contained in:
Dolan Miu
2022-09-15 20:00:50 +01:00
parent d020d59b11
commit e90d97b813
70 changed files with 321 additions and 436 deletions

View File

@ -12,7 +12,7 @@ export interface ICommentOptions {
}
export interface ICommentsOptions {
readonly children: ICommentOptions[];
readonly children: readonly ICommentOptions[];
}
class CommentAttributes extends XmlAttributeComponent<{

View File

@ -40,7 +40,7 @@ describe("ImageRun", () => {
const tree = new Formatter().format(currentImageRun, {
file: {
Media: {
// tslint:disable-next-line: no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function
addImage: () => {},
},
} as unknown as File,
@ -290,7 +290,7 @@ describe("ImageRun", () => {
const tree = new Formatter().format(currentImageRun, {
file: {
Media: {
// tslint:disable-next-line: no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function
addImage: () => {},
},
} as unknown as File,
@ -519,6 +519,7 @@ describe("ImageRun", () => {
});
it("should return UInt8Array if atob is present", () => {
// eslint-disable-next-line functional/immutable-data
global.atob = () => "atob result";
const currentImageRun = new ImageRun({
@ -542,7 +543,7 @@ describe("ImageRun", () => {
const tree = new Formatter().format(currentImageRun, {
file: {
Media: {
// tslint:disable-next-line: no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function
addImage: () => {},
},
} as unknown as File,
@ -775,6 +776,7 @@ describe("ImageRun", () => {
});
it("should use data as is if its not a string", () => {
// eslint-disable-next-line functional/immutable-data
global.atob = () => "atob result";
const currentImageRun = new ImageRun({
@ -798,7 +800,7 @@ describe("ImageRun", () => {
const tree = new Formatter().format(currentImageRun, {
file: {
Media: {
// tslint:disable-next-line: no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function
addImage: () => {},
},
} as unknown as File,

View File

@ -62,6 +62,7 @@ export class ImageRun extends Run {
.map((c) => c.charCodeAt(0)),
);
} else {
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const b = require("buf" + "fer");
return new b.Buffer(dataURI, "base64");
}

View File

@ -12,7 +12,7 @@ import { Text } from "./run-components/text";
import { TextAttributes } from "./text-attributes";
export interface IRunOptions extends IRunPropertiesOptions {
readonly children?: (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[];
readonly children?: readonly (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[];
readonly break?: number;
readonly text?: string;
}