Skip to content

Commit

Permalink
Update linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
rolljee committed Nov 4, 2024
1 parent 4b23300 commit f9fe638
Show file tree
Hide file tree
Showing 13 changed files with 1,118 additions and 1,455 deletions.
29 changes: 29 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,33 @@ module.exports = {
project: path.join(__dirname, 'tsconfig.json'),
},
ignorePatterns: ['dist/*'],
rules: {
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/require-array-sort-compare': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'vue/multi-word-component-names': 'off',
'vue/block-lang': 'off',
'vue/no-mutating-props': 'off',
'array-callback-return': 'off',
'vue/require-default-prop': 'off',
'vue/order-in-components': 'off',
'vue/no-useless-template-attributes': 'off',
'vue/no-reserved-component-names': 'off',
'vue/require-prop-types': 'off',
'vue/no-lone-template': 'off',
'default-case-last': 'warn',
'import/order': 'warn'
},
};
2,466 changes: 1,060 additions & 1,406 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"eslint-plugin-cypress": "^3.5.0",
"eslint-plugin-vue-kuzzle": "^0.0.13",
"file-loader": "^6.2.0",
"kuzzle": "^2.31.0",
"kuzzle": "^2.33.0",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "~1.63.6",
"ts-mock-imports": "^1.3.16",
Expand Down
8 changes: 4 additions & 4 deletions src/components/Common/Filters/FavoriteFilterItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export default {
this.$emit('favoris-delete', this.favorite.id);
},
useFilter() {
if (this.favorite.active == 'raw') {
if (this.favorite.active === 'raw') {
this.$parent.$emit('filter-raw-submitted', this.favorite.raw, true);
}
if (this.favorite.active == 'basic') {
if (this.favorite.active === 'basic') {
this.$parent.$emit(
'filter-basic-submitted',
this.favorite.basic,
Expand All @@ -100,8 +100,8 @@ export default {
},
getFilter() {
const loadedFilter = Object.assign(new filterManager.Filter(), this.favorite);
if (loadedFilter.active == 'basic') return loadedFilter.basic;
if (loadedFilter.active == 'raw') return loadedFilter.raw;
if (loadedFilter.active === 'basic') return loadedFilter.basic;
if (loadedFilter.active === 'raw') return loadedFilter.raw;
},
toggleCollapse() {
this.expanded = !this.expanded;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Common/Filters/FilterHistoryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export default {
},
getFilter() {
const loadedFilter = Object.assign(new filterManager.Filter(), this.filter);
if (loadedFilter.active == 'basic') return loadedFilter.basic;
if (loadedFilter.active == 'raw') return loadedFilter.raw;
if (loadedFilter.active === 'basic') return loadedFilter.basic;
if (loadedFilter.active === 'raw') return loadedFilter.raw;
},
toggleCollapse() {
this.expanded = !this.expanded;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/JsonEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
</template>

<script>
import Vue from 'vue';
import ace from 'ace-builds';
import 'ace-builds/src-noconflict/theme-tomorrow';
import 'ace-builds/src-noconflict/mode-json';
import Vue from 'vue';
export default {
name: 'JsonEditor',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/Stepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div
class="Stepper-step col s1"
:class="{
disabled: disabledSteps.indexOf(index) != -1,
disabled: disabledSteps.indexOf(index) !== -1,
'offset-s4': index === 0,
}"
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Data/Leftnav/IndexBranch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default {
this.open = true;
}
if (this.filter == '') {
if (this.filter === '') {
this.open = false;
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/components/Materialize/Pagination.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div>
<ul class="pagination">
<li :class="{ disabled: currentPage == 1 }" class="chevron" @click.prevent="firstPage">
<li :class="{ disabled: currentPage === 1 }" class="chevron" @click.prevent="firstPage">
<a href="#">
<i class="fa fa-angle-double-left fast-pagination waves-effect" />
</a>
</li>
<li :class="{ disabled: currentPage == 1 }" class="chevron" @click.prevent="previousPage">
<li :class="{ disabled: currentPage === 1 }" class="chevron" @click.prevent="previousPage">
<a href="#" class="waves-effect">
<i class="fa fa-chevron-left" />
</a>
Expand All @@ -22,12 +22,12 @@
<a href="#">{{ n }}</a>
</li>

<li :class="{ disabled: currentPage == pages }" class="chevron" @click.prevent="nextPage">
<li :class="{ disabled: currentPage === pages }" class="chevron" @click.prevent="nextPage">
<a href="#">
<i class="fa fa-chevron-right waves-effect" />
</a>
</li>
<li :class="{ disabled: currentPage == pages }" class="chevron" @click.prevent="lastPage">
<li :class="{ disabled: currentPage === pages }" class="chevron" @click.prevent="lastPage">
<a href="#">
<i class="fa fa-angle-double-right fast-pagination waves-effect" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Materialize/Toaster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useToasterStore } from '@/stores';
const toasterStore = useToasterStore();
toasterStore.$subscribe((_mutation, state) => {
if (state.toast != undefined) {
if (state.toast !== undefined) {
// TODO: Import Materialize properly
// @ts-expect-error
M.toast({
Expand Down
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Vue from 'vue';
import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue';
import { createPinia, PiniaVuePlugin } from 'pinia';
import VueFormGenerator from 'vue-form-generator';
import VueRouter from 'vue-router';

import createRoutes from './routes/index';
import './plugins/logger';
import { useKuzzleStore } from './stores';
import VueFormGenerator from 'vue-form-generator';
import 'leaflet/dist/leaflet.css';
import 'vue-form-generator/dist/vfg.css';

import DateTimeFormInput from '@/components/Data/Documents/FormInputs/DateTimeFormInput.vue';
import JsonFormInput from '@/components/Data/Documents/FormInputs/JsonFormInput.vue';
import 'leaflet/dist/leaflet.css';
import { useKuzzleStore } from './stores';

Check warning on line 11 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

`./stores` import should occur after import of `./routes/index`

Check warning on line 11 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

`./stores` import should occur after import of `./routes/index`

import App from './App.vue';

Check warning on line 13 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

`./App.vue` import should occur after import of `@/components/Data/Documents/FormInputs/JsonFormInput.vue`

Check warning on line 13 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

`./App.vue` import should occur after import of `@/components/Data/Documents/FormInputs/JsonFormInput.vue`
import createRoutes from './routes/index';

Check warning on line 14 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

There should be at least one empty line between import groups

Check warning on line 14 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint

There should be at least one empty line between import groups
import DateTimeFormInput from '@/components/Data/Documents/FormInputs/DateTimeFormInput.vue';
import JsonFormInput from '@/components/Data/Documents/FormInputs/JsonFormInput.vue';

Reflect.defineProperty(window, 'kuzzle', {
get() {
Expand Down
24 changes: 2 additions & 22 deletions src/services/kuzzleWrapper-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ import type { MappingAttributes } from './mappingHelpers';
// corresponding to the selected environment.
export const kuzzle = new Kuzzle(new WebSocket('localhost'));

// Helper for performSearch
const getValueAdditionalAttribute = (content, attributePath) => {
const attribute = attributePath.shift();

if (typeof content[attribute] === 'object') {
return getValueAdditionalAttribute(content[attribute], attributePath);
}

return content[attribute];
};

function buildCaseInsensitiveRegexp(searchString) {
return searchString
.split('')
Expand Down Expand Up @@ -76,9 +65,9 @@ export class KuzzleWrapperV1 {

try {
await this.kuzzle.connect();
} catch (error) {
} catch (error: any) {
if (error.message.match(/^Incompatible SDK client/)) {
const e = new Error(error);
const e = new Error(error) as any;
e.id = 'api.process.incompatible_sdk_version';
throw e;
}
Expand Down Expand Up @@ -116,15 +105,6 @@ export class KuzzleWrapperV1 {
const strategies = await this.kuzzle.auth.getStrategies();

const result = await this.kuzzle.security.searchUsers({ ...filters, sort }, { ...pagination });
let additionalAttributeName: any = null;

if (sort.length > 0) {
if (typeof sort[0] === 'string') {
additionalAttributeName = sort[0];
} else {
additionalAttributeName = Object.keys(sort[0])[0];
}
}

const users: any[] = [];
for (const user of result.hits) {
Expand Down
12 changes: 6 additions & 6 deletions src/stores/kuzzle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const useKuzzleStore = defineStore('kuzzle', {

return payload.id;
},
deleteEnvironment(id) {
deleteEnvironment(id: string) {
if (!Object.keys(this.environments).includes(id)) {
return;
}
Expand All @@ -111,7 +111,7 @@ export const useKuzzleStore = defineStore('kuzzle', {

localStorage.setItem(LS_ENVIRONMENTS, JSON.stringify(this.environments));
},
updateTokenCurrentEnvironment(payload) {
updateTokenCurrentEnvironment(payload: any) {
if (!this.currentId || this.currentEnvironment == null) {
throw new Error('No current environment selected');
}
Expand All @@ -126,7 +126,7 @@ export const useKuzzleStore = defineStore('kuzzle', {

localStorage.setItem(LS_ENVIRONMENTS, JSON.stringify(this.environments));
},
updateEnvironment(payload) {
updateEnvironment(payload: any) {
let mustReconnect = false;

if (
Expand Down Expand Up @@ -193,7 +193,7 @@ export const useKuzzleStore = defineStore('kuzzle', {
throw new Error(`Id ${id} does not match any environment`);
}

await this.setCurrentEnvironment(id);
this.setCurrentEnvironment(id);
localStorage.setItem(LS_LAST_ENV, id);

return await this.connectToCurrentEnvironment();
Expand All @@ -204,7 +204,7 @@ export const useKuzzleStore = defineStore('kuzzle', {
this.errorFromKuzzle = error.message;
},
loadEnvironments() {
const loadedEnv = JSON.parse(localStorage.getItem(LS_ENVIRONMENTS) || '{}');
const loadedEnv = JSON.parse(localStorage.getItem(LS_ENVIRONMENTS) ?? '{}');

Object.keys(loadedEnv).forEach((envId) => {
const env = loadedEnv[envId];
Expand All @@ -228,7 +228,7 @@ export const useKuzzleStore = defineStore('kuzzle', {
this.currentId = currentId;
} else {
currentId = localStorage.getItem(LS_LAST_ENV);
this.setCurrentEnvironment(currentId || undefined);
this.setCurrentEnvironment(currentId ?? undefined);
}
},
},
Expand Down

0 comments on commit f9fe638

Please sign in to comment.