From ae43f0c48bf7acede8a325b24197001fe2b2f416 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 29 Mar 2023 20:49:30 +0300 Subject: Tweak and re-organize ESLint config (#38369) * Tweak and re-organize ESLint config * merge individual configs to the root config * enable more eslint-plugin-import rules * lint markdown files * Lint --- js/src/alert.js | 4 ++-- js/src/base-component.js | 2 +- js/src/button.js | 4 ++-- js/src/carousel.js | 10 +++++----- js/src/collapse.js | 6 +++--- js/src/dom/event-handler.js | 2 +- js/src/dropdown.js | 14 +++++++------- js/src/modal.js | 8 ++++---- js/src/offcanvas.js | 12 ++++++------ js/src/popover.js | 2 +- js/src/scrollspy.js | 4 ++-- js/src/tab.js | 8 ++++---- js/src/toast.js | 4 ++-- js/src/tooltip.js | 12 ++++++------ js/src/util/backdrop.js | 2 +- js/src/util/component-functions.js | 2 +- js/src/util/config.js | 2 +- js/src/util/scrollbar.js | 2 +- js/src/util/swipe.js | 2 +- js/src/util/template-factory.js | 4 ++-- 20 files changed, 53 insertions(+), 53 deletions(-) (limited to 'js/src') diff --git a/js/src/alert.js b/js/src/alert.js index 0c60b88d3..88232bceb 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin } from './util/index.js' -import EventHandler from './dom/event-handler.js' import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' import { enableDismissTrigger } from './util/component-functions.js' +import { defineJQueryPlugin } from './util/index.js' /** * Constants diff --git a/js/src/base-component.js b/js/src/base-component.js index ee30390ae..813fc39c6 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -6,9 +6,9 @@ */ import Data from './dom/data.js' -import { executeAfterTransition, getElement } from './util/index.js' import EventHandler from './dom/event-handler.js' import Config from './util/config.js' +import { executeAfterTransition, getElement } from './util/index.js' /** * Constants diff --git a/js/src/button.js b/js/src/button.js index 7b4e12804..a797f5050 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -5,9 +5,9 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin } from './util/index.js' -import EventHandler from './dom/event-handler.js' import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' +import { defineJQueryPlugin } from './util/index.js' /** * Constants diff --git a/js/src/carousel.js b/js/src/carousel.js index 4d15d7fde..68d11a32f 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -5,6 +5,10 @@ * -------------------------------------------------------------------------- */ +import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' +import Manipulator from './dom/manipulator.js' +import SelectorEngine from './dom/selector-engine.js' import { defineJQueryPlugin, getNextActiveElement, @@ -13,11 +17,7 @@ import { reflow, triggerTransitionEnd } from './util/index.js' -import EventHandler from './dom/event-handler.js' -import Manipulator from './dom/manipulator.js' -import SelectorEngine from './dom/selector-engine.js' import Swipe from './util/swipe.js' -import BaseComponent from './base-component.js' /** * Constants @@ -329,7 +329,7 @@ class Carousel extends BaseComponent { if (!activeElement || !nextElement) { // Some weirdness is happening, so we bail - // todo: change tests that use empty divs to avoid this check + // TODO: change tests that use empty divs to avoid this check return } diff --git a/js/src/collapse.js b/js/src/collapse.js index 815b415d4..9f0c60cc5 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -5,14 +5,14 @@ * -------------------------------------------------------------------------- */ +import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' +import SelectorEngine from './dom/selector-engine.js' import { defineJQueryPlugin, getElement, reflow } from './util/index.js' -import EventHandler from './dom/event-handler.js' -import SelectorEngine from './dom/selector-engine.js' -import BaseComponent from './base-component.js' /** * Constants diff --git a/js/src/dom/event-handler.js b/js/src/dom/event-handler.js index 97cf3041e..561d8751d 100644 --- a/js/src/dom/event-handler.js +++ b/js/src/dom/event-handler.js @@ -128,7 +128,7 @@ function findHandler(events, callable, delegationSelector = null) { function normalizeParameters(originalTypeEvent, handler, delegationFunction) { const isDelegated = typeof handler === 'string' - // todo: tooltip passes `false` instead of selector, so we need to check + // TODO: tooltip passes `false` instead of selector, so we need to check const callable = isDelegated ? delegationFunction : (handler || delegationFunction) let typeEvent = getTypeEvent(originalTypeEvent) diff --git a/js/src/dropdown.js b/js/src/dropdown.js index b2030f7a8..af5fd16fc 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -6,6 +6,10 @@ */ import * as Popper from '@popperjs/core' +import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' +import Manipulator from './dom/manipulator.js' +import SelectorEngine from './dom/selector-engine.js' import { defineJQueryPlugin, execute, @@ -17,10 +21,6 @@ import { isVisible, noop } from './util/index.js' -import EventHandler from './dom/event-handler.js' -import Manipulator from './dom/manipulator.js' -import SelectorEngine from './dom/selector-engine.js' -import BaseComponent from './base-component.js' /** * Constants @@ -96,7 +96,7 @@ class Dropdown extends BaseComponent { this._popper = null this._parent = this._element.parentNode // dropdown wrapper - // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ + // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent) @@ -311,7 +311,7 @@ class Dropdown extends BaseComponent { // Disable Popper if we have a static display or Dropdown is in Navbar if (this._inNavbar || this._config.display === 'static') { - Manipulator.setDataAttribute(this._menu, 'popper', 'static') // todo:v6 remove + Manipulator.setDataAttribute(this._menu, 'popper', 'static') // TODO: v6 remove defaultBsPopperConfig.modifiers = [{ name: 'applyStyles', enabled: false @@ -409,7 +409,7 @@ class Dropdown extends BaseComponent { event.preventDefault() - // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ + // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] || diff --git a/js/src/modal.js b/js/src/modal.js index c4c410204..b44cbb94d 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -5,14 +5,14 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js' +import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import SelectorEngine from './dom/selector-engine.js' -import ScrollBarHelper from './util/scrollbar.js' -import BaseComponent from './base-component.js' import Backdrop from './util/backdrop.js' -import FocusTrap from './util/focustrap.js' import { enableDismissTrigger } from './util/component-functions.js' +import FocusTrap from './util/focustrap.js' +import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js' +import ScrollBarHelper from './util/scrollbar.js' /** * Constants diff --git a/js/src/offcanvas.js b/js/src/offcanvas.js index 7a7f92e96..8d1feb13b 100644 --- a/js/src/offcanvas.js +++ b/js/src/offcanvas.js @@ -5,18 +5,18 @@ * -------------------------------------------------------------------------- */ +import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' +import SelectorEngine from './dom/selector-engine.js' +import Backdrop from './util/backdrop.js' +import { enableDismissTrigger } from './util/component-functions.js' +import FocusTrap from './util/focustrap.js' import { defineJQueryPlugin, isDisabled, isVisible } from './util/index.js' import ScrollBarHelper from './util/scrollbar.js' -import EventHandler from './dom/event-handler.js' -import BaseComponent from './base-component.js' -import SelectorEngine from './dom/selector-engine.js' -import Backdrop from './util/backdrop.js' -import FocusTrap from './util/focustrap.js' -import { enableDismissTrigger } from './util/component-functions.js' /** * Constants diff --git a/js/src/popover.js b/js/src/popover.js index 2679bdae9..612c5218f 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -5,8 +5,8 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin } from './util/index.js' import Tooltip from './tooltip.js' +import { defineJQueryPlugin } from './util/index.js' /** * Constants diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 7695f2aef..0b1747c8a 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js' +import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import SelectorEngine from './dom/selector-engine.js' -import BaseComponent from './base-component.js' +import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js' /** * Constants diff --git a/js/src/tab.js b/js/src/tab.js index d46f290f0..d9993d56e 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js' +import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import SelectorEngine from './dom/selector-engine.js' -import BaseComponent from './base-component.js' +import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js' /** * Constants @@ -43,7 +43,7 @@ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)' const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]' const SELECTOR_OUTER = '.nav-item, .list-group-item' const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}` -const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]' // todo:v6: could be only `tab` +const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]' // TODO: could only be `tab` in v6 const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}` const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]` @@ -59,7 +59,7 @@ class Tab extends BaseComponent { if (!this._parent) { return - // todo: should Throw exception on v6 + // TODO: should throw exception in v6 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) } diff --git a/js/src/toast.js b/js/src/toast.js index a62044222..d5d9c0ee0 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin, reflow } from './util/index.js' -import EventHandler from './dom/event-handler.js' import BaseComponent from './base-component.js' +import EventHandler from './dom/event-handler.js' import { enableDismissTrigger } from './util/component-functions.js' +import { defineJQueryPlugin, reflow } from './util/index.js' /** * Constants diff --git a/js/src/tooltip.js b/js/src/tooltip.js index ff1db974f..125281157 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -6,11 +6,11 @@ */ import * as Popper from '@popperjs/core' -import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js' -import { DefaultAllowlist } from './util/sanitizer.js' +import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import Manipulator from './dom/manipulator.js' -import BaseComponent from './base-component.js' +import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js' +import { DefaultAllowlist } from './util/sanitizer.js' import TemplateFactory from './util/template-factory.js' /** @@ -197,7 +197,7 @@ class Tooltip extends BaseComponent { return } - // todo v6 remove this OR make it optional + // TODO: v6 remove this or make it optional this._disposePopper() const tip = this._getTipElement() @@ -302,13 +302,13 @@ class Tooltip extends BaseComponent { _createTipElement(content) { const tip = this._getTemplateFactory(content).toHtml() - // todo: remove this check on v6 + // TODO: remove this check in v6 if (!tip) { return null } tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW) - // todo: on v6 the following can be achieved with CSS only + // TODO: v6 the following can be achieved with CSS only tip.classList.add(`bs-${this.constructor.NAME}-auto`) const tipId = getUID(this.constructor.NAME).toString() diff --git a/js/src/util/backdrop.js b/js/src/util/backdrop.js index c552aef43..0d478e98d 100644 --- a/js/src/util/backdrop.js +++ b/js/src/util/backdrop.js @@ -6,8 +6,8 @@ */ import EventHandler from '../dom/event-handler.js' -import { execute, executeAfterTransition, getElement, reflow } from './index.js' import Config from './config.js' +import { execute, executeAfterTransition, getElement, reflow } from './index.js' /** * Constants diff --git a/js/src/util/component-functions.js b/js/src/util/component-functions.js index 5eb59b4af..4be828f83 100644 --- a/js/src/util/component-functions.js +++ b/js/src/util/component-functions.js @@ -6,8 +6,8 @@ */ import EventHandler from '../dom/event-handler.js' -import { isDisabled } from './index.js' import SelectorEngine from '../dom/selector-engine.js' +import { isDisabled } from './index.js' const enableDismissTrigger = (component, method = 'hide') => { const clickEvent = `click.dismiss${component.EVENT_KEY}` diff --git a/js/src/util/config.js b/js/src/util/config.js index 95221c1ef..a2b4bfba0 100644 --- a/js/src/util/config.js +++ b/js/src/util/config.js @@ -5,8 +5,8 @@ * -------------------------------------------------------------------------- */ -import { isElement, toType } from './index.js' import Manipulator from '../dom/manipulator.js' +import { isElement, toType } from './index.js' /** * Class definition diff --git a/js/src/util/scrollbar.js b/js/src/util/scrollbar.js index 079c9108b..413f178da 100644 --- a/js/src/util/scrollbar.js +++ b/js/src/util/scrollbar.js @@ -5,8 +5,8 @@ * -------------------------------------------------------------------------- */ -import SelectorEngine from '../dom/selector-engine.js' import Manipulator from '../dom/manipulator.js' +import SelectorEngine from '../dom/selector-engine.js' import { isElement } from './index.js' /** diff --git a/js/src/util/swipe.js b/js/src/util/swipe.js index 33ca90d8a..d2f708711 100644 --- a/js/src/util/swipe.js +++ b/js/src/util/swipe.js @@ -5,8 +5,8 @@ * -------------------------------------------------------------------------- */ -import Config from './config.js' import EventHandler from '../dom/event-handler.js' +import Config from './config.js' import { execute } from './index.js' /** diff --git a/js/src/util/template-factory.js b/js/src/util/template-factory.js index bd827174b..f73589bcc 100644 --- a/js/src/util/template-factory.js +++ b/js/src/util/template-factory.js @@ -5,10 +5,10 @@ * -------------------------------------------------------------------------- */ -import { DefaultAllowlist, sanitizeHtml } from './sanitizer.js' -import { execute, getElement, isElement } from './index.js' import SelectorEngine from '../dom/selector-engine.js' import Config from './config.js' +import { DefaultAllowlist, sanitizeHtml } from './sanitizer.js' +import { execute, getElement, isElement } from './index.js' /** * Constants -- cgit v1.2.3