Remove all eslint-disable no-undef & use global comments (#12527)

Recommendation is to either declare globals in config or in a `/* global ` comment
See https://eslint.org/docs/latest/rules/no-undef#rule-details
pull/12536/head
LB 2024-11-02 08:41:07 +10:00 zatwierdzone przez Matt Westcott
rodzic cae3229716
commit 825a77d6c2
12 zmienionych plików z 23 dodań i 17 usunięć

Wyświetl plik

@ -32,6 +32,7 @@ Changelog
* Maintenance: Update `CloneController` to ensure that `added`/`cleared` events are not dispatched as cancelable (LB (Ben) Johnston)
* Maintenance: Remove unused `uuid` UMD module as all code is now using the NPM module (LB (Ben) Johnston)
* Maintenance: Clean up JS comments throughout codebase to be aligned to JSDoc where practical (LB (Ben) Johnston)
* Maintenance: Replace `eslint-disable no-undef` linter directives with `global` comments (LB (Ben) Johnston)
* Maintenance: Upgrade Node tooling to active LTS version 22 (LB (Ben) Johnston)
* Maintenance: Remove defunct oEmbed providers (Rahul Samant)
* Maintenance: Remove obsolete non-upsert-based code for Postgres search indexing (Jake Howard)

Wyświetl plik

@ -1,13 +1,13 @@
/* global DocumentChooserModal */
import { Chooser, ChooserFactory } from '.';
export class DocumentChooser extends Chooser {
// eslint-disable-next-line no-undef
chooserModalClass = DocumentChooserModal;
}
window.DocumentChooser = DocumentChooser;
export class DocumentChooserFactory extends ChooserFactory {
widgetClass = DocumentChooser;
// eslint-disable-next-line no-undef
chooserModalClass = DocumentChooserModal;
}

Wyświetl plik

@ -1,7 +1,8 @@
/* global ImageChooserModal */
import { Chooser, ChooserFactory } from '.';
export class ImageChooser extends Chooser {
// eslint-disable-next-line no-undef
chooserModalClass = ImageChooserModal;
initHTMLElements(id) {
@ -46,6 +47,5 @@ export class ImageChooser extends Chooser {
export class ImageChooserFactory extends ChooserFactory {
widgetClass = ImageChooser;
// eslint-disable-next-line no-undef
chooserModalClass = ImageChooserModal;
}

Wyświetl plik

@ -1,7 +1,8 @@
/* global PageChooserModal */
import { Chooser, ChooserFactory } from '.';
export class PageChooser extends Chooser {
// eslint-disable-next-line no-undef
chooserModalClass = PageChooserModal;
titleStateKey = 'adminTitle';
@ -44,7 +45,6 @@ export class PageChooser extends Chooser {
export class PageChooserFactory extends ChooserFactory {
widgetClass = PageChooser;
// eslint-disable-next-line no-undef
chooserModalClass = PageChooserModal;
getModalOptions() {

Wyświetl plik

@ -1,4 +1,5 @@
/* eslint-disable no-underscore-dangle */
/* global $ */
import { v4 as uuidv4 } from 'uuid';
import {
@ -13,8 +14,6 @@ import {
removeErrorMessages,
} from '../../../includes/streamFieldErrors';
/* global $ */
/**
* Wrapper for an item inside a ListBlock
*/
@ -223,6 +222,7 @@ export class ListBlock extends BaseSequenceBlock {
}
insert(value, index, opts) {
// eslint-disable-next-line no-underscore-dangle
return this._insert(
this.blockDef.childBlockDef,
value,

Wyświetl plik

@ -1,10 +1,11 @@
/* global ModalWorkflow */
import $ from 'jquery';
$(() => {
/* Interface to set permissions from the explorer / editor */
// eslint-disable-next-line func-names
$('[data-a11y-dialog-show="set-privacy"]').on('click', function () {
// eslint-disable-next-line no-undef
ModalWorkflow({
dialogId: 'set-privacy',
url: this.getAttribute('data-url'),

Wyświetl plik

@ -1,3 +1,5 @@
/* global ModalWorkflow TASK_CHOOSER_MODAL_ONLOAD_HANDLERS */
import $ from 'jquery';
function createTaskChooser(id) {
@ -7,10 +9,8 @@ function createTaskChooser(id) {
const editAction = chooserElement.find('[data-chooser-edit-link]');
$('[data-chooser-action-choose]', chooserElement).on('click', () => {
// eslint-disable-next-line no-undef
ModalWorkflow({
url: chooserElement.data('chooserUrl'),
// eslint-disable-next-line no-undef
onload: TASK_CHOOSER_MODAL_ONLOAD_HANDLERS,
responses: {
taskChosen(data) {

Wyświetl plik

@ -1,3 +1,5 @@
/* global draftail */
import { gettext } from '../../../utils/gettext';
import { runInlineScripts } from '../../../utils/runInlineScripts';
@ -327,7 +329,6 @@ class BoundDraftailWidget {
this.capabilities = new Map(parentCapabilities);
this.options = options;
// eslint-disable-next-line no-undef
const [, setOptions] = draftail.initEditor(
'#' + this.input.id,
this.getFullOptions(),

Wyświetl plik

@ -1,3 +1,5 @@
/* global ModalWorkflow */
import $ from 'jquery';
import { WAGTAIL_CONFIG } from '../../config/wagtailConfig';
@ -29,7 +31,6 @@ function ActivateWorkflowActionsForDashboard() {
e.preventDefault();
if ('launchModal' in buttonElement.dataset) {
// eslint-disable-next-line no-undef
ModalWorkflow({
url: buttonElement.dataset.workflowActionUrl,
onload: {
@ -86,7 +87,6 @@ function ActivateWorkflowActionsForEditView(formSelector) {
e.stopPropagation();
// open the modal at the given URL
// eslint-disable-next-line no-undef
ModalWorkflow({
url: buttonElement.dataset.workflowActionModalUrl,
onload: {

Wyświetl plik

@ -1,3 +1,5 @@
/* global ModalWorkflow */
import $ from 'jquery';
import { initTabs } from './tabs';
import { gettext } from '../utils/gettext';
@ -356,7 +358,6 @@ class ChooserModal {
}
open(opts, callback) {
// eslint-disable-next-line no-undef
ModalWorkflow({
url: this.getURL(opts || {}),
urlParams: this.getURLParams(opts || {}),

Wyświetl plik

@ -52,6 +52,7 @@ depth: 1
* Update `CloneController` to ensure that `added`/`cleared` events are not dispatched as cancelable (LB (Ben) Johnston)
* Remove unused `uuid` UMD module as all code is now using the NPM module (LB (Ben) Johnston)
* Clean up JS comments throughout codebase to be aligned to JSDoc where practical (LB (Ben) Johnston)
* Replace `eslint-disable no-undef` linter directives with `global` comments (LB (Ben) Johnston)
* Upgrade Node tooling to active LTS version 22 (LB (Ben) Johnston)
* Remove defunct oEmbed providers (Rahul Samant)
* Remove obsolete non-upsert-based code for Postgres search indexing (Jake Howard)

Wyświetl plik

@ -1,5 +1,6 @@
/* global InlinePanel */
$(function () {
// eslint-disable-next-line no-undef
var panel = new InlinePanel({
formsetPrefix: 'id_{{ formset.prefix }}',
emptyChildFormPrefix: '{{ formset.empty_form.prefix }}',