Skip to content

Commit

Permalink
Lint refactoring (#7971)
Browse files Browse the repository at this point in the history
* refactoring eslintrc.json

* refactoring eslintrc.json

* refactoring eslintrc.json

---------

Co-authored-by: OlgaLarina <[email protected]>
  • Loading branch information
OlgaLarina and OlgaLarina authored Mar 14, 2024
1 parent ad5a0c1 commit 4e4e463
Show file tree
Hide file tree
Showing 43 changed files with 161 additions and 124 deletions.
90 changes: 80 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"vue",
"react",
"@typescript-eslint",
"surveyjs"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:vue/essential"
"plugin:@typescript-eslint/recommended"
],
"rules": {
"surveyjs/no-test-only": 2,
Expand Down Expand Up @@ -156,5 +148,83 @@
"off",
"windows"
]
}
},
"overrides": [
{
"files": [
"src/*.ts"
],
"rules": {
"no-restricted-properties": [
"error",
{
"object": "window",
"property": "document"
}
],
"no-restricted-globals": [
"error",
{
"name": "document",
"message": "Do not use document into survey-core. Use methods from DomDocumentHelper"
},
{
"name": "window",
"message": "Do not use window into survey-core. Use method from DomWindowHelper"
}
]
}
},
{
"files": [
"*.jsx"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"@typescript-eslint",
"react"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
]
},
{
"files": [
"*.vue"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": false
}
},
"plugins": [
"@typescript-eslint",
"vue"
],
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/eslint-config-typescript"
],
"rules": {
"no-extra-boolean-cast": "off",
"vue/no-use-v-if-with-v-for": "off",
"vue/multi-word-component-names": "off"
}
},
{
"files": [
"*.js"
],
"rules": {
"no-undef": "off"
}
}
]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"@types/signature_pad": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"@vue/eslint-config-typescript": "^11.0.0",
"ace-builds": "1.2.2",
"ajv": "6.12.3",
"autoprefixer": "^10.4.17",
Expand All @@ -133,7 +134,7 @@
"eslint-cli": "^1.1.1",
"eslint-plugin-react": "7.30.1",
"eslint-plugin-surveyjs": "file:eslint-surveyjs",
"eslint-plugin-vue": "^7.16.0",
"eslint-plugin-vue": "^9.3.0",
"file-loader": "0.10.0",
"generate-json-webpack-plugin": "^1.0.0",
"get-func-name": "2.0.0",
Expand Down Expand Up @@ -214,4 +215,4 @@
"signature_pad": "^4.1.5",
"vite": "^3.1.8"
}
}
}
22 changes: 0 additions & 22 deletions src/.eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion src/plugins/react/reactquestiondate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default class SurveyQuestionDate extends React.Component<any, any> {
var funcText = this.question.getjQueryScript(this.getDateId());
var scriptText = "$(function () { " + funcText + " });";
var rootId = this.getDivId();
// eslint-disable-next-line no-restricted-globals
var scriptEl = document.createElement("script");
scriptEl.type = "text/javascript";
scriptEl.text = scriptText;
Expand Down
10 changes: 5 additions & 5 deletions src/vue/checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<fieldset :class="question.getSelectBaseRootCss()"
<fieldset :class="question.getSelectBaseRootCss()"
:role="question.a11y_input_ariaRole"
:aria-required="question.a11y_input_ariaRequired"
:aria-label="question.a11y_input_ariaLabel"
Expand Down Expand Up @@ -28,20 +28,20 @@
<div :class="question.cssClasses.rootRow" v-if="question.blockedRow">
<component
v-if="!question.hasColumns && question.blockedRow"
v-for="(item, index) in question.dataChoices"
v-for="item in question.dataChoices"
:key="item.value"
:is="question.itemComponent"
:question="question"
:item="item"
></component>
</div>
<div
<div
v-if="question.hasColumns"
:class="question.cssClasses.rootMultiColumn">

<div

v-for="(column, colIndex) in question.columns"
v-bind:key="colIndex"
:class="question.getColumnClass()"
role="presentation"
>
Expand All @@ -55,7 +55,7 @@
</div>
</div>
<component
v-for="(item, index) in question.footItems"
v-for="item in question.footItems"
v-if="question.hasFootItems"
:key="item.value"
:is="question.itemComponent"
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/action-bar/action-bar-item-dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
>{{ item.title }}</span
>
</button>
<sv-popup
:model="item.popupModel"
<sv-popup
:model="item.popupModel"
:getTarget="getTarget"></sv-popup>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/action-bar/action-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ActionBarViewModel extends BaseVue {
getModel(): ActionContainer<Action> {
return this.model;
}
mounted() {
if (!this.model.hasActions) return;
const container: HTMLDivElement = <HTMLDivElement>this.$el;
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/action-bar/action.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-bind:class="item.getActionRootCss()"
<div v-bind:class="item.getActionRootCss()"
:id="item.id">
<div class="sv-action__content">
<sv-action-bar-separator
Expand Down
5 changes: 3 additions & 2 deletions src/vue/components/container.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div v-if="components.length > 0" class="sv-components-column">
<template v-for="(component, index) in components">
<component
<template v-for="component in components">
<component
:is="component.component"
:key="component.index"
:survey="survey"
:container="container"
:model="component.data"
Expand Down
3 changes: 2 additions & 1 deletion src/vue/components/header/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<div v-if="!!model.backgroundImage" :class="model.backgroundImageClasses" :style="model.backgroundImageStyle"></div>
<div v-if="!survey.isMobile" :class="model.contentClasses" :style="{ maxWidth: model.maxWidth }">
<sv-header-cell
v-for="cell in model.cells"
v-for="(cell, index) in model.cells"
v-bind:key="index"
:model="cell"
></sv-header-cell>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/list/list-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
v-on:click="click"
v-key2click
>
<div
<div
v-if="item.needSeparator"
v-bind:class="model.cssClasses.itemSeparator"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/loading-indicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
</div>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import Vue from 'vue';
import { Component } from "vue-property-decorator";
import Vue from "vue";
@Component
export class LoadingIndicatorComponent extends Vue {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<sv-svg-icon :iconName="question.cssClasses.progressBtnIcon" :size="'auto'"></sv-svg-icon>
</div>
</template>

<script lang="ts">
import Vue from "vue";
import { Component } from "vue-property-decorator";
import { PaneldynamicAction } from "./paneldynamic-add-btn.vue";
@Component
export class PanelDynamicNextBtn extends PaneldynamicAction {
nextPanelClick() {
nextPanelClick() {
this.question.goToNextPanel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<sv-svg-icon :iconName="question.cssClasses.progressBtnIcon" :size="'auto'"></sv-svg-icon>
</div>
</template>

<script lang="ts">
import Vue from "vue";
import { Component } from "vue-property-decorator";
import { PaneldynamicAction } from "./paneldynamic-add-btn.vue";
@Component
export class PanelDynamicPrevBtn extends PaneldynamicAction {
prevPanelClick() {
prevPanelClick() {
this.question.goToPrevPanel();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/rating/rating-dropdown-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { BaseVue } from "../../base";
@Component
export class RatingItem extends BaseVue {
@Prop() item: any;
constructor() {
super();
}
Expand Down
1 change: 0 additions & 1 deletion src/vue/components/rating/rating-item-smiley.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Component, Prop } from "vue-property-decorator";
import { RenderedRatingItem, QuestionRatingModel, Action } from "survey-core";
import { BaseVue } from "../../base";
@Component
export class RatingItemSmiley extends BaseVue {
@Prop() item: RenderedRatingItem;
Expand Down
5 changes: 2 additions & 3 deletions src/vue/components/rating/rating-item-star.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<label :key="item.value" @mousedown="question.onMouseDown()" :class="question.getItemClass(item.itemValue)"
@mouseover="(e) => question.onItemMouseIn(item)"
<label :key="item.value" @mousedown="question.onMouseDown()" :class="question.getItemClass(item.itemValue)"
@mouseover="(e) => question.onItemMouseIn(item)"
@mouseleave="(e) => question.onItemMouseOut(item)">
<input type="radio" class="sv-visuallyhidden" :name="question.name" :id="question.getInputId(index)"
:value="item.value" :disabled="question.isInputReadOnly" @click="(e) => question.setValueFromClick(e.target.value)"
Expand All @@ -17,7 +17,6 @@ import { Component, Prop } from "vue-property-decorator";
import { RenderedRatingItem, QuestionRatingModel, Action } from "survey-core";
import { BaseVue } from "../../base";
@Component
export class RatingItemStar extends BaseVue {
@Prop() item: RenderedRatingItem;
Expand Down
1 change: 0 additions & 1 deletion src/vue/components/rating/rating-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Component, Prop } from "vue-property-decorator";
import { RenderedRatingItem, QuestionRatingModel, Action } from "survey-core";
import { BaseVue } from "../../base";
@Component
export class RatingItem extends BaseVue {
@Prop() item: RenderedRatingItem;
Expand Down
1 change: 0 additions & 1 deletion src/vue/components/tagbox/tagbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
v-if="!question.isReadOnly"
:id="question.inputId"
:tabindex="model.noTabIndex ? undefined : 0"
v-model="question.renderedValue"
v-bind:disabled="question.isInputReadOnly"
@keydown="keyhandler"
@blur="blur"
Expand Down
4 changes: 1 addition & 3 deletions src/vue/customwidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export class CustomWidget extends Vue {
get hasVueComponent(): boolean {
var options = (<any>Vue)["options"];
if (!options) return false;
return (
options.components && options.components[this.question.customWidget.name]
);
return !!(options.components && options.components[this.question.customWidget.name]);
}
get componentName(): string {
if (this.hasVueComponent) return this.question.customWidget.name;
Expand Down
Loading

0 comments on commit 4e4e463

Please sign in to comment.