Commit 22d31584 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'upgrade-eslint-plugin-integration' into 'master'

[RUN-AS-IF-FOSS] Update dependency @gitlab/eslint-plugin to v9

See merge request gitlab-org/gitlab!64780
parents 1ed106d5 34fcf36d
...@@ -17,14 +17,6 @@ settings: ...@@ -17,14 +17,6 @@ settings:
webpack: webpack:
config: './config/webpack.config.js' config: './config/webpack.config.js'
rules: rules:
# BEGIN Disallow deprecated slot syntax
# TODO: Remove once
# https://gitlab.com/gitlab-org/frontend/eslint-plugin/-/issues/31 is closed
# and consumed by GitLab.
vue/no-deprecated-scope-attribute: error
vue/no-deprecated-slot-attribute: error
vue/no-deprecated-slot-scope-attribute: error
# END Disallow deprecated slot syntax
import/no-commonjs: error import/no-commonjs: error
import/no-default-export: off import/no-default-export: off
no-underscore-dangle: no-underscore-dangle:
......
...@@ -306,9 +306,11 @@ export default () => { ...@@ -306,9 +306,11 @@ export default () => {
// eslint-disable-next-line no-new, @gitlab/no-runtime-template-compiler // eslint-disable-next-line no-new, @gitlab/no-runtime-template-compiler
new Vue({ new Vue({
el: document.getElementById('js-add-list'), el: document.getElementById('js-add-list'),
data: { data() {
filters: boardsStore.state.filters, return {
...getMilestoneTitle($boardApp), filters: boardsStore.state.filters,
...getMilestoneTitle($boardApp),
};
}, },
mounted() { mounted() {
initNewListDropdown(); initNewListDropdown();
......
...@@ -17,6 +17,7 @@ export default { ...@@ -17,6 +17,7 @@ export default {
}; };
</script> </script>
<!-- eslint-disable-next-line vue/no-deprecated-functional-template -->
<template functional> <template functional>
<div class="gl-display-flex gl-flex-wrap gl-mb-2"> <div class="gl-display-flex gl-flex-wrap gl-mb-2">
<template v-if="props.renderGroup"> <template v-if="props.renderGroup">
......
...@@ -152,8 +152,7 @@ export default { ...@@ -152,8 +152,7 @@ export default {
</div> </div>
</div> </div>
<template v-for="(model, i) in sortedEnvironments" :model="model"> <template v-for="(model, i) in sortedEnvironments" :model="model">
<div <environment-item
is="environment-item"
:key="`environment-item-${i}`" :key="`environment-item-${i}`"
:model="model" :model="model"
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
...@@ -189,8 +188,7 @@ export default { ...@@ -189,8 +188,7 @@ export default {
<template v-else> <template v-else>
<template v-for="(child, index) in model.children"> <template v-for="(child, index) in model.children">
<div <environment-item
is="environment-item"
:key="`environment-row-${i}-${index}`" :key="`environment-row-${i}-${index}`"
:model="child" :model="child"
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
......
...@@ -29,9 +29,6 @@ export default { ...@@ -29,9 +29,6 @@ export default {
LogAdvancedFilters, LogAdvancedFilters,
LogControlButtons, LogControlButtons,
}, },
filters: {
formatDate,
},
props: { props: {
environmentName: { environmentName: {
type: String, type: String,
...@@ -114,6 +111,7 @@ export default { ...@@ -114,6 +111,7 @@ export default {
const { scrollTop = 0, clientHeight = 0, scrollHeight = 0 } = target; const { scrollTop = 0, clientHeight = 0, scrollHeight = 0 } = target;
this.scrollDownButtonDisabled = scrollTop + clientHeight === scrollHeight; this.scrollDownButtonDisabled = scrollTop + clientHeight === scrollHeight;
}, 200), }, 200),
formatDate,
}, },
}; };
</script> </script>
...@@ -229,8 +227,8 @@ export default { ...@@ -229,8 +227,8 @@ export default {
<div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900"> <div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900">
<gl-sprintf :message="s__('Environments|Logs from %{start} to %{end}.')"> <gl-sprintf :message="s__('Environments|Logs from %{start} to %{end}.')">
<template #start>{{ timeRange.current.start | formatDate }}</template> <template #start>{{ formatDate(timeRange.current.start) }}</template>
<template #end>{{ timeRange.current.end | formatDate }}</template> <template #end>{{ formatDate(timeRange.current.end) }}</template>
</gl-sprintf> </gl-sprintf>
<gl-sprintf <gl-sprintf
v-if="!logs.isComplete" v-if="!logs.isComplete"
......
...@@ -13,9 +13,11 @@ import deleteProjectModal from './components/delete_project_modal.vue'; ...@@ -13,9 +13,11 @@ import deleteProjectModal from './components/delete_project_modal.vue';
const deleteModal = new Vue({ const deleteModal = new Vue({
el: deleteProjectModalEl, el: deleteProjectModalEl,
data: { data() {
deleteProjectUrl: '', return {
projectName: '', deleteProjectUrl: '',
projectName: '',
};
}, },
mounted() { mounted() {
const deleteProjectButtons = document.querySelectorAll('.delete-project-button'); const deleteProjectButtons = document.querySelectorAll('.delete-project-button');
......
...@@ -27,8 +27,10 @@ const createModalVueApp = () => { ...@@ -27,8 +27,10 @@ const createModalVueApp = () => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Vue({ new Vue({
el: deleteWikiModalWrapperEl, el: deleteWikiModalWrapperEl,
data: { data() {
deleteWikiUrl: '', return {
deleteWikiUrl: '',
};
}, },
render(createElement) { render(createElement) {
return createElement(deleteWikiModal, { return createElement(deleteWikiModal, {
......
...@@ -27,9 +27,7 @@ export default { ...@@ -27,9 +27,7 @@ export default {
title: { title: {
type: String, type: String,
required: false, required: false,
default() { default: null,
return this.metric;
},
}, },
header: { header: {
type: String, type: String,
...@@ -101,6 +99,9 @@ export default { ...@@ -101,6 +99,9 @@ export default {
return ''; return '';
}, },
actualTitle() {
return this.title ?? this.metric;
},
}, },
methods: { methods: {
toggleBacktrace(toggledIndex) { toggleBacktrace(toggledIndex) {
...@@ -214,7 +215,7 @@ export default { ...@@ -214,7 +215,7 @@ export default {
<div></div> <div></div>
</template> </template>
</gl-modal> </gl-modal>
{{ title }} {{ actualTitle }}
<request-warning :html-id="htmlId" :warnings="warnings" /> <request-warning :html-id="htmlId" :warnings="warnings" />
</div> </div>
</template> </template>
<!-- eslint-disable-next-line vue/no-deprecated-functional-template -->
<template functional> <template functional>
<footer class="form-actions d-flex justify-content-between"> <footer class="form-actions d-flex justify-content-between">
<div><slot name="prepend"></slot></div> <div><slot name="prepend"></slot></div>
......
...@@ -8,7 +8,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -8,7 +8,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Preparations for a Vue 3 migration are tracked in epic [&3174](https://gitlab.com/groups/gitlab-org/-/epics/3174) Preparations for a Vue 3 migration are tracked in epic [&3174](https://gitlab.com/groups/gitlab-org/-/epics/3174)
In order to prepare for the eventual migration to Vue 3.x, we should be wary about adding the following features to the codebase: In order to prepare for the eventual migration to Vue 3.x, we should not use the following deprecated features in the codebase:
NOTE:
Our linting rules block the use of these deprecated features.
## Vue filters ## Vue filters
...@@ -132,3 +135,47 @@ shallowMount(MyAwesomeComponent, { ...@@ -132,3 +135,47 @@ shallowMount(MyAwesomeComponent, {
} }
}) })
``` ```
## Props default function `this` access
**Why?**
In Vue 3, props default value factory functions no longer have access to `this`
(the component instance).
**What to use instead**
Write a computed prop that resolves the desired value from other props. This
will work in both Vue 2 and 3.
```html
<script>
export default {
props: {
metric: {
type: String,
required: true,
},
title: {
type: String,
required: false,
default: null,
},
},
computed: {
actualTitle() {
return this.title ?? this.metric;
},
},
}
</script>
<template>
<div>{{ actualTitle }}</div>
</template>
```
[In Vue 3](https://v3.vuejs.org/guide/migration/props-default-this.html#props-default-function-this-access),
the props default value factory is passed the raw props as an argument, and can
also access injections.
...@@ -37,8 +37,8 @@ export default { ...@@ -37,8 +37,8 @@ export default {
</script> </script>
<template> <template>
<span :is="tag" v-if="showBlockingIssuesCount" v-gl-tooltip :title="__('Blocking issues')"> <component :is="tag" v-if="showBlockingIssuesCount" v-gl-tooltip :title="__('Blocking issues')">
<gl-icon name="issue-block" /> <gl-icon name="issue-block" />
{{ blockingIssuesCount }} {{ blockingIssuesCount }}
</span> </component>
</template> </template>
...@@ -10,6 +10,7 @@ export default { ...@@ -10,6 +10,7 @@ export default {
}; };
</script> </script>
<!-- eslint-disable-next-line vue/no-deprecated-functional-template -->
<template functional> <template functional>
<div class="d-sm-flex my-sm-2 my-4"> <div class="d-sm-flex my-sm-2 my-4">
<label class="col-sm-2 text-sm-right gl-font-weight-bold gl-pl-0">{{ props.label }}:</label> <label class="col-sm-2 text-sm-right gl-font-weight-bold gl-pl-0">{{ props.label }}:</label>
......
...@@ -109,9 +109,11 @@ describe('ImageDiffViewer', () => { ...@@ -109,9 +109,11 @@ describe('ImageDiffViewer', () => {
components: { components: {
imageDiffViewer, imageDiffViewer,
}, },
data: { data() {
...allProps, return {
diffMode: 'renamed', ...allProps,
diffMode: 'renamed',
};
}, },
...compileToFunctions(` ...compileToFunctions(`
<image-diff-viewer <image-diff-viewer
......
...@@ -867,10 +867,10 @@ ...@@ -867,10 +867,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/at.js/-/at.js-1.5.7.tgz#1ee6f838cc4410a1d797770934df91d90df8179e" resolved "https://registry.yarnpkg.com/@gitlab/at.js/-/at.js-1.5.7.tgz#1ee6f838cc4410a1d797770934df91d90df8179e"
integrity sha512-c6ySRK/Ma7lxwpIVbSAF3P+xiTLrNTGTLRx4/pHK111AdFxwgUwrYF6aVZFXvmG65jHOJHoa0eQQ21RW6rm0Rg== integrity sha512-c6ySRK/Ma7lxwpIVbSAF3P+xiTLrNTGTLRx4/pHK111AdFxwgUwrYF6aVZFXvmG65jHOJHoa0eQQ21RW6rm0Rg==
"@gitlab/eslint-plugin@8.4.0": "@gitlab/eslint-plugin@9.0.0":
version "8.4.0" version "9.0.0"
resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin/-/eslint-plugin-8.4.0.tgz#094fa4d41676a71146f82e1b19257a7ceabefd88" resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin/-/eslint-plugin-9.0.0.tgz#0c872428e3237e0dbd2cbbe74317fc3786cefdf9"
integrity sha512-VE/c1yIMrj2igJWAALQtAKpnXL8fN5wJ1uKteZfi8xYbWouoUK6hizXSPrrEUWiM2FqcBI4Igcpz2JlJzDlAnA== integrity sha512-TaKLzaAFQbsJJIbetLTARkJNapIWuis8RyOp/arbVS5Fl8IjBK8m3hPmqIc5CwOz9qK8o5eSW1MA9clU/dLY3w==
dependencies: dependencies:
babel-eslint "^10.0.3" babel-eslint "^10.0.3"
eslint-config-airbnb-base "^14.2.1" eslint-config-airbnb-base "^14.2.1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment