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

@ -48,7 +48,7 @@ describe("External styles factory", () => {
describe("#parse", () => {
it("should parse w:styles attributes", () => {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any;
expect(importedStyle.rootKey).to.equal("w:styles");
@ -59,7 +59,7 @@ describe("External styles factory", () => {
});
it("should parse other child elements of w:styles", () => {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any;
expect(importedStyle.root[1]).to.deep.equal({
root: [
@ -147,7 +147,7 @@ describe("External styles factory", () => {
});
it("should parse styles elements", () => {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any;
expect(importedStyle.root.length).to.equal(5);

View File

@ -23,6 +23,7 @@ export class ExternalStylesFactory {
* <w:docDefaults>Or any other element will be parsed to</w:docDefaults>
*
* </w:styles>
*
* @param externalStyles context from styles.xml
*/
public newInstance(xmlData: string): Styles {

View File

@ -1,4 +1,4 @@
const createLsdException = (name, uiPriority, qFormat?, semiHidden?, unhideWhenUsed?) => {
const createLsdException = (name: string, uiPriority?: number, qFormat?: number, semiHidden?: number, unhideWhenUsed?: number) => {
"use strict";
return [
@ -14,8 +14,9 @@ const createLsdException = (name, uiPriority, qFormat?, semiHidden?, unhideWhenU
];
};
export const DefaultStyle = () => {
var style = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const DefaultStyle = (): Record<string, any> => {
const style = {
"w:styles": [
{
_attr: {

View File

@ -7,9 +7,9 @@ import { IParagraphStyleOptions } from "./style/paragraph-style";
export interface IStylesOptions {
readonly default?: IDefaultStylesOptions;
readonly initialStyles?: BaseXmlComponent;
readonly paragraphStyles?: IParagraphStyleOptions[];
readonly characterStyles?: ICharacterStyleOptions[];
readonly importedStyles?: (XmlComponent | StyleForParagraph | StyleForCharacter | ImportedXmlComponent)[];
readonly paragraphStyles?: readonly IParagraphStyleOptions[];
readonly characterStyles?: readonly ICharacterStyleOptions[];
readonly importedStyles?: readonly (XmlComponent | StyleForParagraph | StyleForCharacter | ImportedXmlComponent)[];
}
// <xsd:complexType name="CT_Styles">