Skip to content

Commit

Permalink
ESLint formidable new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
davellanedam committed Mar 26, 2019
1 parent 5e707ae commit 4fa3372
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 9 deletions.
90 changes: 88 additions & 2 deletions .eslintrc.js
Expand Up @@ -3,10 +3,96 @@ module.exports = {
env: {
node: true
},
extends: ['plugin:vue/essential', '@vue/prettier'],
extends: [
'formidable/rules/eslint/best-practices/on',
'formidable/rules/eslint/es6/on',
'formidable/rules/eslint/errors/off',
'formidable/rules/eslint/strict/on',
'formidable/rules/eslint/node/off',
'formidable/rules/eslint/style/on',
'formidable/rules/eslint/variables/on',
'plugin:vue/essential',
'@vue/prettier'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'callback-return': [
'error',
['done', 'proceed', 'next', 'onwards', 'callback', 'cb']
],
camelcase: [
'warn',
{
properties: 'always'
}
],
'comma-style': ['warn', 'last'],
curly: ['error'],
eqeqeq: ['error', 'always'],
'eol-last': ['warn'],
'no-undef': 2,
'handle-callback-err': ['error'],
'arrow-body-style': ['off', 2],
indent: ['off', 2],
'linebreak-style': ['error', 'unix'],
'no-dupe-keys': ['error'],
'no-duplicate-case': ['error'],
'no-extra-semi': ['warn'],
'no-labels': ['error'],
'no-mixed-spaces-and-tabs': [2, 'smart-tabs'],
'no-redeclare': ['warn'],
'no-return-assign': ['error', 'always'],
'no-sequences': ['error'],
'no-trailing-spaces': ['warn'],
'no-unexpected-multiline': ['warn'],
'no-unreachable': ['warn'],
'no-magic-numbers': ['off'],
'max-params': ['off'],
'max-len': ['off'],
'max-nested-callbacks': ['off'],
'new-cap': ['off'],
'consistent-this': ['error', 'that'],
'no-unused-vars': [
'warn',
{
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^unused($|[A-Z].*$)'
}
],
'no-use-before-define': [
'error',
{
functions: false
}
],
'no-var': 2,
'one-var': ['warn', 'never'],
'prefer-arrow-callback': [
'warn',
{
allowNamedFunctions: true
}
],
quotes: [
'warn',
'single',
{
avoidEscape: false,
allowTemplateLiterals: true
}
],
semi: ['error', 'never'],
'semi-spacing': [
'warn',
{
before: false,
after: true
}
],
'semi-style': ['warn', 'last'],
'space-before-function-paren': ['off', 2],
'prettier/prettier': 'error'
},
parserOptions: {
parser: 'babel-eslint'
Expand Down
4 changes: 4 additions & 0 deletions src/components/AdminCities.vue
Expand Up @@ -219,6 +219,7 @@ export default {
buildPayloadPagination(this.pagination, this.buildSearch())
)
this.dataTableLoading = false
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand All @@ -245,6 +246,7 @@ export default {
buildPayloadPagination(this.pagination, this.buildSearch())
)
this.dataTableLoading = false
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand Down Expand Up @@ -278,6 +280,7 @@ export default {
)
this.dataTableLoading = false
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand Down Expand Up @@ -310,6 +313,7 @@ export default {
}
this.close()
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
this.close()
Expand Down
5 changes: 5 additions & 0 deletions src/components/AdminUsers.vue
Expand Up @@ -388,6 +388,7 @@ export default {
buildPayloadPagination(this.pagination, this.buildSearch())
)
this.dataTableLoading = false
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand Down Expand Up @@ -428,6 +429,7 @@ export default {
buildPayloadPagination(this.pagination, this.buildSearch())
)
this.dataTableLoading = false
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand Down Expand Up @@ -461,6 +463,7 @@ export default {
)
this.dataTableLoading = false
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
}
Expand Down Expand Up @@ -502,6 +505,7 @@ export default {
this.close()
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.dataTableLoading = false
this.close()
Expand All @@ -512,6 +516,7 @@ export default {
async created() {
try {
await this.getAllCities()
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ForgotPassword.vue
Expand Up @@ -80,6 +80,7 @@ export default {
})
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Login.vue
Expand Up @@ -94,6 +94,7 @@ export default {
})
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Profile.vue
Expand Up @@ -352,6 +352,7 @@ export default {
})
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand All @@ -375,6 +376,7 @@ export default {
this.close()
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
this.oldPassword = ''
this.newPassword = ''
Expand All @@ -389,6 +391,7 @@ export default {
try {
await this.getProfile()
await this.getAllCities()
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ResetPassword.vue
Expand Up @@ -91,6 +91,7 @@ export default {
})
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/components/SignUp.vue
Expand Up @@ -115,6 +115,7 @@ export default {
})
return
}
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Verify.vue
Expand Up @@ -32,6 +32,7 @@ export default {
async created() {
try {
await this.sendVerify(this.$route.params.id)
// eslint-disable-next-line no-unused-vars
} catch (error) {
return
}
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/axios.js
Expand Up @@ -8,7 +8,7 @@ axios.defaults.headers.common['Accept-Language'] =
JSON.parse(localStorage.getItem('locale')) || 'en'

axios.interceptors.request.use(
function(config) {
config => {
// Do something before request is sent
// If request is different than login, then send Authorization header with token from localstorage
if (config.url !== '/login') {
Expand All @@ -17,19 +17,19 @@ axios.interceptors.request.use(
}
return config
},
function(error) {
error => {
// Do something with request error
return Promise.reject(error)
}
)

// Add a response interceptor
axios.interceptors.response.use(
function(response) {
response => {
// Do something with response data
return response
},
function(error) {
error => {
// Do something with response error
return Promise.reject(error)
}
Expand Down
5 changes: 4 additions & 1 deletion src/router/routes/index.js
Expand Up @@ -2,7 +2,10 @@ const requireRoute = require.context('.', false, /\.js$/) // Get js files inside
let routes = []

requireRoute.keys().forEach(fileName => {
if (fileName === './index.js') return // Avoid the index.js file
// Avoid the index.js file
if (fileName === './index.js') {
return
}
let route = requireRoute(fileName).default
routes.push(...route)
})
Expand Down
5 changes: 4 additions & 1 deletion src/store/modules/index.js
Expand Up @@ -3,7 +3,10 @@ const requireModule = require.context('.', false, /\.js$/) // Get js files insid
const modules = {}

requireModule.keys().forEach(fileName => {
if (fileName === './index.js') return // Avoid the index.js file
// Avoid the index.js file
if (fileName === './index.js') {
return
}
const moduleName = camelCase(fileName.replace(/(\.\/|\.js)/g, ''))
modules[moduleName] = requireModule(fileName).default
})
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/05.forgotAndReset.js
Expand Up @@ -70,7 +70,7 @@ describe('Forgot Password / Reset Password', () => {
cy.wait('@forgot')

//Assert on XHR
cy.get('@forgot').then(function(xhr) {
cy.get('@forgot').then(xhr => {
expect(xhr.status).to.eq(200)
expect(xhr.responseBody).to.have.property('verification')
verification = xhr.responseBody.verification
Expand Down

0 comments on commit 4fa3372

Please sign in to comment.