Skip to content

Commit

Permalink
chore: update code quality tools (vuetifyjs#12452)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD authored Oct 20, 2020
1 parent dda34c6 commit 34a37a0
Show file tree
Hide file tree
Showing 160 changed files with 2,696 additions and 1,986 deletions.
107 changes: 64 additions & 43 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,45 @@ module.exports = {
root: true,
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2017,
sourceType: 'module'
ecmaVersion: 2020,
sourceType: 'module',
},
extends: [
'standard',
'plugin:vue/recommended'
'plugin:vue/recommended',
'plugin:sonarjs/recommended',
],
env: {
node: true,
browser: true,
es6: true
es6: true,
},
plugins: [
'@typescript-eslint',
'vuetify'
'sonarjs',
'vuetify',
],
rules: {
// allow paren-less arrow functions
'arrow-parens': ['error', 'as-needed'],
// set maximum line characters
'max-len': ['error', 140, 4, {
'ignoreUrls': true,
'ignoreTemplateLiterals': true,
'ignoreStrings': true
ignoreUrls: true,
ignoreTemplateLiterals: true,
ignoreStrings: true,
}],
'max-statements': ['error', 24],
quotes: ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],
'no-console': 'off',
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'only-multiline'
functions: 'only-multiline',
}],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand All @@ -48,87 +54,102 @@ module.exports = {
{
anonymous: 'always',
named: 'always',
asyncArrow: 'always'
}
asyncArrow: 'always',
},
],
'no-return-await': 'warn',
'object-shorthand': ['error', 'always'],
'no-extra-semi': 'error',
'prefer-const': ['error', {
'destructuring': 'all',
'ignoreReadBeforeAssign': true
destructuring: 'all',
ignoreReadBeforeAssign: true,
}],
'no-prototype-builtins': 'off',
'no-void': 'off',
'no-case-declarations': 'off',

// TODO: remove when eslint >=7.5
// https://github.com/eslint/eslint/issues/13637
'no-unused-expressions': 'off',
'sonarjs/cognitive-complexity': 'off',
'sonarjs/no-duplicate-string': 'off',

