Skip to content

Commit

Permalink
eslint fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga Larina committed Aug 20, 2021
1 parent bcece8f commit 485a5bd
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build_prod": "npm run build_dev && concurrently \"npm run build_knockout_prod\" \"npm run build_react_prod\" \"npm run build_angular_prod\" \"npm run build_jquery_prod\" \"npm run build_vue_prod\" \"npm run build_core_prod\"",
"doc_gen": "node doc_generator/lib_docgenerator.js src/entries/chunks/model.ts",
"doc_update": "chmod +x ./docupdate_npm.sh && ./docupdate_npm.sh",
"lint": "eslint ./src --quiet",
"lint": "eslint ./src",
"watch_knockout_dev": "webpack --config ./build-scripts/survey-knockout/webpack.config.js --env.buildType dev --watch",
"watch_react_dev": "webpack --config ./build-scripts/survey-react/webpack.config.js --env.buildType dev --watch",
"watch_angular_dev": "webpack --config ./build-scripts/survey-angular/webpack.config.js --env.buildType dev --watch",
Expand Down
5 changes: 2 additions & 3 deletions src/entries/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ export class ReactSurveyModel extends Survey {
css: any = null
) {
super(jsonObj, renderedElement, css);
console.warn(
"ReactSurveyModel is depricated in this context. Use Survey.Model instead."
);
// eslint-disable-next-line no-console
console.warn("ReactSurveyModel is depricated in this context. Use Survey.Model instead.");
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/expressions/expressionParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export class SyntaxError extends Error {
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
// eslint-disable-next-line no-control-regex
.replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch))
// eslint-disable-next-line no-control-regex
.replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch));
}

Expand All @@ -83,7 +85,9 @@ export class SyntaxError extends Error {
.replace(/\t/g, "\\t")
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
// eslint-disable-next-line no-control-regex
.replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch))
// eslint-disable-next-line no-control-regex
.replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch));
}

Expand Down
1 change: 1 addition & 0 deletions src/knockout/koquestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export class QuestionImplementor extends ImplementorBase {
try {
this.question.customWidget.willUnmount(this.question, el);
} catch {
// eslint-disable-next-line no-console
console.warn("Custom widget will unmount failed");
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/localizablestring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export class LocalizableString implements ILocalizableString {
public get text(): string {
return this.pureText;
}
public set text(value: string) {
this.setLocaleText(this.locale, value);
}
public get calculatedText(): string {
this.renderedText =
this.calculatedTextValue !== undefined
Expand Down Expand Up @@ -114,9 +117,6 @@ export class LocalizableString implements ILocalizableString {
public get renderedHtml() {
return this.textOrHtml;
}
public set text(value: string) {
this.setLocaleText(this.locale, value);
}
public getLocaleText(loc: string): string {
if (!loc) loc = settings.defaultLocaleName;
var res = this.getValue(loc);
Expand Down
40 changes: 20 additions & 20 deletions src/question_matrixdropdownbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,26 @@ implements ISurveyData, ISurveyImpl, ILocalizableOwner {
}
return result;
}
public set value(value: any) {
this.isSettingValue = true;
this.subscribeToChanges(value);
var questions = this.questions;
for (var i = 0; i < questions.length; i++) {
var question = questions[i];
var val = this.getCellValue(value, question.getValueName());
var oldComment = question.comment;
var comment = !!value
? value[question.getValueName() + settings.commentPrefix]
: "";
if (comment == undefined) comment = "";
question.updateValueFromSurvey(val);
if (!!comment || Helpers.isTwoValueEquals(oldComment, question.comment)) {
question.updateCommentFromSurvey(comment);
}
question.onSurveyValueChanged(val);
}
this.isSettingValue = false;
}
public get locText(): LocalizableString {
return null;
}
Expand Down Expand Up @@ -973,26 +993,6 @@ implements ISurveyData, ISurveyImpl, ILocalizableOwner {
questions[i].clearValue();
}
}
public set value(value: any) {
this.isSettingValue = true;
this.subscribeToChanges(value);
var questions = this.questions;
for (var i = 0; i < questions.length; i++) {
var question = questions[i];
var val = this.getCellValue(value, question.getValueName());
var oldComment = question.comment;
var comment = !!value
? value[question.getValueName() + settings.commentPrefix]
: "";
if (comment == undefined) comment = "";
question.updateValueFromSurvey(val);
if (!!comment || Helpers.isTwoValueEquals(oldComment, question.comment)) {
question.updateCommentFromSurvey(comment);
}
question.onSurveyValueChanged(val);
}
this.isSettingValue = false;
}
public onAnyValueChanged(name: string) {
var questions = this.questions;
for (var i = 0; i < questions.length; i++) {
Expand Down
40 changes: 20 additions & 20 deletions src/question_matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,26 +210,6 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
public get rowCount(): number {
return this.rowCountValue;
}
/**
* Set this property to true, to allow rows drag and drop.
*/
public get allowRowsDragAndDrop(): boolean {
return this.getPropertyValue("allowRowsDragAndDrop");
}
public set allowRowsDragAndDrop(val: boolean) {
this.setPropertyValue("allowRowsDragAndDrop", val);
}

protected createRenderedTable(): QuestionMatrixDropdownRenderedTable {
return new QuestionMatrixDynamicRenderedTable(this);
}

private get rowCountValue(): number {
return this.getPropertyValue("rowCount", 2);
}
private set rowCountValue(val: number) {
this.setPropertyValue("rowCount", val);
}
public set rowCount(val: number) {
if (val < 0 || val > settings.matrixMaximumRowCount) return;
this.setRowCountValueFromData = false;
Expand Down Expand Up @@ -264,6 +244,26 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
}
return res;
}
/**
* Set this property to true, to allow rows drag and drop.
*/
public get allowRowsDragAndDrop(): boolean {
return this.getPropertyValue("allowRowsDragAndDrop");
}
public set allowRowsDragAndDrop(val: boolean) {
this.setPropertyValue("allowRowsDragAndDrop", val);
}

protected createRenderedTable(): QuestionMatrixDropdownRenderedTable {
return new QuestionMatrixDynamicRenderedTable(this);
}

private get rowCountValue(): number {
return this.getPropertyValue("rowCount", 2);
}
private set rowCountValue(val: number) {
this.setPropertyValue("rowCount", val);
}
/**
* The minimum row count. A user could not delete a row if the rowCount equals to minRowCount
* @see rowCount
Expand Down
1 change: 0 additions & 1 deletion src/react/reactquestion_dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class SurveyQuestionDropdown extends SurveyQuestionUncontrolledElement<Qu
if (this.isDisplayMode) {
var isOtherSelected = this.question.isOtherSelected;
return (
// @ts-ignore
<div id={this.question.inputId} className={this.question.getControlClass()} disabled>
{isOtherSelected
? this.question.otherText
Expand Down
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2305,10 +2305,10 @@ export class SurveyModel extends Base
this.notifyElementsOnAnyValueOrVariableChanged("");
this.runConditions();
}
private onEditingObjPropertyChanged: (sender: Base, options: any) => void;
public get editingObj(): Base {
return this.editingObjValue;
}
private onEditingObjPropertyChanged: (sender: Base, options: any) => void;
public set editingObj(val: Base) {
if (this.editingObj == val) return;
if (!!this.editingObj) {
Expand Down

0 comments on commit 485a5bd

Please sign in to comment.