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

@ -13,7 +13,7 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { twipsMeasureValue } from "@util/values";
export class TableGrid extends XmlComponent {
public constructor(widths: number[] | string[]) {
public constructor(widths: readonly number[] | readonly string[]) {
super("w:tblGrid");
for (const width of widths) {
this.root.push(new GridCol(width));

View File

@ -6,7 +6,7 @@ import { Table } from "../table";
import { ITableCellPropertiesOptions, TableCellProperties } from "./table-cell-properties";
export interface ITableCellOptions extends ITableCellPropertiesOptions {
readonly children: (Paragraph | Table)[];
readonly children: readonly (Paragraph | Table)[];
}
export class TableCell extends XmlComponent {

View File

@ -3,7 +3,7 @@ import { TableCell } from "../table-cell";
import { ITableRowPropertiesOptions, TableRowProperties } from "./table-row-properties";
export interface ITableRowOptions extends ITableRowPropertiesOptions {
readonly children: TableCell[];
readonly children: readonly TableCell[];
}
export class TableRow extends XmlComponent {
@ -20,7 +20,7 @@ export class TableRow extends XmlComponent {
return this.options.children.length;
}
public get cells(): TableCell[] {
public get cells(): readonly TableCell[] {
return this.root.filter((xmlComponent) => xmlComponent instanceof TableCell);
}

View File

@ -21,9 +21,9 @@ import { ITableWidthProperties } from "./table-width";
algorithm will expand columns to fit its content
*/
export interface ITableOptions {
readonly rows: TableRow[];
readonly rows: readonly TableRow[];
readonly width?: ITableWidthProperties;
readonly columnWidths?: number[];
readonly columnWidths?: readonly number[];
readonly margins?: ITableCellMarginOptions;
readonly indent?: ITableWidthProperties;
readonly float?: ITableFloatOptions;
@ -38,6 +38,7 @@ export class Table extends XmlComponent {
public constructor({
rows,
width,
// eslint-disable-next-line functional/immutable-data
columnWidths = Array<number>(Math.max(...rows.map((row) => row.CellCount))).fill(100),
margins,
indent,