mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-19 16:54:24 +01: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:
parent
3aabfc70c3
commit
ae43f0c48b
@ -3,6 +3,5 @@
|
|||||||
**/vendor/
|
**/vendor/
|
||||||
/_site/
|
/_site/
|
||||||
/js/coverage/
|
/js/coverage/
|
||||||
/js/tests/integration/
|
|
||||||
/site/static/sw.js
|
/site/static/sw.js
|
||||||
/site/layouts/
|
/site/layouts/partials/
|
||||||
|
153
.eslintrc.json
153
.eslintrc.json
@ -14,6 +14,35 @@
|
|||||||
"error",
|
"error",
|
||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
|
"import/extensions": [
|
||||||
|
"error",
|
||||||
|
"ignorePackages",
|
||||||
|
{
|
||||||
|
"js": "always"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"import/first": "error",
|
||||||
|
"import/newline-after-import": "error",
|
||||||
|
"import/no-absolute-path": "error",
|
||||||
|
"import/no-amd": "error",
|
||||||
|
"import/no-cycle": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreExternal": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"import/no-duplicates": "error",
|
||||||
|
"import/no-extraneous-dependencies": "error",
|
||||||
|
"import/no-mutable-exports": "error",
|
||||||
|
"import/no-named-as-default": "error",
|
||||||
|
"import/no-named-as-default-member": "error",
|
||||||
|
"import/no-named-default": "error",
|
||||||
|
"import/no-self-import": "error",
|
||||||
|
"import/no-unassigned-import": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"import/no-useless-path-segments": "error",
|
||||||
|
"import/order": "error",
|
||||||
"indent": [
|
"indent": [
|
||||||
"error",
|
"error",
|
||||||
2,
|
2,
|
||||||
@ -51,7 +80,9 @@
|
|||||||
"error",
|
"error",
|
||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
|
"strict": "error",
|
||||||
"unicorn/explicit-length-check": "off",
|
"unicorn/explicit-length-check": "off",
|
||||||
|
"unicorn/filename-case": "off",
|
||||||
"unicorn/no-array-callback-reference": "off",
|
"unicorn/no-array-callback-reference": "off",
|
||||||
"unicorn/no-array-method-this-argument": "off",
|
"unicorn/no-array-method-this-argument": "off",
|
||||||
"unicorn/no-null": "off",
|
"unicorn/no-null": "off",
|
||||||
@ -63,5 +94,125 @@
|
|||||||
"unicorn/prefer-query-selector": "off",
|
"unicorn/prefer-query-selector": "off",
|
||||||
"unicorn/prefer-spread": "off",
|
"unicorn/prefer-spread": "off",
|
||||||
"unicorn/prevent-abbreviations": "off"
|
"unicorn/prevent-abbreviations": "off"
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"build/**"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"browser": false,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "script"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"unicorn/prefer-top-level-await": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"js/**"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"js/tests/*.js",
|
||||||
|
"js/tests/integration/rollup*.js"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "script"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"js/tests/unit/**"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"jasmine": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"unicorn/consistent-function-scoping": "off",
|
||||||
|
"unicorn/no-useless-undefined": "off",
|
||||||
|
"unicorn/prefer-add-event-listener": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"js/tests/visual/**"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"html"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"html/html-extensions": [
|
||||||
|
".html"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"no-new": "off",
|
||||||
|
"unicorn/no-array-for-each": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"scss/tests/**"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "script"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"site/**"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": false
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "script",
|
||||||
|
"ecmaVersion": 2019
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-new": "off",
|
||||||
|
"unicorn/no-array-for-each": "off",
|
||||||
|
"unicorn/numeric-separators-style": "off"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"**/*.md"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"markdown"
|
||||||
|
],
|
||||||
|
"processor": "markdown/markdown"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"**/*.md/*.js"
|
||||||
|
],
|
||||||
|
"extends": "plugin:markdown/recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"unicorn/prefer-node-protocol": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": false,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "script"
|
|
||||||
},
|
|
||||||
"extends": "../.eslintrc.json",
|
|
||||||
"rules": {
|
|
||||||
"no-console": "off",
|
|
||||||
"strict": "error",
|
|
||||||
"unicorn/prefer-top-level-await": "off"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
|
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
function getBanner(pluginFilename) {
|
function getBanner(pluginFilename) {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../.eslintrc.json",
|
|
||||||
"env": {
|
|
||||||
"es2022": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"./*.js",
|
|
||||||
"./src/**/*.js"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"import/extensions": [
|
|
||||||
2,
|
|
||||||
{
|
|
||||||
"js": "always"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -5,10 +5,10 @@
|
|||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineJQueryPlugin } from './util/index.js'
|
|
||||||
import EventHandler from './dom/event-handler.js'
|
|
||||||
import BaseComponent from './base-component.js'
|
import BaseComponent from './base-component.js'
|
||||||
|
import EventHandler from './dom/event-handler.js'
|
||||||
import { enableDismissTrigger } from './util/component-functions.js'
|
import { enableDismissTrigger } from './util/component-functions.js'
|
||||||
|
import { defineJQueryPlugin } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Data from './dom/data.js'
|
import Data from './dom/data.js'
|
||||||
import { executeAfterTransition, getElement } from './util/index.js'
|
|
||||||
import EventHandler from './dom/event-handler.js'
|
import EventHandler from './dom/event-handler.js'
|
||||||
import Config from './util/config.js'
|
import Config from './util/config.js'
|
||||||
|
import { executeAfterTransition, getElement } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* 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 BaseComponent from './base-component.js'
|
||||||
|
import EventHandler from './dom/event-handler.js'
|
||||||
|
import { defineJQueryPlugin } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* 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 {
|
import {
|
||||||
defineJQueryPlugin,
|
defineJQueryPlugin,
|
||||||
getNextActiveElement,
|
getNextActiveElement,
|
||||||
@ -13,11 +17,7 @@ import {
|
|||||||
reflow,
|
reflow,
|
||||||
triggerTransitionEnd
|
triggerTransitionEnd
|
||||||
} from './util/index.js'
|
} 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 Swipe from './util/swipe.js'
|
||||||
import BaseComponent from './base-component.js'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
@ -329,7 +329,7 @@ class Carousel extends BaseComponent {
|
|||||||
|
|
||||||
if (!activeElement || !nextElement) {
|
if (!activeElement || !nextElement) {
|
||||||
// Some weirdness is happening, so we bail
|
// 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
|
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 {
|
import {
|
||||||
defineJQueryPlugin,
|
defineJQueryPlugin,
|
||||||
getElement,
|
getElement,
|
||||||
reflow
|
reflow
|
||||||
} from './util/index.js'
|
} 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
|
* Constants
|
||||||
|
@ -128,7 +128,7 @@ function findHandler(events, callable, delegationSelector = null) {
|
|||||||
|
|
||||||
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
|
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
|
||||||
const isDelegated = typeof handler === 'string'
|
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)
|
const callable = isDelegated ? delegationFunction : (handler || delegationFunction)
|
||||||
let typeEvent = getTypeEvent(originalTypeEvent)
|
let typeEvent = getTypeEvent(originalTypeEvent)
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Popper from '@popperjs/core'
|
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 {
|
import {
|
||||||
defineJQueryPlugin,
|
defineJQueryPlugin,
|
||||||
execute,
|
execute,
|
||||||
@ -17,10 +21,6 @@ import {
|
|||||||
isVisible,
|
isVisible,
|
||||||
noop
|
noop
|
||||||
} from './util/index.js'
|
} 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
|
* Constants
|
||||||
@ -96,7 +96,7 @@ class Dropdown extends BaseComponent {
|
|||||||
|
|
||||||
this._popper = null
|
this._popper = null
|
||||||
this._parent = this._element.parentNode // dropdown wrapper
|
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] ||
|
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
|
||||||
SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
|
SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
|
||||||
SelectorEngine.findOne(SELECTOR_MENU, this._parent)
|
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
|
// Disable Popper if we have a static display or Dropdown is in Navbar
|
||||||
if (this._inNavbar || this._config.display === 'static') {
|
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 = [{
|
defaultBsPopperConfig.modifiers = [{
|
||||||
name: 'applyStyles',
|
name: 'applyStyles',
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -409,7 +409,7 @@ class Dropdown extends BaseComponent {
|
|||||||
|
|
||||||
event.preventDefault()
|
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) ?
|
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?
|
||||||
this :
|
this :
|
||||||
(SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||
|
(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 EventHandler from './dom/event-handler.js'
|
||||||
import SelectorEngine from './dom/selector-engine.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 Backdrop from './util/backdrop.js'
|
||||||
import FocusTrap from './util/focustrap.js'
|
|
||||||
import { enableDismissTrigger } from './util/component-functions.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
|
* 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 {
|
import {
|
||||||
defineJQueryPlugin,
|
defineJQueryPlugin,
|
||||||
isDisabled,
|
isDisabled,
|
||||||
isVisible
|
isVisible
|
||||||
} from './util/index.js'
|
} from './util/index.js'
|
||||||
import ScrollBarHelper from './util/scrollbar.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
|
* Constants
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineJQueryPlugin } from './util/index.js'
|
|
||||||
import Tooltip from './tooltip.js'
|
import Tooltip from './tooltip.js'
|
||||||
|
import { defineJQueryPlugin } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* 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 EventHandler from './dom/event-handler.js'
|
||||||
import SelectorEngine from './dom/selector-engine.js'
|
import SelectorEngine from './dom/selector-engine.js'
|
||||||
import BaseComponent from './base-component.js'
|
import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* 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 EventHandler from './dom/event-handler.js'
|
||||||
import SelectorEngine from './dom/selector-engine.js'
|
import SelectorEngine from './dom/selector-engine.js'
|
||||||
import BaseComponent from './base-component.js'
|
import { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
@ -43,7 +43,7 @@ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'
|
|||||||
const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
|
const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
|
||||||
const SELECTOR_OUTER = '.nav-item, .list-group-item'
|
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_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_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"]`
|
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) {
|
if (!this._parent) {
|
||||||
return
|
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}`)
|
// 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 BaseComponent from './base-component.js'
|
||||||
|
import EventHandler from './dom/event-handler.js'
|
||||||
import { enableDismissTrigger } from './util/component-functions.js'
|
import { enableDismissTrigger } from './util/component-functions.js'
|
||||||
|
import { defineJQueryPlugin, reflow } from './util/index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Popper from '@popperjs/core'
|
import * as Popper from '@popperjs/core'
|
||||||
import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js'
|
import BaseComponent from './base-component.js'
|
||||||
import { DefaultAllowlist } from './util/sanitizer.js'
|
|
||||||
import EventHandler from './dom/event-handler.js'
|
import EventHandler from './dom/event-handler.js'
|
||||||
import Manipulator from './dom/manipulator.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'
|
import TemplateFactory from './util/template-factory.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,7 +197,7 @@ class Tooltip extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo v6 remove this OR make it optional
|
// TODO: v6 remove this or make it optional
|
||||||
this._disposePopper()
|
this._disposePopper()
|
||||||
|
|
||||||
const tip = this._getTipElement()
|
const tip = this._getTipElement()
|
||||||
@ -302,13 +302,13 @@ class Tooltip extends BaseComponent {
|
|||||||
_createTipElement(content) {
|
_createTipElement(content) {
|
||||||
const tip = this._getTemplateFactory(content).toHtml()
|
const tip = this._getTemplateFactory(content).toHtml()
|
||||||
|
|
||||||
// todo: remove this check on v6
|
// TODO: remove this check in v6
|
||||||
if (!tip) {
|
if (!tip) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
|
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`)
|
tip.classList.add(`bs-${this.constructor.NAME}-auto`)
|
||||||
|
|
||||||
const tipId = getUID(this.constructor.NAME).toString()
|
const tipId = getUID(this.constructor.NAME).toString()
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import EventHandler from '../dom/event-handler.js'
|
import EventHandler from '../dom/event-handler.js'
|
||||||
import { execute, executeAfterTransition, getElement, reflow } from './index.js'
|
|
||||||
import Config from './config.js'
|
import Config from './config.js'
|
||||||
|
import { execute, executeAfterTransition, getElement, reflow } from './index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import EventHandler from '../dom/event-handler.js'
|
import EventHandler from '../dom/event-handler.js'
|
||||||
import { isDisabled } from './index.js'
|
|
||||||
import SelectorEngine from '../dom/selector-engine.js'
|
import SelectorEngine from '../dom/selector-engine.js'
|
||||||
|
import { isDisabled } from './index.js'
|
||||||
|
|
||||||
const enableDismissTrigger = (component, method = 'hide') => {
|
const enableDismissTrigger = (component, method = 'hide') => {
|
||||||
const clickEvent = `click.dismiss${component.EVENT_KEY}`
|
const clickEvent = `click.dismiss${component.EVENT_KEY}`
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { isElement, toType } from './index.js'
|
|
||||||
import Manipulator from '../dom/manipulator.js'
|
import Manipulator from '../dom/manipulator.js'
|
||||||
|
import { isElement, toType } from './index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class definition
|
* Class definition
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import SelectorEngine from '../dom/selector-engine.js'
|
|
||||||
import Manipulator from '../dom/manipulator.js'
|
import Manipulator from '../dom/manipulator.js'
|
||||||
|
import SelectorEngine from '../dom/selector-engine.js'
|
||||||
import { isElement } from './index.js'
|
import { isElement } from './index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Config from './config.js'
|
|
||||||
import EventHandler from '../dom/event-handler.js'
|
import EventHandler from '../dom/event-handler.js'
|
||||||
|
import Config from './config.js'
|
||||||
import { execute } from './index.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 SelectorEngine from '../dom/selector-engine.js'
|
||||||
import Config from './config.js'
|
import Config from './config.js'
|
||||||
|
import { DefaultAllowlist, sanitizeHtml } from './sanitizer.js'
|
||||||
|
import { execute, getElement, isElement } from './index.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-env node */
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
const browsers = {
|
const browsers = {
|
||||||
safariMac: {
|
safariMac: {
|
||||||
base: 'BrowserStack',
|
base: 'BrowserStack',
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable import/extensions, import/no-unassigned-import */
|
||||||
|
|
||||||
import Tooltip from '../../dist/tooltip'
|
import Tooltip from '../../dist/tooltip'
|
||||||
import '../../dist/carousel'
|
import '../../dist/carousel'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eslint-env node */
|
'use strict'
|
||||||
|
|
||||||
const commonjs = require('@rollup/plugin-commonjs')
|
const commonjs = require('@rollup/plugin-commonjs')
|
||||||
const configRollup = require('./rollup.bundle')
|
const configRollup = require('./rollup.bundle.js')
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...configRollup,
|
...configRollup,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* eslint-env node */
|
'use strict'
|
||||||
|
|
||||||
const { babel } = require('@rollup/plugin-babel')
|
const { babel } = require('@rollup/plugin-babel')
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
@ -8,7 +6,7 @@ const { babel } = require('@rollup/plugin-babel')
|
|||||||
const istanbul = require('rollup-plugin-istanbul')
|
const istanbul = require('rollup-plugin-istanbul')
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
const replace = require('@rollup/plugin-replace')
|
const replace = require('@rollup/plugin-replace')
|
||||||
const { browsers } = require('./browsers')
|
const { browsers } = require('./browsers.js')
|
||||||
|
|
||||||
const ENV = process.env
|
const ENV = process.env
|
||||||
const BROWSERSTACK = Boolean(ENV.BROWSERSTACK)
|
const BROWSERSTACK = Boolean(ENV.BROWSERSTACK)
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"../../../.eslintrc.json"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jasmine": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"unicorn/consistent-function-scoping": "off",
|
|
||||||
"unicorn/no-useless-undefined": "off",
|
|
||||||
"unicorn/prefer-add-event-listener": "off"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import Alert from '../../src/alert'
|
import Alert from '../../src/alert.js'
|
||||||
import { getTransitionDurationFromElement } from '../../src/util/index'
|
import { getTransitionDurationFromElement } from '../../src/util/index.js'
|
||||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Alert', () => {
|
describe('Alert', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import BaseComponent from '../../src/base-component'
|
import BaseComponent from '../../src/base-component.js'
|
||||||
import { clearFixture, getFixture } from '../helpers/fixture'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import { noop } from '../../src/util/index.js'
|
||||||
import { noop } from '../../src/util'
|
import { clearFixture, getFixture } from '../helpers/fixture.js'
|
||||||
|
|
||||||
class DummyClass extends BaseComponent {
|
class DummyClass extends BaseComponent {
|
||||||
constructor(element) {
|
constructor(element) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Button from '../../src/button'
|
import Button from '../../src/button.js'
|
||||||
import { getFixture, clearFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Button', () => {
|
describe('Button', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import Carousel from '../../src/carousel'
|
import Carousel from '../../src/carousel.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { isRTL, noop } from '../../src/util/index.js'
|
||||||
import { isRTL, noop } from '../../src/util/index'
|
import Swipe from '../../src/util/swipe.js'
|
||||||
import Swipe from '../../src/util/swipe'
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Carousel', () => {
|
describe('Carousel', () => {
|
||||||
const { Simulator, PointerEvent } = window
|
const { Simulator, PointerEvent } = window
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Collapse from '../../src/collapse'
|
import Collapse from '../../src/collapse.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Collapse', () => {
|
describe('Collapse', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Data from '../../../src/dom/data'
|
import Data from '../../../src/dom/data.js'
|
||||||
import { getFixture, clearFixture } from '../../helpers/fixture'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Data', () => {
|
describe('Data', () => {
|
||||||
const TEST_KEY = 'bs.test'
|
const TEST_KEY = 'bs.test'
|
||||||
@ -89,7 +89,6 @@ describe('Data', () => {
|
|||||||
expect(Data.get(div, TEST_KEY)).toBeNull()
|
expect(Data.get(div, TEST_KEY)).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
/* eslint-disable no-console */
|
|
||||||
it('should console.error a message if called with multiple keys', () => {
|
it('should console.error a message if called with multiple keys', () => {
|
||||||
console.error = jasmine.createSpy('console.error')
|
console.error = jasmine.createSpy('console.error')
|
||||||
|
|
||||||
@ -102,5 +101,4 @@ describe('Data', () => {
|
|||||||
expect(console.error).toHaveBeenCalled()
|
expect(console.error).toHaveBeenCalled()
|
||||||
expect(Data.get(div, UNKNOWN_KEY)).toBeNull()
|
expect(Data.get(div, UNKNOWN_KEY)).toBeNull()
|
||||||
})
|
})
|
||||||
/* eslint-enable no-console */
|
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import EventHandler from '../../../src/dom/event-handler'
|
import EventHandler from '../../../src/dom/event-handler.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { noop } from '../../../src/util/index.js'
|
||||||
import { noop } from '../../../src/util'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('EventHandler', () => {
|
describe('EventHandler', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Manipulator from '../../../src/dom/manipulator'
|
import Manipulator from '../../../src/dom/manipulator.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Manipulator', () => {
|
describe('Manipulator', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import SelectorEngine from '../../../src/dom/selector-engine'
|
import SelectorEngine from '../../../src/dom/selector-engine.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('SelectorEngine', () => {
|
describe('SelectorEngine', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Dropdown from '../../src/dropdown'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import Dropdown from '../../src/dropdown.js'
|
||||||
import { noop } from '../../src/util/index'
|
import { noop } from '../../src/util/index.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Dropdown', () => {
|
describe('Dropdown', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
/* eslint-env jquery */
|
/* eslint-env jquery */
|
||||||
|
|
||||||
import Alert from '../../src/alert'
|
import Alert from '../../src/alert.js'
|
||||||
import Button from '../../src/button'
|
import Button from '../../src/button.js'
|
||||||
import Carousel from '../../src/carousel'
|
import Carousel from '../../src/carousel.js'
|
||||||
import Collapse from '../../src/collapse'
|
import Collapse from '../../src/collapse.js'
|
||||||
import Dropdown from '../../src/dropdown'
|
import Dropdown from '../../src/dropdown.js'
|
||||||
import Modal from '../../src/modal'
|
import Modal from '../../src/modal.js'
|
||||||
import Offcanvas from '../../src/offcanvas'
|
import Offcanvas from '../../src/offcanvas.js'
|
||||||
import Popover from '../../src/popover'
|
import Popover from '../../src/popover.js'
|
||||||
import ScrollSpy from '../../src/scrollspy'
|
import ScrollSpy from '../../src/scrollspy.js'
|
||||||
import Tab from '../../src/tab'
|
import Tab from '../../src/tab.js'
|
||||||
import Toast from '../../src/toast'
|
import Toast from '../../src/toast.js'
|
||||||
import Tooltip from '../../src/tooltip'
|
import Tooltip from '../../src/tooltip.js'
|
||||||
import { clearFixture, getFixture } from '../helpers/fixture'
|
import { clearFixture, getFixture } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('jQuery', () => {
|
describe('jQuery', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Modal from '../../src/modal'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import Modal from '../../src/modal.js'
|
||||||
import ScrollBarHelper from '../../src/util/scrollbar'
|
import ScrollBarHelper from '../../src/util/scrollbar.js'
|
||||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Modal', () => {
|
describe('Modal', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import Offcanvas from '../../src/offcanvas'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import Offcanvas from '../../src/offcanvas.js'
|
||||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { isVisible } from '../../src/util/index.js'
|
||||||
import { isVisible } from '../../src/util/index'
|
import ScrollBarHelper from '../../src/util/scrollbar.js'
|
||||||
import ScrollBarHelper from '../../src/util/scrollbar'
|
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Offcanvas', () => {
|
describe('Offcanvas', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Popover from '../../src/popover'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import Popover from '../../src/popover.js'
|
||||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Popover', () => {
|
describe('Popover', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import ScrollSpy from '../../src/scrollspy'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
|
import ScrollSpy from '../../src/scrollspy.js'
|
||||||
/** Test helpers */
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
|
||||||
|
|
||||||
describe('ScrollSpy', () => {
|
describe('ScrollSpy', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Tab from '../../src/tab'
|
import Tab from '../../src/tab.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Tab', () => {
|
describe('Tab', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Toast from '../../src/toast'
|
import Toast from '../../src/toast.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Toast', () => {
|
describe('Toast', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Tooltip from '../../src/tooltip'
|
import EventHandler from '../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../src/dom/event-handler'
|
import Tooltip from '../../src/tooltip.js'
|
||||||
import { noop } from '../../src/util/index'
|
import { noop } from '../../src/util/index.js'
|
||||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Tooltip', () => {
|
describe('Tooltip', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Backdrop from '../../../src/util/backdrop'
|
import Backdrop from '../../../src/util/backdrop.js'
|
||||||
import { getTransitionDurationFromElement } from '../../../src/util/index'
|
import { getTransitionDurationFromElement } from '../../../src/util/index.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
const CLASS_BACKDROP = '.modal-backdrop'
|
const CLASS_BACKDROP = '.modal-backdrop'
|
||||||
const CLASS_NAME_FADE = 'fade'
|
const CLASS_NAME_FADE = 'fade'
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/* Test helpers */
|
import BaseComponent from '../../../src/base-component.js'
|
||||||
|
import { enableDismissTrigger } from '../../../src/util/component-functions.js'
|
||||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture'
|
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture.js'
|
||||||
import { enableDismissTrigger } from '../../../src/util/component-functions'
|
|
||||||
import BaseComponent from '../../../src/base-component'
|
|
||||||
|
|
||||||
class DummyClass2 extends BaseComponent {
|
class DummyClass2 extends BaseComponent {
|
||||||
static get NAME() {
|
static get NAME() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Config from '../../../src/util/config'
|
import Config from '../../../src/util/config.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
class DummyConfigClass extends Config {
|
class DummyConfigClass extends Config {
|
||||||
static get NAME() {
|
static get NAME() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import FocusTrap from '../../../src/util/focustrap'
|
import EventHandler from '../../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../../src/dom/event-handler'
|
import SelectorEngine from '../../../src/dom/selector-engine.js'
|
||||||
import SelectorEngine from '../../../src/dom/selector-engine'
|
import FocusTrap from '../../../src/util/focustrap.js'
|
||||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture'
|
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('FocusTrap', () => {
|
describe('FocusTrap', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as Util from '../../../src/util/index'
|
import * as Util from '../../../src/util/index.js'
|
||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import { noop } from '../../../src/util/index.js'
|
||||||
import { noop } from '../../../src/util/index'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Util', () => {
|
describe('Util', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DefaultAllowlist, sanitizeHtml } from '../../../src/util/sanitizer'
|
import { DefaultAllowlist, sanitizeHtml } from '../../../src/util/sanitizer.js'
|
||||||
|
|
||||||
describe('Sanitizer', () => {
|
describe('Sanitizer', () => {
|
||||||
describe('sanitizeHtml', () => {
|
describe('sanitizeHtml', () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { clearBodyAndDocument, clearFixture, getFixture } from '../../helpers/fixture'
|
import Manipulator from '../../../src/dom/manipulator.js'
|
||||||
import Manipulator from '../../../src/dom/manipulator'
|
import ScrollBarHelper from '../../../src/util/scrollbar.js'
|
||||||
import ScrollBarHelper from '../../../src/util/scrollbar'
|
import { clearBodyAndDocument, clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('ScrollBar', () => {
|
describe('ScrollBar', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import EventHandler from '../../../src/dom/event-handler.js'
|
||||||
import EventHandler from '../../../src/dom/event-handler'
|
import { noop } from '../../../src/util/index.js'
|
||||||
import Swipe from '../../../src/util/swipe'
|
import Swipe from '../../../src/util/swipe.js'
|
||||||
import { noop } from '../../../src/util'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('Swipe', () => {
|
describe('Swipe', () => {
|
||||||
const { Simulator, PointerEvent } = window
|
const { Simulator, PointerEvent } = window
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
import TemplateFactory from '../../../src/util/template-factory.js'
|
||||||
import TemplateFactory from '../../../src/util/template-factory'
|
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||||
|
|
||||||
describe('TemplateFactory', () => {
|
describe('TemplateFactory', () => {
|
||||||
let fixtureEl
|
let fixtureEl
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": [
|
|
||||||
"html"
|
|
||||||
],
|
|
||||||
"extends": "../../../.eslintrc.json",
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"settings": {
|
|
||||||
"html/html-extensions": [
|
|
||||||
".html"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-console": "off",
|
|
||||||
"no-new": "off",
|
|
||||||
"unicorn/no-array-for-each": "off"
|
|
||||||
}
|
|
||||||
}
|
|
@ -61,7 +61,7 @@
|
|||||||
"js-compile-standalone-esm": "rollup --environment ESM:true,BUNDLE:false --config build/rollup.config.js --sourcemap",
|
"js-compile-standalone-esm": "rollup --environment ESM:true,BUNDLE:false --config build/rollup.config.js --sourcemap",
|
||||||
"js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap",
|
"js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap",
|
||||||
"js-compile-plugins": "node build/build-plugins.js",
|
"js-compile-plugins": "node build/build-plugins.js",
|
||||||
"js-lint": "eslint --cache --cache-location .cache/.eslintcache --report-unused-disable-directives --ext .html,.js .",
|
"js-lint": "eslint --cache --cache-location .cache/.eslintcache --report-unused-disable-directives --ext .html,.js,.md .",
|
||||||
"js-minify": "npm-run-all --aggregate-output --parallel js-minify-*",
|
"js-minify": "npm-run-all --aggregate-output --parallel js-minify-*",
|
||||||
"js-minify-standalone": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
|
"js-minify-standalone": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
|
||||||
"js-minify-standalone-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.esm.js.map,includeSources,url=bootstrap.esm.min.js.map\" --output dist/js/bootstrap.esm.min.js dist/js/bootstrap.esm.js",
|
"js-minify-standalone-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.esm.js.map,includeSources,url=bootstrap.esm.min.js.map\" --output dist/js/bootstrap.esm.min.js dist/js/bootstrap.esm.js",
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
|
|
||||||
const runnerPath = path.join(__dirname, 'runner').replace(/\\/g, '/')
|
const runnerPath = path.join(__dirname, 'runner').replace(/\\/g, '/')
|
||||||
|
|
||||||
require.extensions['.scss'] = (module, filename) => {
|
require.extensions['.scss'] = (module, filename) => {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { runSass } = require('sass-true')
|
|
||||||
const fs = require('node:fs')
|
const fs = require('node:fs')
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
|
const { runSass } = require('sass-true')
|
||||||
|
|
||||||
module.exports = (filename, { describe, it }) => {
|
module.exports = (filename, { describe, it }) => {
|
||||||
const data = fs.readFileSync(filename, 'utf8')
|
const data = fs.readFileSync(filename, 'utf8')
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../.eslintrc.json",
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"node": false
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "script"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"markdown"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"no-new": "off",
|
|
||||||
"strict": "error",
|
|
||||||
"unicorn/no-array-for-each": "off",
|
|
||||||
"unicorn/numeric-separators-style": "off",
|
|
||||||
"unicorn/prefer-node-protocol": "off"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
// 2. Enable the Markdown processor for all .md files.
|
|
||||||
"files": [
|
|
||||||
"./**/*.md"
|
|
||||||
],
|
|
||||||
"processor": "markdown/markdown"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// In v2, configuration for fenced code blocks is separate from the
|
|
||||||
// containing Markdown file. Each code block has a virtual filename
|
|
||||||
// appended to the Markdown file's path.
|
|
||||||
"files": [
|
|
||||||
"./**/*.md/*.js"
|
|
||||||
],
|
|
||||||
// Configuration for fenced code blocks goes with the override for
|
|
||||||
// the code block's virtual filename, for example:
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"impliedStrict": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-array-for-each": "off",
|
|
||||||
"no-labels": "off",
|
|
||||||
"no-redeclare": "off",
|
|
||||||
"no-undef": "off",
|
|
||||||
"no-unused-expressions": "off",
|
|
||||||
"no-unused-labels": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"unicorn/no-array-for-each": "off",
|
|
||||||
"unicorn/numeric-separators-style": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -30,6 +30,7 @@ A better alternative for those using this type of frameworks is to use a framewo
|
|||||||
|
|
||||||
We provide a version of Bootstrap built as `ESM` (`bootstrap.esm.js` and `bootstrap.esm.min.js`) which allows you to use Bootstrap as a module in the browser, if your [targeted browsers support it](https://caniuse.com/es6-module).
|
We provide a version of Bootstrap built as `ESM` (`bootstrap.esm.js` and `bootstrap.esm.min.js`) which allows you to use Bootstrap as a module in the browser, if your [targeted browsers support it](https://caniuse.com/es6-module).
|
||||||
|
|
||||||
|
<!-- eslint-skip -->
|
||||||
```html
|
```html
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { Toast } from 'bootstrap.esm.min.js'
|
import { Toast } from 'bootstrap.esm.min.js'
|
||||||
@ -54,6 +55,7 @@ Uncaught TypeError: Failed to resolve module specifier "@popperjs/core". Relativ
|
|||||||
|
|
||||||
To fix this, you can use an `importmap` to resolve the arbitrary module names to complete paths. If your [targeted browsers](https://caniuse.com/?search=importmap) do not support `importmap`, you'll need to use the [es-module-shims](https://github.com/guybedford/es-module-shims) project. Here's how it works for Bootstrap and Popper:
|
To fix this, you can use an `importmap` to resolve the arbitrary module names to complete paths. If your [targeted browsers](https://caniuse.com/?search=importmap) do not support `importmap`, you'll need to use the [es-module-shims](https://github.com/guybedford/es-module-shims) project. Here's how it works for Bootstrap and Popper:
|
||||||
|
|
||||||
|
<!-- eslint-skip -->
|
||||||
```html
|
```html
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user