Commit 9e5f8dc8 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'ps-enable-eslint-no-global-event-off' into 'master'

Add no-global-event-off error to eslint conifg

See merge request gitlab-org/gitlab!49438
parents 80275713 79ed530a
...@@ -42,6 +42,7 @@ rules: ...@@ -42,6 +42,7 @@ rules:
no-jquery/no-serialize: error no-jquery/no-serialize: error
promise/always-return: off promise/always-return: off
promise/no-callback-in-promise: off promise/no-callback-in-promise: off
"@gitlab/no-global-event-off": error
overrides: overrides:
- files: - files:
- '**/spec/**/*' - '**/spec/**/*'
......
...@@ -74,6 +74,7 @@ export default class Autosave { ...@@ -74,6 +74,7 @@ export default class Autosave {
} }
dispose() { dispose() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.field.off('input'); this.field.off('input');
} }
} }
...@@ -596,6 +596,7 @@ export class AwardsHandler { ...@@ -596,6 +596,7 @@ export class AwardsHandler {
hideMenuElement($emojiMenu) { hideMenuElement($emojiMenu) {
$emojiMenu.on(transitionEndEventString, e => { $emojiMenu.on(transitionEndEventString, e => {
if (e.currentTarget === e.target) { if (e.currentTarget === e.target) {
// eslint-disable-next-line @gitlab/no-global-event-off
$emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString); $emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString);
} }
}); });
......
...@@ -97,6 +97,7 @@ export default class Shortcuts { ...@@ -97,6 +97,7 @@ export default class Shortcuts {
e.preventDefault(); e.preventDefault();
}); });
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-shortcuts-modal-trigger') $('.js-shortcuts-modal-trigger')
.off('click') .off('click')
.on('click', this.onToggleHelp); .on('click', this.onToggleHelp);
......
...@@ -15,6 +15,7 @@ function shouldCreateListGraphQL(label) { ...@@ -15,6 +15,7 @@ function shouldCreateListGraphQL(label) {
return store.getters.shouldUseGraphQL && !store.getters.getListByLabelId(fullLabelId(label)); return store.getters.shouldUseGraphQL && !store.getters.getListByLabelId(fullLabelId(label));
} }
// eslint-disable-next-line @gitlab/no-global-event-off
$(document) $(document)
.off('created.label') .off('created.label')
.on('created.label', (e, label, addNewList) => { .on('created.label', (e, label, addNewList) => {
......
...@@ -265,13 +265,21 @@ export default class Clusters { ...@@ -265,13 +265,21 @@ export default class Clusters {
removeListeners() { removeListeners() {
eventHub.$off('installApplication', this.installApplication); eventHub.$off('installApplication', this.installApplication);
eventHub.$off('updateApplication', this.updateApplication); eventHub.$off('updateApplication', this.updateApplication);
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('saveKnativeDomain'); eventHub.$off('saveKnativeDomain');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('setKnativeDomain'); eventHub.$off('setKnativeDomain');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('setCrossplaneProviderStack'); eventHub.$off('setCrossplaneProviderStack');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('uninstallApplication'); eventHub.$off('uninstallApplication');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('setIngressModSecurityEnabled'); eventHub.$off('setIngressModSecurityEnabled');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('setIngressModSecurityMode'); eventHub.$off('setIngressModSecurityMode');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('resetIngressModSecurityChanges'); eventHub.$off('resetIngressModSecurityChanges');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('setFluentdSettings'); eventHub.$off('setFluentdSettings');
} }
......
...@@ -72,12 +72,14 @@ export default class ImageFile { ...@@ -72,12 +72,14 @@ export default class ImageFile {
callback(e, left); callback(e, left);
}; };
// eslint-disable-next-line @gitlab/no-global-event-off
$el $el
.off('mousedown') .off('mousedown')
.off('touchstart') .off('touchstart')
.on('mousedown', dragStart) .on('mousedown', dragStart)
.on('touchstart', dragStart); .on('touchstart', dragStart);
// eslint-disable-next-line @gitlab/no-global-event-off
$body $body
.off('mouseup') .off('mouseup')
.off('mousemove') .off('mousemove')
......
...@@ -14,6 +14,7 @@ function openConfirmDangerModal($form, $modal, text) { ...@@ -14,6 +14,7 @@ function openConfirmDangerModal($form, $modal, text) {
$submit.disable(); $submit.disable();
$input.focus(); $input.focus();
// eslint-disable-next-line @gitlab/no-global-event-off
$input.off('input').on('input', function handleInput() { $input.off('input').on('input', function handleInput() {
const confirmText = rstrip($(this).val()); const confirmText = rstrip($(this).val());
if (confirmText === confirmTextMatch) { if (confirmText === confirmTextMatch) {
...@@ -23,6 +24,7 @@ function openConfirmDangerModal($form, $modal, text) { ...@@ -23,6 +24,7 @@ function openConfirmDangerModal($form, $modal, text) {
} }
}); });
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-confirm-danger-submit', $modal) $('.js-confirm-danger-submit', $modal)
.off('click') .off('click')
.on('click', () => { .on('click', () => {
......
...@@ -154,6 +154,7 @@ export default { ...@@ -154,6 +154,7 @@ export default {
}); });
}, },
beforeDestroy() { beforeDestroy() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown).off(); $(this.$refs.dropdown).off();
}, },
methods: { methods: {
......
...@@ -29,11 +29,17 @@ export default class CreateLabelDropdown { ...@@ -29,11 +29,17 @@ export default class CreateLabelDropdown {
} }
cleanBinding() { cleanBinding() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.$colorSuggestions.off('click'); this.$colorSuggestions.off('click');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$newLabelField.off('keyup change'); this.$newLabelField.off('keyup change');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$newColorField.off('keyup change'); this.$newColorField.off('keyup change');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$dropdownBack.off('click'); this.$dropdownBack.off('click');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$cancelButton.off('click'); this.$cancelButton.off('click');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$newLabelCreateButton.off('click'); this.$newLabelCreateButton.off('click');
} }
......
...@@ -74,6 +74,7 @@ export default () => { ...@@ -74,6 +74,7 @@ export default () => {
const $dropdown = $('.js-ca-dropdown'); const $dropdown = $('.js-ca-dropdown');
const $label = $dropdown.find('.dropdown-label'); const $label = $dropdown.find('.dropdown-label');
// eslint-disable-next-line @gitlab/no-global-event-off
$dropdown $dropdown
.find('li a') .find('li a')
.off('click') .off('click')
......
...@@ -622,6 +622,7 @@ export class GitLabDropdown { ...@@ -622,6 +622,7 @@ export class GitLabDropdown {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
removeArrowKeyEvent() { removeArrowKeyEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off
return $('body').off('keydown'); return $('body').off('keydown');
} }
......
...@@ -93,7 +93,9 @@ export default { ...@@ -93,7 +93,9 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('toggleFolder'); eventHub.$off('toggleFolder');
// eslint-disable-next-line @gitlab/no-global-event-off
eventHub.$off('toggleDeployBoard'); eventHub.$off('toggleDeployBoard');
}, },
......
...@@ -78,6 +78,7 @@ class GfmAutoComplete { ...@@ -78,6 +78,7 @@ class GfmAutoComplete {
this.input.each((i, input) => { this.input.each((i, input) => {
const $input = $(input); const $input = $(input);
if (!$input.hasClass('js-gfm-input-initialized')) { if (!$input.hasClass('js-gfm-input-initialized')) {
// eslint-disable-next-line @gitlab/no-global-event-off
$input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input)); $input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input));
$input.on('change.atwho', () => input.dispatchEvent(new Event('input'))); $input.on('change.atwho', () => input.dispatchEvent(new Event('input')));
// This triggers at.js again // This triggers at.js again
......
...@@ -80,6 +80,7 @@ export default class GlFieldError { ...@@ -80,6 +80,7 @@ export default class GlFieldError {
// hidden when injected into DOM // hidden when injected into DOM
errorAnchor.after(this.fieldErrorElement); errorAnchor.after(this.fieldErrorElement);
// eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('invalid').on('invalid', this.handleInvalidSubmit.bind(this)); this.inputElement.off('invalid').on('invalid', this.handleInvalidSubmit.bind(this));
this.scopedSiblings = this.safelySelectSiblings(); this.scopedSiblings = this.safelySelectSiblings();
} }
...@@ -117,6 +118,7 @@ export default class GlFieldError { ...@@ -117,6 +118,7 @@ export default class GlFieldError {
this.form.focusInvalid.apply(this.form); this.form.focusInvalid.apply(this.form);
// For UX, wait til after first invalid submission to check each keyup // For UX, wait til after first invalid submission to check each keyup
// eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement this.inputElement
.off('keyup.fieldValidator') .off('keyup.fieldValidator')
.on('keyup.fieldValidator', this.updateValidity.bind(this)); .on('keyup.fieldValidator', this.updateValidity.bind(this));
......
...@@ -70,8 +70,10 @@ export default class GLForm { ...@@ -70,8 +70,10 @@ export default class GLForm {
} }
setupAutosize() { setupAutosize() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.textarea.off('autosize:resized').on('autosize:resized', this.setHeightData.bind(this)); this.textarea.off('autosize:resized').on('autosize:resized', this.setHeightData.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off
this.textarea.off('mouseup.autosize').on('mouseup.autosize', this.destroyAutosize.bind(this)); this.textarea.off('mouseup.autosize').on('mouseup.autosize', this.destroyAutosize.bind(this));
setTimeout(() => { setTimeout(() => {
...@@ -97,7 +99,9 @@ export default class GLForm { ...@@ -97,7 +99,9 @@ export default class GLForm {
} }
clearEventListeners() { clearEventListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.textarea.off('focus'); this.textarea.off('focus');
// eslint-disable-next-line @gitlab/no-global-event-off
this.textarea.off('blur'); this.textarea.off('blur');
removeMarkdownListeners(this.form); removeMarkdownListeners(this.form);
} }
......
...@@ -30,6 +30,7 @@ export default { ...@@ -30,6 +30,7 @@ export default {
.on('hide.bs.dropdown', () => this.hideDropdown()); .on('hide.bs.dropdown', () => this.hideDropdown());
}, },
removeDropdownListeners() { removeDropdownListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown) $(this.$refs.dropdown)
.off('show.bs.dropdown') .off('show.bs.dropdown')
.off('hide.bs.dropdown'); .off('hide.bs.dropdown');
......
...@@ -15,6 +15,7 @@ export default { ...@@ -15,6 +15,7 @@ export default {
}, },
bindEvents() { bindEvents() {
// eslint-disable-next-line @gitlab/no-global-event-off
return this.form.off('submit').on('submit', this.onFormSubmit.bind(this)); return this.form.off('submit').on('submit', this.onFormSubmit.bind(this));
}, },
......
...@@ -215,6 +215,7 @@ export default { ...@@ -215,6 +215,7 @@ export default {
this.fetchIssuables(); this.fetchIssuables();
}, },
beforeDestroy() { beforeDestroy() {
// eslint-disable-next-line @gitlab/no-global-event-off
issueableEventHub.$off('issuables:toggleBulkEdit'); issueableEventHub.$off('issuables:toggleBulkEdit');
}, },
methods: { methods: {
......
...@@ -339,6 +339,7 @@ export function addMarkdownListeners(form) { ...@@ -339,6 +339,7 @@ export function addMarkdownListeners(form) {
Shortcuts.initMarkdownEditorShortcuts($(this), updateTextForToolbarBtn); Shortcuts.initMarkdownEditorShortcuts($(this), updateTextForToolbarBtn);
}); });
// eslint-disable-next-line @gitlab/no-global-event-off
const $allToolbarBtns = $('.js-md', form) const $allToolbarBtns = $('.js-md', form)
.off('click') .off('click')
.on('click', function() { .on('click', function() {
...@@ -351,6 +352,7 @@ export function addMarkdownListeners(form) { ...@@ -351,6 +352,7 @@ export function addMarkdownListeners(form) {
} }
export function addEditorMarkdownListeners(editor) { export function addEditorMarkdownListeners(editor) {
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-md') $('.js-md')
.off('click') .off('click')
.on('click', e => { .on('click', e => {
...@@ -376,5 +378,6 @@ export function removeMarkdownListeners(form) { ...@@ -376,5 +378,6 @@ export function removeMarkdownListeners(form) {
Shortcuts.removeMarkdownEditorShortcuts($(this)); Shortcuts.removeMarkdownEditorShortcuts($(this));
}); });
// eslint-disable-next-line @gitlab/no-global-event-off
return $('.js-md', form).off('click'); return $('.js-md', form).off('click');
} }
...@@ -77,6 +77,7 @@ if (process.env.NODE_ENV !== 'production' && gon?.test_env) { ...@@ -77,6 +77,7 @@ if (process.env.NODE_ENV !== 'production' && gon?.test_env) {
document.addEventListener('beforeunload', () => { document.addEventListener('beforeunload', () => {
// Unbind scroll events // Unbind scroll events
// eslint-disable-next-line @gitlab/no-global-event-off
$(document).off('scroll'); $(document).off('scroll');
// Close any open tooltips // Close any open tooltips
tooltips.dispose(document.querySelectorAll('.has-tooltip, [data-toggle="tooltip"]')); tooltips.dispose(document.querySelectorAll('.has-tooltip, [data-toggle="tooltip"]'));
......
...@@ -11,9 +11,11 @@ export default class Members { ...@@ -11,9 +11,11 @@ export default class Members {
} }
addListeners() { addListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-member-update-control') $('.js-member-update-control')
.off('change') .off('change')
.on('change', this.formSubmit.bind(this)); .on('change', this.formSubmit.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-edit-member-form') $('.js-edit-member-form')
.off('ajax:success') .off('ajax:success')
.on('ajax:success', this.formSuccess.bind(this)); .on('ajax:success', this.formSuccess.bind(this));
......
...@@ -39,6 +39,7 @@ export default class MirrorRepos { ...@@ -39,6 +39,7 @@ export default class MirrorRepos {
initMirrorSSH() { initMirrorSSH() {
if (this.$password) { if (this.$password) {
// eslint-disable-next-line @gitlab/no-global-event-off
this.$password.off('input.updateUrl'); this.$password.off('input.updateUrl');
} }
this.$password = undefined; this.$password = undefined;
......
...@@ -185,10 +185,15 @@ export default class SSHMirror { ...@@ -185,10 +185,15 @@ export default class SSHMirror {
} }
destroy() { destroy() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.$repositoryUrl.off('keyup'); this.$repositoryUrl.off('keyup');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$form.find('.js-known-hosts').off('keyup'); this.$form.find('.js-known-hosts').off('keyup');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$dropdownAuthType.off('change'); this.$dropdownAuthType.off('change');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$btnDetectHostKeys.off('click'); this.$btnDetectHostKeys.off('click');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$btnSSHHostsShowAdvanced.off('click'); this.$btnSSHHostsShowAdvanced.off('click');
} }
} }
...@@ -367,6 +367,7 @@ export default { ...@@ -367,6 +367,7 @@ export default {
}, },
); );
// eslint-disable-next-line @gitlab/no-global-event-off
eChart.off('datazoom'); eChart.off('datazoom');
eChart.on('datazoom', this.throttledDatazoom); eChart.on('datazoom', this.throttledDatazoom);
}, },
......
...@@ -187,6 +187,7 @@ export default class Notes { ...@@ -187,6 +187,7 @@ export default class Notes {
this.$wrapperEl.off('click', '.js-discussion-reply-button'); this.$wrapperEl.off('click', '.js-discussion-reply-button');
this.$wrapperEl.off('click', '.js-add-diff-note-button'); this.$wrapperEl.off('click', '.js-add-diff-note-button');
this.$wrapperEl.off('click', '.js-add-image-diff-note-button'); this.$wrapperEl.off('click', '.js-add-image-diff-note-button');
// eslint-disable-next-line @gitlab/no-global-event-off
this.$wrapperEl.off('visibilitychange'); this.$wrapperEl.off('visibilitychange');
this.$wrapperEl.off('keyup input', '.js-note-text'); this.$wrapperEl.off('keyup input', '.js-note-text');
this.$wrapperEl.off('click', '.js-note-target-reopen'); this.$wrapperEl.off('click', '.js-note-target-reopen');
......
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
}, },
initLoadMore() { initLoadMore() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(document).off('scroll'); $(document).off('scroll');
$(document).endlessScroll({ $(document).endlessScroll({
bottomPixels: ENDLESS_SCROLL_BOTTOM_PX, bottomPixels: ENDLESS_SCROLL_BOTTOM_PX,
......
...@@ -55,6 +55,7 @@ export default class ProjectFindFile { ...@@ -55,6 +55,7 @@ export default class ProjectFindFile {
} }
initEvent() { initEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('keyup'); this.inputElement.off('keyup');
this.inputElement.on('keyup', event => { this.inputElement.on('keyup', event => {
const target = $(event.target); const target = $(event.target);
......
...@@ -26,12 +26,14 @@ const onProjectPathChange = ($projectNameInput, $projectPathInput, hasExistingPr ...@@ -26,12 +26,14 @@ const onProjectPathChange = ($projectNameInput, $projectPathInput, hasExistingPr
}; };
const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => { const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => {
// eslint-disable-next-line @gitlab/no-global-event-off
$projectNameInput.off('keyup change').on('keyup change', () => { $projectNameInput.off('keyup change').on('keyup change', () => {
onProjectNameChange($projectNameInput, $projectPathInput); onProjectNameChange($projectNameInput, $projectPathInput);
hasUserDefinedProjectName = $projectNameInput.val().trim().length > 0; hasUserDefinedProjectName = $projectNameInput.val().trim().length > 0;
hasUserDefinedProjectPath = $projectPathInput.val().trim().length > 0; hasUserDefinedProjectPath = $projectPathInput.val().trim().length > 0;
}); });
// eslint-disable-next-line @gitlab/no-global-event-off
$projectPathInput.off('keyup change').on('keyup change', () => { $projectPathInput.off('keyup change').on('keyup change', () => {
onProjectPathChange($projectNameInput, $projectPathInput, hasUserDefinedProjectName); onProjectPathChange($projectNameInput, $projectPathInput, hasUserDefinedProjectName);
hasUserDefinedProjectPath = $projectPathInput.val().trim().length > 0; hasUserDefinedProjectPath = $projectPathInput.val().trim().length > 0;
...@@ -137,6 +139,7 @@ const bindEvents = () => { ...@@ -137,6 +139,7 @@ const bindEvents = () => {
target.focus(); target.focus();
}) })
.on('hide.bs.popover', () => { .on('hide.bs.popover', () => {
// eslint-disable-next-line @gitlab/no-global-event-off
$(document).off('click.popover touchstart.popover'); $(document).off('click.popover touchstart.popover');
}); });
} }
......
...@@ -97,7 +97,9 @@ export default { ...@@ -97,7 +97,9 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
const $input = $(this.$refs.input); const $input = $(this.$refs.input);
// eslint-disable-next-line @gitlab/no-global-event-off
$input.off('shown-issues.atwho'); $input.off('shown-issues.atwho');
// eslint-disable-next-line @gitlab/no-global-event-off
$input.off('hidden-issues.atwho'); $input.off('hidden-issues.atwho');
$input.off('inserted-issues.atwho', this.onInput); $input.off('inserted-issues.atwho', this.onInput);
}, },
......
...@@ -23,8 +23,11 @@ Sidebar.initialize = function() { ...@@ -23,8 +23,11 @@ Sidebar.initialize = function() {
Sidebar.prototype.removeListeners = function() { Sidebar.prototype.removeListeners = function() {
this.sidebar.off('click', '.sidebar-collapsed-icon'); this.sidebar.off('click', '.sidebar-collapsed-icon');
// eslint-disable-next-line @gitlab/no-global-event-off
this.sidebar.off('hidden.gl.dropdown'); this.sidebar.off('hidden.gl.dropdown');
// eslint-disable-next-line @gitlab/no-global-event-off
$('.dropdown').off('loading.gl.dropdown'); $('.dropdown').off('loading.gl.dropdown');
// eslint-disable-next-line @gitlab/no-global-event-off
$('.dropdown').off('loaded.gl.dropdown'); $('.dropdown').off('loaded.gl.dropdown');
$(document).off('click', '.js-sidebar-toggle'); $(document).off('click', '.js-sidebar-toggle');
}; };
......
...@@ -3,6 +3,7 @@ import { __ } from './locale'; ...@@ -3,6 +3,7 @@ import { __ } from './locale';
function expandSection($section) { function expandSection($section) {
$section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse')); $section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse'));
// eslint-disable-next-line @gitlab/no-global-event-off
$section $section
.find('.settings-content') .find('.settings-content')
.off('scroll.expandSection') .off('scroll.expandSection')
......
...@@ -95,6 +95,7 @@ export default class SmartInterval { ...@@ -95,6 +95,7 @@ export default class SmartInterval {
window.removeEventListener('blur', this.onWindowVisibilityChange); window.removeEventListener('blur', this.onWindowVisibilityChange);
window.removeEventListener('focus', this.onWindowVisibilityChange); window.removeEventListener('focus', this.onWindowVisibilityChange);
this.cancel(); this.cancel();
// eslint-disable-next-line @gitlab/no-global-event-off
$(document) $(document)
.off('visibilitychange') .off('visibilitychange')
.off('beforeunload'); .off('beforeunload');
......
...@@ -25,6 +25,7 @@ export default class GLTerminal { ...@@ -25,6 +25,7 @@ export default class GLTerminal {
this.setSocketUrl(); this.setSocketUrl();
this.createTerminal(); this.createTerminal();
// eslint-disable-next-line @gitlab/no-global-event-off
$(window) $(window)
.off('resize.terminal') .off('resize.terminal')
.on('resize.terminal', () => { .on('resize.terminal', () => {
...@@ -104,6 +105,7 @@ export default class GLTerminal { ...@@ -104,6 +105,7 @@ export default class GLTerminal {
} }
dispose() { dispose() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.terminal.off('data'); this.terminal.off('data');
this.terminal.dispose(); this.terminal.dispose();
this.socket.close(); this.socket.close();
......
export default class VersionCheckImage { export default class VersionCheckImage {
static bindErrorEvent(imageElement) { static bindErrorEvent(imageElement) {
// eslint-disable-next-line @gitlab/no-global-event-off
imageElement.off('error').on('error', () => imageElement.hide()); imageElement.off('error').on('error', () => imageElement.hide());
} }
} }
...@@ -8,9 +8,11 @@ export default class MembersEE extends Members { ...@@ -8,9 +8,11 @@ export default class MembersEE extends Members {
addListeners() { addListeners() {
super.addListeners(); super.addListeners();
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-ldap-permissions') $('.js-ldap-permissions')
.off('click') .off('click')
.on('click', this.showLDAPPermissionsWarning.bind(this)); .on('click', this.showLDAPPermissionsWarning.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-ldap-override') $('.js-ldap-override')
.off('click') .off('click')
.on('click', this.toggleMemberAccessToggle.bind(this)); .on('click', this.toggleMemberAccessToggle.bind(this));
......
...@@ -118,7 +118,9 @@ export default { ...@@ -118,7 +118,9 @@ export default {
}); });
}, },
beforeDestroy() { beforeDestroy() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(document).off('zen_mode:enter'); $(document).off('zen_mode:enter');
// eslint-disable-next-line @gitlab/no-global-event-off
$(document).off('zen_mode:leave'); $(document).off('zen_mode:leave');
}, },
methods: { methods: {
......
...@@ -60,6 +60,7 @@ export default { ...@@ -60,6 +60,7 @@ export default {
accordionEventBus.$on(this.closeOtherItemsEvent, this.onCloseOtherAccordionItems); accordionEventBus.$on(this.closeOtherItemsEvent, this.onCloseOtherAccordionItems);
}, },
destroyed() { destroyed() {
// eslint-disable-next-line @gitlab/no-global-event-off
accordionEventBus.$off(this.closeOtherItemsEvent); accordionEventBus.$off(this.closeOtherItemsEvent);
}, },
methods: { methods: {
......
...@@ -25,3 +25,6 @@ rules: ...@@ -25,3 +25,6 @@ rules:
- 'testAction' - 'testAction'
jest/no-test-callback: jest/no-test-callback:
- off - off
"@gitlab/no-global-event-off":
- off
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