Skip to content

Commit

Permalink
eslint fix errors
Browse files Browse the repository at this point in the history
(cherry picked from commit 60fa44f748664b422b6b8112cab6ec62110a09d4)
  • Loading branch information
Olga Larina committed Sep 13, 2021
1 parent a8270a1 commit ddcbb0d
Show file tree
Hide file tree
Showing 24 changed files with 216 additions and 191 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"no-console": 2, // Remember, this means error!
"indent": [
"error",
2,
4,
{
"SwitchCase": 1,
"MemberExpression": 1,
Expand Down Expand Up @@ -100,7 +100,7 @@
"no-case-declarations": "off",
"quotes": [
"error",
"double",
"single",
{
"avoidEscape": true
}
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"search.exclude": {
"build": true,
"node_modules": true
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll": true,
//"source.organizeImports": true, // be vare of https://github.com/microsoft/vscode-typescript-tslint-plugin/issues/51
}
},
// "typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
// "typescript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
// "typescript.format.insertSpaceBeforeFunctionParenthesis": false,
// "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
// "javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
// "editor.tabSize": 2,
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build_dev": "webpack --env.buildType dev --env.platform pdf",
"build_prod": "npm run build_dev && webpack --env.buildType prod --env.platform pdf && npm run dts_clean",
"dts_clean": "node dts_cleaner.js",
"lint": "eslint ./src"
"lint": "eslint ./src --quiet"
},
"repository": {
"type": "git",
Expand Down
20 changes: 10 additions & 10 deletions src/doc_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface IRect extends IPoint {
yBot: number;
}
export interface ISize {
width: number,
height: number
width: number;
height: number;
}
export interface IMarginLR {
left?: number;
Expand Down Expand Up @@ -121,7 +121,7 @@ export class DocOptions implements IDocOptions {
return {
xLeft: this.margins.left,
yTop: this.margins.top
}
};
}
public get fontSize(): number {
return this._fontSize;
Expand Down Expand Up @@ -215,22 +215,22 @@ export class DocController extends DocOptions {
public get fontName(): string {
return this._fontName;
}
public get fontSize(): number {
return this._fontSize;
}
public get fontStyle(): string {
return this._fontStyle;
}
public set fontName(fontName: string) {
this._fontName = fontName;
this._doc.setFont(fontName);
this._helperDoc.setFont(fontName);
}
public get fontSize(): number {
return this._fontSize;
}
public set fontSize(fontSize: number) {
this._fontSize = fontSize;
this._doc.setFontSize(fontSize);
this._helperDoc.setFontSize(fontSize);
}
public get fontStyle(): string {
return this._fontStyle;
}
public set fontStyle(fontStyle: string) {
this._fontStyle = fontStyle;
this._doc.setFont(this._fontName, fontStyle);
Expand All @@ -256,7 +256,7 @@ export class DocController extends DocOptions {
return {
width: width,
height: height
}
};
}
public get unitWidth(): number {
return this.measureText().width;
Expand Down
140 changes: 71 additions & 69 deletions src/entries/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,97 @@
declare var Reflect: any;

var extendStatics = function(d: any, b: any): any {
extendStatics = Object.setPrototypeOf ||
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
return extendStatics(d, b);
};

export function __extends(d: any, b: any) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
// @ts-ignore
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
if (typeof b !== 'function' && b !== null)
throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null');
extendStatics(d, b);
function __() { this.constructor = d; }
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

export var __assign = function() {
__assign = (<any>Object).assign || function __assign(t: any) {
for (var s: any, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
__assign = (<any>Object).assign || function __assign(t: any) {
for (var s: any, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

export function __rest(s: any, e: any) {
var t: any = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, q = Object.getOwnPropertySymbols(s); i < q.length; i++) {
if (e.indexOf(q[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, q[i]))
t[q[i]] = s[q[i]];
}
return t;
var t: any = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === 'function')
for (var i = 0, q = Object.getOwnPropertySymbols(s); i < q.length; i++) {
if (e.indexOf(q[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, q[i]))
t[q[i]] = s[q[i]];
}
return t;
}

export function __decorate(decorators: any, target: any, key: any, desc: any) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') r = Reflect.decorate(decorators, target, key, desc);
// eslint-disable-next-line no-cond-assign
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}

export function __awaiter(thisArg: any, _arguments: any, P: any, generator: any) {
function adopt(value: any) { return value instanceof P ? value : new P(function (resolve: any) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve: any, reject: any) {
function fulfilled(value: any) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value: any) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result: any) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
function adopt(value: any) { return value instanceof P ? value : new P(function (resolve: any) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve: any, reject: any) {
function fulfilled(value: any) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value: any) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }
function step(result: any) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}

export function __generator(thisArg: any, body: any) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: <any>[], ops: <any>[] }, f: any, y: any, t: any, g: any;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n: any) { return function (v: any) { return step([n, v]); }; }
function step(op: any) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { (<any>_) = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: <any>[], ops: <any>[] }, f: any, y: any, t: any, g: any;
return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n: any) { return function (v: any) { return step([n, v]); }; }
function step(op: any) {
if (f) throw new TypeError('Generator is already executing.');
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { (<any>_) = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}

export function __spreadArray (to: any, from: any, pack: any) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar: any; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar: any; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
return to.concat(ar || Array.prototype.slice.call(from));
}
6 changes: 3 additions & 3 deletions src/event_handler/adorners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class AdornersBaseOptions {
}
}
export class AdornersOptions extends AdornersBaseOptions {
public question: IQuestion;
public question: IQuestion;
public constructor(point: IPoint, bricks: IPdfBrick[],
question: IQuestion, controller: DocController,
repository: FlatRepository, module: any) {
Expand All @@ -29,7 +29,7 @@ export class AdornersOptions extends AdornersBaseOptions {
}
}
export class AdornersPanelOptions extends AdornersBaseOptions {
public panel: PanelModel;
public panel: PanelModel;
public constructor(point: IPoint, bricks: IPdfBrick[],
panel: PanelModel, controller: DocController,
repository: FlatRepository, module: any) {
Expand All @@ -39,7 +39,7 @@ export class AdornersPanelOptions extends AdornersBaseOptions {
}

export class AdornersPageOptions extends AdornersBaseOptions {
public page: PageModel;
public page: PageModel;
public constructor(point: IPoint, bricks: IPdfBrick[],
page: PageModel, controller: DocController,
repository: FlatRepository, module: any) {
Expand Down
10 changes: 5 additions & 5 deletions src/event_handler/draw_canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class DrawCanvas {
protected _countPages: number,
protected _pageNumber: number) {}
/**
* Count of pages in the document
* Count of pages in the document
*/
public get countPages(): number {
return this._countPages;
Expand Down Expand Up @@ -146,7 +146,7 @@ export class DrawCanvas {
rect.xLeft = Math.max(this.rect.xLeft + rectOptions.margins.left,
(this.rect.xLeft + this.rect.xRight - itemSize.width) / 2.0);
rect.xRight = Math.min(this.rect.xRight - rectOptions.margins.right,
(this.rect.xLeft + this.rect.xRight + itemSize.width) / 2.0);
(this.rect.xLeft + this.rect.xRight + itemSize.width) / 2.0);
break;
case HorizontalAlign.Right:
rect.xLeft = Math.max(this.rect.xLeft + rectOptions.margins.left,
Expand All @@ -170,7 +170,7 @@ export class DrawCanvas {
rect.yTop = Math.max(this.rect.yTop + rectOptions.margins.top,
(this.rect.yTop + this.rect.yBot - itemSize.height) / 2.0);
rect.yBot = Math.min(this.rect.yBot - rectOptions.margins.bot,
(this.rect.yTop + this.rect.yBot + itemSize.height) / 2.0);
(this.rect.yTop + this.rect.yBot + itemSize.height) / 2.0);
break;
case VerticalAlign.Bottom:
rect.yTop = Math.max(this.rect.yTop + rectOptions.margins.top,
Expand All @@ -186,7 +186,7 @@ export class DrawCanvas {
return rect;
}
/**
* Call this method to draw text
* Call this method to draw text
* @param textOptions Set options of the drawn text
*/
public drawText(textOptions: IDrawTextOptions): void {
Expand All @@ -212,7 +212,7 @@ export class DrawCanvas {
}
/**
* Call this method to draw image
* @param imageOptions
* @param imageOptions
*/
public drawImage(imageOptions: IDrawImageOptions): void {
imageOptions = SurveyHelper.clone(imageOptions);
Expand Down
Loading

0 comments on commit ddcbb0d

Please sign in to comment.