Add eslint rules for Vue 3
What does this MR do and why?
Add eslint rules for Vue 3
- restrict set api in vue files and tests
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Vue files | Vue specs |
|---|---|
![]() |
![]() |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Apply the below patch
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
index 20905a57b86a..256b49cd8446 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
@@ -269,6 +269,14 @@ export default {
this.$emit('update-policy-source', source);
},
tooltipContent(enabled) {
+ this.$delete();
+ vm.$delete();
+ Vue.delete();
+
+ this.$set();
+ vm.$set();
+ Vue.set();
+
return enabled ? this.$options.i18n.statusEnabled : this.$options.i18n.statusDisabled;
},
},
diff --git a/ee/spec/frontend/security_orchestration/components/policies/list_component_spec.js b/ee/spec/frontend/security_orchestration/components/policies/list_component_spec.js
index 39af469fecb4..c883d0d53556 100644
--- a/ee/spec/frontend/security_orchestration/components/policies/list_component_spec.js
+++ b/ee/spec/frontend/security_orchestration/components/policies/list_component_spec.js
@@ -492,6 +492,16 @@ describe('List component', () => {
});
it('emits when the source filter is changed', () => {
+ this.$delete();
+ wrapper.vm.$delete();
+ Vue.delete();
+ unwrappedVm.$delete();
+
+ this.$set();
+ wrapper.vm.$set();
+ Vue.set();
+ unwrappedVm.$set();
+
expect(wrapper.emitted('update-policy-source')).toEqual([
[POLICY_SOURCE_OPTIONS.INHERITED.value],
]);
- Run
node scripts/frontend/eslint.js ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue ee/spec/frontend/security_orchestration/components/policies/list_component_spec.js - Verify the errors