// Not in override, these apply to non-.vue files too
'vue/name-property-casing': 'off',
'vue/require-default-prop': 'off',
'vue/require-prop-types': 'off',
'vue/prop-name-casing': 'error',
'vue/return-in-computed-property': 'off'
'vue/one-component-per-file': 'off',
'vue/custom-event-name-casing': ['error', { ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] }],
},
overrides: [
{
files: '**/*.vue',
rules: {
indent: 'off',
'vue/script-indent': ['error', 2, {
'baseIndent': 1,
'switchCase': 1,
'ignores': []
baseIndent: 1,
switchCase: 1,
ignores: [],
}],
'vue/html-closing-bracket-newline': ['error', {
'singleline': 'never',
'multiline': 'always'
singleline: 'never',
multiline: 'always',
}],
'vue/html-closing-bracket-spacing': 'error',
'vue/max-attributes-per-line': ['error', {
'singleline': 5,
'multiline': {
'max': 1,
'allowFirstLine': false
}
singleline: 5,
multiline: {
max: 1,
allowFirstLine: false,
},
}],
'vue/valid-v-on': 'off', // This rule doesn't allow empty event listeners
'vue/no-v-html': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/valid-v-slot': ['error', { allowModifiers: true }],

// 'vuetify/grid-unknown-attributes': 'error',
// 'vuetify/no-legacy-grid': 'error',
'vuetify/no-deprecated-classes': 'error'
}
'vuetify/no-deprecated-classes': 'error',
},
},
{
files: '**/*.ts',
rules: {
// Can't overload function exports with this enabled
'import/export': 'off',

// https://github.com/eslint/typescript-eslint-parser/issues/445
// https://github.com/eslint/typescript-eslint-parser/issues/457
// enabled in tslint instead
// False positives on types
'no-undef': 'off',

quotes: 'off',
'@typescript-eslint/quotes': ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],

'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',

'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],

// Enabled in tsconfig
'no-unused-vars': 'off',
// '@typescript-eslint/no-unused-vars': 'error',

'no-redeclare': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: {
delimiter: 'none'
delimiter: 'none',
},
singleline: {
delimiter: 'comma'
}
delimiter: 'comma',
},
}],
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/type-annotation-spacing': 'error'
}
}
]
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/no-invalid-this': 'error',
},
},
],
}
9 changes: 1 addition & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
transform: {
'\\.(styl)$': 'jest-css-modules',
'\\.(sass|scss)$': 'jest-css-modules',
'.*\\.(j|t)s$': 'ts-jest',
'.*\\.(j|t)s$': 'babel-jest',
},
collectCoverageFrom: [
'src/**/*.{js,ts,tsx}',
Expand All @@ -41,11 +41,4 @@ module.exports = {
'**/__tests__/**/*.spec.js',
'**/__tests__/**/*.spec.ts',
],
globals: {
'ts-jest': {
babelConfig: true,
tsConfig: '<rootDir>/tsconfig.test.json',
diagnostics: false,
},
},
}
35 changes: 17 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,33 @@
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/preset-env": "^7.5.5",
"@babel/preset-typescript": "^7.12.1",
"@mdi/js": "^5.2.45",
"@octokit/core": "^3.1.2",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"babel-eslint": "^8.2.6",
"babel-jest": "^24.8.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.0",
"cross-env": "^7.0.2",
"cross-spawn": "^6.0.5",
"css-loader": "^3.1.0",
"eslint": "^6.6.0",
"eslint-config-standard": "^13.0.1",
"eslint-loader": "^2.2.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-local-rules": "^0.1.0",
"eslint-plugin-node": "^9.1.0",
"eslint": "^7.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-local-rules": "^0.1.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.2.2",
"eslint-plugin-vue": "^7.1.0",
"eslint-plugin-vuetify": "^1.0.0-beta.6",
"husky": "^3.0.1",
"inquirer": "^6.5.0",
"jest": "^24.8.0",
"jest-cli": "^24.8.0",
"jest": "^26.6.0",
"jest-cli": "^26.6.0",
"jest-css-modules": "^2.1.0",
"jest-environment-jsdom-fourteen": "^0.1.0",
"jest-environment-jsdom-fourteen": "^1.0.1",
"jest-serializer-html": "^7.0.0",
"lerna": "^3.16.2",
"moment": "^2.27.0",
Expand All @@ -66,10 +68,7 @@
"shelljs": "^0.8.4",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"ts-jest": "^24.1.0",
"tslint": "^5.20.1",
"typescript": "^3.9.7",
"typestrict": "^1.0.2",
"typescript": "^4.0.3",
"vue": "^2.6.11",
"vue-analytics": "^5.16.1",
"vue-loader": "^15.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-generator/src/maps/v-data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { DataFooterPageTextScopedProps } = require('./v-data-footer')
const DataTableHeader = {
text: 'string',
value: 'string',
'align?': '\'start\' | \'center\' | \'end\'',
'align?': `'start' | 'center' | 'end'`,
'sortable?': 'boolean',
'filterable?': 'boolean',
'groupable?': 'boolean',
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ module.exports = {
svg: 'always',
math: 'always',
}],
'vue/v-slot-style': ['warn', {
default: 'longform',
named: 'longform',
}],
'vuetify/no-deprecated-classes': 'error',
'vuetify/grid-unknown-attributes': 'error',
'vuetify/no-legacy-grid': 'error',
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/components/Contribute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class="mb-2 mb-md-0"
path="contribute.edit-page"
>
<template v-slot:url>
<template #url>
<app-link :href="href">GitHub</app-link>
</template>
</i18n>
Expand Down
9 changes: 4 additions & 5 deletions packages/docs/src/components/ad/Sponsored.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
v-bind="$attrs"
>
<v-hover>
<template v-slot="{ hover }">
<template #default="{ hover }">
<a v-bind="adAttrs">
<v-sheet
class="overflow-none position-relative d-flex px-4 py-2 align-center"
Expand Down Expand Up @@ -55,10 +55,9 @@
computed: {
icon () {
switch (this.current.metadata.type) {
case 'Video': return '$mdiPlayCircle'
default: return '$mdiVuetify'
}
return this.current.metadata.type === 'Video'
? '$mdiPlayCircle'
: '$mdiVuetify'
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/components/api/ApiSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-bind="$attrs"
v-on="$listeners"
>
<template v-slot:selection="{ item, selected }">
<template #selection="{ item, selected }">
<v-chip
:value="selected"
class="white--text"
Expand All @@ -23,7 +23,7 @@
</v-chip>
</template>

<template v-slot:item="{ attrs, item }">
<template #item="{ attrs, item }">
<v-list-item-action>
<v-icon v-text="item.icon" />
</v-list-item-action>
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/src/components/doc/IconList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:open-on-click="filteredIcons.length > 0"
offset-y
>
<template v-slot:activator="{ on, attrs }">
<template #activator="{ on, attrs }">
<v-text-field
v-model="search"
hide-details
Expand All @@ -17,7 +17,7 @@
@click:clear="reset"
v-on="on"
>
<template v-slot:prepend-inner>
<template #prepend-inner>
<v-icon
v-if="copied"
color="primary"
Expand All @@ -27,7 +27,7 @@
<code class="mx-1 py-1">mdi-</code>
</template>

<template v-slot:append>
<template #append>
<span
v-if="copied"
class="text--primary pt-1"
Expand All @@ -44,7 +44,7 @@
:item-height="56"
:height="Math.min(filteredIcons.length * 56, 336)"
>
<template v-slot="{ item }">
<template #default="{ item }">
<v-list-item
:key="item"
@click.stop="copy(item)"
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/components/examples/Example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
:key="`item-${i}`"
:value="section"
>
<template v-slot="{ active, toggle }">
<template #default="{ active, toggle }">
<v-btn
:input-value="active"
class="mr-2"
Expand Down
Loading

0 comments on commit 34a37a0

Please sign in to comment.