mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-06 13:46:42 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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] ||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import { defineJQueryPlugin } from './util/index.js'
|
||||
import Tooltip from './tooltip.js'
|
||||
import { defineJQueryPlugin } from './util/index.js'
|
||||
|
||||
/**
|
||||
* Constants
|
||||
|
@@ -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
|
||||
|
@@ -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}`)
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
@@ -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}`
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import { isElement, toType } from './index.js'
|
||||
import Manipulator from '../dom/manipulator.js'
|
||||
import { isElement, toType } from './index.js'
|
||||
|
||||
/**
|
||||
* Class definition
|
||||
|
@@ -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'
|
||||
|
||||
/**
|
||||
|
@@ -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'
|
||||
|
||||
/**
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user