linting fixes

This commit is contained in:
Dolan
2017-03-08 21:49:41 +00:00
parent 279a5a93f1
commit 946a222d37
16 changed files with 67 additions and 66 deletions

View File

@ -1,7 +1,7 @@
import {XmlAttributeComponent} from "./default-attributes";
import { XmlAttributeComponent } from "./default-attributes";
interface AttributesProperties {
val?: any;
interface IAttributesProperties {
val?: string | number | boolean;
color?: string;
space?: string;
sz?: string;
@ -24,7 +24,7 @@ interface AttributesProperties {
export class Attributes extends XmlAttributeComponent {
constructor(properties?: AttributesProperties) {
constructor(properties?: IAttributesProperties) {
super({
val: "w:val",
color: "w:color",
@ -44,7 +44,7 @@ export class Attributes extends XmlAttributeComponent {
footer: "w:footer",
gutter: "w:gutter",
linePitch: "w:linePitch",
pos: "w:pos"
pos: "w:pos",
}, properties);
}
}
}

View File

@ -5,7 +5,9 @@ export abstract class BaseXmlComponent {
this.rootKey = rootKey;
}
abstract replaceKey(): void;
clearVariables(): void {
public abstract replaceKey(): void;
public clearVariables(): void {
// Do Nothing
}
}
}

View File

@ -1,5 +1,5 @@
import {BaseXmlComponent} from "./base";
import * as _ from "lodash";
import { BaseXmlComponent } from "./base";
export abstract class XmlAttributeComponent extends BaseXmlComponent {
protected root: Object;
@ -16,10 +16,10 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent {
}
}
replaceKey(): void {
public replaceKey(): void {
if (this.root !== undefined) {
_.forOwn(this.root, (value, key) => {
let newKey = this.xmlKeys[key];
const newKey = this.xmlKeys[key];
this.root[newKey] = value;
delete this.root[key];
});
@ -27,4 +27,4 @@ export abstract class XmlAttributeComponent extends BaseXmlComponent {
delete this.root;
}
}
}
}

View File

@ -1,19 +1,19 @@
import * as _ from "lodash";
import {BaseXmlComponent} from "./base";
import { BaseXmlComponent } from "./base";
export abstract class XmlComponent extends BaseXmlComponent {
protected root: Array<BaseXmlComponent>;
protected root: BaseXmlComponent[];
constructor(rootKey: string) {
super(rootKey);
this.root = new Array<BaseXmlComponent>();
}
replaceKey(): void {
public replaceKey(): void {
// console.log(this.rootKey);
// console.log(this.root);
if (this.root !== undefined) {
this.root.forEach(root => {
this.root.forEach((root) => {
if (root && root instanceof BaseXmlComponent) {
root.replaceKey();
}
@ -27,4 +27,4 @@ export abstract class XmlComponent extends BaseXmlComponent {
export * from "./attributes"
export * from "./default-attributes";
export * from "./unit";
export * from "./property";
export * from "./property";

View File

@ -1,17 +1,17 @@
import {XmlComponent} from "./";
import {ParagraphProperties} from "../paragraph/properties";
import {RunProperties} from "../run/properties";
import { ParagraphProperties } from "../paragraph/properties";
import { RunProperties } from "../run/properties";
import { XmlComponent } from "./";
export class ParagraphPropertyXmlComponent extends XmlComponent {
private paragraphProperties: ParagraphProperties;
constructor(rootKey) {
constructor(rootKey: string) {
super(rootKey);
this.paragraphProperties = new ParagraphProperties();
this.root.push(this.paragraphProperties);
}
clearVariables(): void {
public clearVariables(): void {
this.paragraphProperties.clearVariables();
delete this.paragraphProperties;
@ -21,13 +21,13 @@ export class ParagraphPropertyXmlComponent extends XmlComponent {
export class RunPropertyXmlComponent extends XmlComponent {
private runProperties: RunProperties;
constructor(rootKey) {
constructor(rootKey: string) {
super(rootKey);
this.runProperties = new RunProperties();
this.root.push(this.runProperties);
}
clearVariables(): void {
public clearVariables(): void {
this.runProperties.clearVariables();
delete this.runProperties;
@ -38,7 +38,7 @@ export class MultiPropertyXmlComponent extends XmlComponent {
private runProperties: RunProperties;
private paragraphProperties: ParagraphProperties;
constructor(rootKey) {
constructor(rootKey: string) {
super(rootKey);
this.runProperties = new RunProperties();
this.root.push(this.runProperties);
@ -47,11 +47,11 @@ export class MultiPropertyXmlComponent extends XmlComponent {
this.root.push(this.paragraphProperties);
}
clearVariables(): void {
public clearVariables(): void {
this.runProperties.clearVariables();
this.paragraphProperties.clearVariables();
delete this.runProperties;
delete this.paragraphProperties;
}
}
}

View File

@ -7,10 +7,10 @@ export abstract class XmlUnitComponent extends BaseXmlComponent {
super(rootKey);
}
replaceKey(): void {
public replaceKey(): void {
if (this.root !== undefined) {
this[this.rootKey] = this.root;
delete this.root;
}
}
}
}