Skip to content

Commit

Permalink
Ref: add explicit imports on our js source file
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Sep 2, 2022
1 parent 337068f commit dfdbd92
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 110 deletions.
3 changes: 1 addition & 2 deletions build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const filenameToEntity = filename => filename.replace('.js', '')

for (const file of jsFiles) {
resolvedPlugins.push({
src: file.replace('.js', ''),
src: file,
dist: file.replace('src', 'dist'),
fileName: path.basename(file),
className: filenameToEntity(path.basename(file))
Expand All @@ -51,7 +51,6 @@ const build = async plugin => {
external(source) {
// Pattern to identify local files
const pattern = /^(\.{1,2})\//

// It's not a local file, e.g a Node.js package
if (!pattern.test(source)) {
globals[source] = source
Expand Down
23 changes: 23 additions & 0 deletions js/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"es2022": true
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"overrides": [
{
"files": ["./*.js", "./src/**/*.js"],
"rules": {
"import/extensions": [
2,
{
"js": "always"
}
]
}
}
],
"extends": "../.eslintrc.json"
}
24 changes: 12 additions & 12 deletions js/index.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* --------------------------------------------------------------------------
*/

export { default as Alert } from './src/alert'
export { default as Button } from './src/button'
export { default as Carousel } from './src/carousel'
export { default as Collapse } from './src/collapse'
export { default as Dropdown } from './src/dropdown'
export { default as Modal } from './src/modal'
export { default as Offcanvas } from './src/offcanvas'
export { default as Popover } from './src/popover'
export { default as ScrollSpy } from './src/scrollspy'
export { default as Tab } from './src/tab'
export { default as Toast } from './src/toast'
export { default as Tooltip } from './src/tooltip'
export { default as Alert } from './src/alert.js'
export { default as Button } from './src/button.js'
export { default as Carousel } from './src/carousel.js'
export { default as Collapse } from './src/collapse.js'
export { default as Dropdown } from './src/dropdown.js'
export { default as Modal } from './src/modal.js'
export { default as Offcanvas } from './src/offcanvas.js'
export { default as Popover } from './src/popover.js'
export { default as ScrollSpy } from './src/scrollspy.js'
export { default as Tab } from './src/tab.js'
export { default as Toast } from './src/toast.js'
export { default as Tooltip } from './src/tooltip.js'
24 changes: 12 additions & 12 deletions js/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
* --------------------------------------------------------------------------
*/

import Alert from './src/alert'
import Button from './src/button'
import Carousel from './src/carousel'
import Collapse from './src/collapse'
import Dropdown from './src/dropdown'
import Modal from './src/modal'
import Offcanvas from './src/offcanvas'
import Popover from './src/popover'
import ScrollSpy from './src/scrollspy'
import Tab from './src/tab'
import Toast from './src/toast'
import Tooltip from './src/tooltip'
import Alert from './src/alert.js'
import Button from './src/button.js'
import Carousel from './src/carousel.js'
import Collapse from './src/collapse.js'
import Dropdown from './src/dropdown.js'
import Modal from './src/modal.js'
import Offcanvas from './src/offcanvas.js'
import Popover from './src/popover.js'
import ScrollSpy from './src/scrollspy.js'
import Tab from './src/tab.js'
import Toast from './src/toast.js'
import Tooltip from './src/tooltip.js'

export default {
Alert,
Expand Down
8 changes: 4 additions & 4 deletions js/src/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin } from './util/index'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
import { enableDismissTrigger } from './util/component-functions'
import { defineJQueryPlugin } from './util/index.js'
import EventHandler from './dom/event-handler.js'
import BaseComponent from './base-component.js'
import { enableDismissTrigger } from './util/component-functions.js'

/**
* Constants
Expand Down
8 changes: 4 additions & 4 deletions js/src/base-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* --------------------------------------------------------------------------
*/

import Data from './dom/data'
import { executeAfterTransition, getElement } from './util/index'
import EventHandler from './dom/event-handler'
import Config from './util/config'
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'

/**
* Constants
Expand Down
6 changes: 3 additions & 3 deletions js/src/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin } from './util/index'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
import { defineJQueryPlugin } from './util/index.js'
import EventHandler from './dom/event-handler.js'
import BaseComponent from './base-component.js'

/**
* Constants
Expand Down
12 changes: 6 additions & 6 deletions js/src/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
isVisible,
reflow,
triggerTransitionEnd
} from './util/index'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import SelectorEngine from './dom/selector-engine'
import Swipe from './util/swipe'
import BaseComponent from './base-component'
} 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
Expand Down
8 changes: 4 additions & 4 deletions js/src/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
getElementFromSelector,
getSelectorFromElement,
reflow
} from './util/index'
import EventHandler from './dom/event-handler'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
} 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
Expand Down
2 changes: 1 addition & 1 deletion js/src/dom/event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* --------------------------------------------------------------------------
*/

import { getjQuery } from '../util/index'
import { getjQuery } from '../util/index.js'

/**
* Constants
Expand Down
2 changes: 1 addition & 1 deletion js/src/dom/selector-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* --------------------------------------------------------------------------
*/

import { isDisabled, isVisible } from '../util/index'
import { isDisabled, isVisible } from '../util/index.js'

/**
* Constants
Expand Down
10 changes: 5 additions & 5 deletions js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
isRTL,
isVisible,
noop
} from './util/index'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
} 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
Expand Down
16 changes: 8 additions & 8 deletions js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index'
import EventHandler from './dom/event-handler'
import SelectorEngine from './dom/selector-engine'
import ScrollBarHelper from './util/scrollbar'
import BaseComponent from './base-component'
import Backdrop from './util/backdrop'
import FocusTrap from './util/focustrap'
import { enableDismissTrigger } from './util/component-functions'
import { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index.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'

/**
* Constants
Expand Down
16 changes: 8 additions & 8 deletions js/src/offcanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
getElementFromSelector,
isDisabled,
isVisible
} from './util/index'
import ScrollBarHelper from './util/scrollbar'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
import SelectorEngine from './dom/selector-engine'
import Backdrop from './util/backdrop'
import FocusTrap from './util/focustrap'
import { enableDismissTrigger } from './util/component-functions'
} 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
Expand Down
4 changes: 2 additions & 2 deletions js/src/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin } from './util/index'
import Tooltip from './tooltip'
import { defineJQueryPlugin } from './util/index.js'
import Tooltip from './tooltip.js'

/**
* Constants
Expand Down
8 changes: 4 additions & 4 deletions js/src/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index'
import EventHandler from './dom/event-handler'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
import { defineJQueryPlugin, getElement, isDisabled, isVisible } 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
Expand Down
8 changes: 4 additions & 4 deletions js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin, getElementFromSelector, getNextActiveElement, isDisabled } from './util/index'
import EventHandler from './dom/event-handler'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
import { defineJQueryPlugin, getElementFromSelector, getNextActiveElement, isDisabled } 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
Expand Down
8 changes: 4 additions & 4 deletions js/src/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* --------------------------------------------------------------------------
*/

import { defineJQueryPlugin, reflow } from './util/index'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
import { enableDismissTrigger } from './util/component-functions'
import { defineJQueryPlugin, reflow } from './util/index.js'
import EventHandler from './dom/event-handler.js'
import BaseComponent from './base-component.js'
import { enableDismissTrigger } from './util/component-functions.js'

/**
* Constants
Expand Down
12 changes: 6 additions & 6 deletions js/src/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import * as Popper from '@popperjs/core'
import { defineJQueryPlugin, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index'
import { DefaultAllowlist } from './util/sanitizer'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import BaseComponent from './base-component'
import TemplateFactory from './util/template-factory'
import { defineJQueryPlugin, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js'
import { DefaultAllowlist } from './util/sanitizer.js'
import EventHandler from './dom/event-handler.js'
import Manipulator from './dom/manipulator.js'
import BaseComponent from './base-component.js'
import TemplateFactory from './util/template-factory.js'

/**
* Constants
Expand Down
6 changes: 3 additions & 3 deletions js/src/util/backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* --------------------------------------------------------------------------
*/

import EventHandler from '../dom/event-handler'
import { execute, executeAfterTransition, getElement, reflow } from './index'
import Config from './config'
import EventHandler from '../dom/event-handler.js'
import { execute, executeAfterTransition, getElement, reflow } from './index.js'
import Config from './config.js'

/**
* Constants
Expand Down
4 changes: 2 additions & 2 deletions js/src/util/component-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* --------------------------------------------------------------------------
*/

import EventHandler from '../dom/event-handler'
import { getElementFromSelector, isDisabled } from './index'
import EventHandler from '../dom/event-handler.js'
import { getElementFromSelector, isDisabled } from './index.js'

const enableDismissTrigger = (component, method = 'hide') => {
const clickEvent = `click.dismiss${component.EVENT_KEY}`
Expand Down
4 changes: 2 additions & 2 deletions js/src/util/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* --------------------------------------------------------------------------
*/

import { isElement, toType } from './index'
import Manipulator from '../dom/manipulator'
import { isElement, toType } from './index.js'
import Manipulator from '../dom/manipulator.js'

/**
* Class definition
Expand Down
6 changes: 3 additions & 3 deletions js/src/util/focustrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* --------------------------------------------------------------------------
*/

import EventHandler from '../dom/event-handler'
import SelectorEngine from '../dom/selector-engine'
import Config from './config'
import EventHandler from '../dom/event-handler.js'
import SelectorEngine from '../dom/selector-engine.js'
import Config from './config.js'

/**
* Constants
Expand Down
6 changes: 3 additions & 3 deletions js/src/util/scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* --------------------------------------------------------------------------
*/

import SelectorEngine from '../dom/selector-engine'
import Manipulator from '../dom/manipulator'
import { isElement } from './index'
import SelectorEngine from '../dom/selector-engine.js'
import Manipulator from '../dom/manipulator.js'
import { isElement } from './index.js'

/**
* Constants
Expand Down
Loading

0 comments on commit dfdbd92

Please sign in to comment.