MT#60094 Lint review

Resolve current lint issues to improve the code reliability.
Disable lint for auto-generated/auto-updated files. Note,
Vue3 does not longer provide a default export therefore the line
has been ignored for now, however tests still seem to work as expected.

Change-Id: I668c50868b4cb9eceb0ff89767be9082585655a7
mr12.4
Debora Crescenzo 12 months ago
parent 762256c587
commit 3508a116ff

@ -11,7 +11,8 @@ module.exports = {
},
env: {
browser: true
browser: true,
'jest/globals': true
},
// Rules order is important, please avoid shuffling them
@ -32,17 +33,17 @@ module.exports = {
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
// required to lint *.vue files
'vue',
'jest'
],
globals: {
'ga': true, // Google Analytics
'cordova': true,
'__statics': true,
'process': true,
'Capacitor': true,
'chrome': true,
'jest': true
ga: true, // Google Analytics
cordova: true,
__statics: true,
process: true,
Capacitor: true,
chrome: true,
jest: true
},
// add your custom rules here
@ -66,15 +67,16 @@ module.exports = {
'no-trailing-spaces': 'error',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// eslint-disable-next-line quote-props
'indent': ['error', 4],
'vue/script-indent': ['error', 4],
'vue/html-indent': ['error', 4]
},
"overrides": [
overrides: [
{
"files": ["*.vue"],
"rules": {
"indent": "off"
files: ['*.vue'],
rules: {
indent: 'off'
}
}
]

@ -2,7 +2,9 @@
const path = require('path')
const fs = require('fs')
// eslint-disable-next-line node/no-path-concat
const filePathTemplate = path.resolve(__dirname + '/../src/config/app.template.root.js')
// eslint-disable-next-line node/no-path-concat
const filePathConfig = path.resolve(__dirname + '/../src/config/app.js')
const template = fs.readFileSync(filePathTemplate, 'utf8')
const rendered = template.split('{{host}}').join(process.argv[2])

@ -1,6 +1,6 @@
#!/usr/bin/env node
// vim: set filetype=javascript:
/* eslint-disable */
/* eslint-disable */
'use strict';
const program = require('commander');
const { reportCommand } = require('./vue-i18n-extract.umd.js');

@ -1,3 +1,4 @@
/* eslint-disable */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('is-valid-glob'), require('glob'), require('fs'), require('dot-object'), require('js-yaml')) :
typeof define === 'function' && define.amd ? define(['exports', 'path', 'is-valid-glob', 'glob', 'fs', 'dot-object', 'js-yaml'], factory) :

@ -1,13 +1,14 @@
self.addEventListener('notificationclick', function (event) {
event.notification.close()
var promiseChain = clients.matchAll({
// eslint-disable-next-line no-undef
const promiseChain = clients.matchAll({
type: 'window',
includeUncontrolled: true
}).then((windowClients) => {
var matchingClient = null
for (var i = 0; i < windowClients.length; i++) {
var windowClient = windowClients[i]
// eslint-disable-next-line no-unused-vars
const matchingClient = null
for (let i = 0; i < windowClients.length; i++) {
const windowClient = windowClients[i]
if (windowClient.url === event.notification.data.url) {
return windowClient.focus()
}

@ -1,4 +1,4 @@
// eslint-disable-next-line import/default
import Vue from 'vue'
export function reactiveSet (object, name, value) {

@ -1,5 +1,5 @@
'use strict'
// eslint-disable-next-line import/default
import Vue from 'vue'
import VueResource from 'vue-resource'
import {
@ -21,7 +21,7 @@ import { assert } from 'chai'
Vue.use(VueResource)
describe('CallBlocking', function () {
var subscriberId = 123
const subscriberId = 123
beforeEach(function () {
Vue.http.interceptors = []
@ -63,7 +63,7 @@ describe('CallBlocking', function () {
})
it('should get all data regarding incoming call blocking', function (done) {
var list = [
const list = [
'0123456789',
'0987654321'
]
@ -86,8 +86,8 @@ describe('CallBlocking', function () {
})
it('should add a new number to incoming call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {
@ -113,8 +113,8 @@ describe('CallBlocking', function () {
})
it('should edit a number from incoming call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {
@ -140,8 +140,8 @@ describe('CallBlocking', function () {
})
it('should remove a number from incoming call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {
@ -203,7 +203,7 @@ describe('CallBlocking', function () {
})
it('should get all data regarding outgoing call blocking', function (done) {
var list = [
const list = [
'0123456789',
'0987654321'
]
@ -226,8 +226,8 @@ describe('CallBlocking', function () {
})
it('should add a new number to outgoing call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {
@ -253,8 +253,8 @@ describe('CallBlocking', function () {
})
it('should edit a number from outgoing call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {
@ -280,8 +280,8 @@ describe('CallBlocking', function () {
})
it('should remove a number from outgoing call blocking list', function (done) {
var number = '0987654321'
var list = [
const number = '0987654321'
const list = [
'0123456789'
]
Vue.http.interceptors.unshift((request, next) => {

@ -1,9 +1,8 @@
'use strict'
// eslint-disable-next-line import/default
import Vue from 'vue'
import VueResource from 'vue-resource'
import crypto from 'crypto-browserify'
import { getConversations } from '../../src/api/conversations'
import { assert } from 'chai'

@ -1,17 +1,14 @@
'use strict'
// eslint-disable-next-line import/default
import Vue from 'vue'
import VueResource from 'vue-resource'
import {
getFieldList
} from '../../src/api/common'
import {
getSpeedDialsById,
getUnassignedSlots
} from '../../src/api/speed-dial'
import { assert } from 'chai'
import { i18n } from '../../src/i18n'
import { i18n } from 'src/boot/i18n'
Vue.use(VueResource)

@ -1,6 +1,6 @@
'use strict'
// eslint-disable-next-line import/default
import Vue from 'vue'
import VueResource from 'vue-resource'
import { getPreferences } from '../../src/api/subscriber'

@ -1,12 +1,8 @@
'use strict'
// eslint-disable-next-line import/default
import Vue from 'vue'
import VueResource from 'vue-resource'
import {
get,
getList
} from '../../src/api/common'
import {
getVoiceboxSettings,
getVoiceboxGreetingByType

@ -1,11 +1,10 @@
import Vue from 'vue'
import Login from '../../src/components/Login.vue'
import { assert } from 'chai'
describe('Login', function () {
it('should initialize with default data', function () {
var defaultData = Login.data()
const defaultData = Login.data()
assert.equal(defaultData.username, '')
assert.equal(defaultData.password, '')
})

@ -6,20 +6,20 @@ import { assert } from 'chai'
describe('CallBlocking', function () {
describe('Incoming', function () {
it('should enable list', function () {
var state = {}
const state = {}
CallBlockingModule.mutations.toggleSucceeded(state, true)
assert.equal(state.enabled, true)
})
it('should disable list', function () {
var state = {}
const state = {}
CallBlockingModule.mutations.toggleSucceeded(state, false)
assert.equal(state.enabled, false)
})
it('should load list and flag', function () {
var state = {}
var list = [
const state = {}
const list = [
'0123456789',
'0987654321'
]
@ -34,20 +34,20 @@ describe('CallBlocking', function () {
describe('Outgoing', function () {
it('should enable list', function () {
var state = {}
const state = {}
CallBlockingModule.mutations.toggleSucceeded(state, true)
assert.equal(state.enabled, true)
})
it('should disable list', function () {
var state = {}
const state = {}
CallBlockingModule.mutations.toggleSucceeded(state, false)
assert.equal(state.enabled, false)
})
it('should load list and flag', function () {
var state = {}
var list = [
const state = {}
const list = [
'0123456789',
'0987654321'
]

@ -5,7 +5,7 @@ import { assert } from 'chai'
describe('UserModule', () => {
it('should login', () => {
var state = {}
const state = {}
UserModule.mutations.loginSucceeded(state, {
jwt: 'abc123',
subscriberId: 123

@ -2,8 +2,7 @@
'use strict'
import VoiceboxModule from '../../src/store/voicebox'
import localeEn from 'src/i18n/en.json'
import { i18n } from '../../src/i18n'
import { i18n } from 'boot/i18n'
import { assert } from 'chai'
describe('Voicebox', function () {

@ -3,7 +3,7 @@ import { createLocalVue, shallowMount } from 'test-utils'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import Quasar, { Cookies } from 'quasar'
import { Quasar, Cookies } from 'quasar'
const mockSsrContext = () => {
return {

Loading…
Cancel
Save