mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-05 16:42:29 +03: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:
@@ -1,6 +1,7 @@
|
||||
/* eslint-env node */
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
'use strict'
|
||||
|
||||
const browsers = {
|
||||
safariMac: {
|
||||
base: 'BrowserStack',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable import/extensions, import/no-unassigned-import */
|
||||
|
||||
import Tooltip from '../../dist/tooltip'
|
||||
import '../../dist/carousel'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-env node */
|
||||
'use strict'
|
||||
|
||||
const commonjs = require('@rollup/plugin-commonjs')
|
||||
const configRollup = require('./rollup.bundle')
|
||||
const configRollup = require('./rollup.bundle.js')
|
||||
|
||||
const config = {
|
||||
...configRollup,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-env node */
|
||||
'use strict'
|
||||
|
||||
const { babel } = require('@rollup/plugin-babel')
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-env node */
|
||||
|
||||
'use strict'
|
||||
|
||||
const path = require('node:path')
|
||||
@@ -8,7 +6,7 @@ const { babel } = require('@rollup/plugin-babel')
|
||||
const istanbul = require('rollup-plugin-istanbul')
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||
const replace = require('@rollup/plugin-replace')
|
||||
const { browsers } = require('./browsers')
|
||||
const { browsers } = require('./browsers.js')
|
||||
|
||||
const ENV = process.env
|
||||
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 { getTransitionDurationFromElement } from '../../src/util/index'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import Alert from '../../src/alert.js'
|
||||
import { getTransitionDurationFromElement } from '../../src/util/index.js'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Alert', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseComponent from '../../src/base-component'
|
||||
import { clearFixture, getFixture } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { noop } from '../../src/util'
|
||||
import BaseComponent from '../../src/base-component.js'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import { noop } from '../../src/util/index.js'
|
||||
import { clearFixture, getFixture } from '../helpers/fixture.js'
|
||||
|
||||
class DummyClass extends BaseComponent {
|
||||
constructor(element) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Button from '../../src/button'
|
||||
import { getFixture, clearFixture, jQueryMock } from '../helpers/fixture'
|
||||
import Button from '../../src/button.js'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Button', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Carousel from '../../src/carousel'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import { isRTL, noop } from '../../src/util/index'
|
||||
import Swipe from '../../src/util/swipe'
|
||||
import Carousel from '../../src/carousel.js'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import { isRTL, noop } from '../../src/util/index.js'
|
||||
import Swipe from '../../src/util/swipe.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Carousel', () => {
|
||||
const { Simulator, PointerEvent } = window
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Collapse from '../../src/collapse'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import Collapse from '../../src/collapse.js'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Collapse', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Data from '../../../src/dom/data'
|
||||
import { getFixture, clearFixture } from '../../helpers/fixture'
|
||||
import Data from '../../../src/dom/data.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('Data', () => {
|
||||
const TEST_KEY = 'bs.test'
|
||||
@@ -89,7 +89,6 @@ describe('Data', () => {
|
||||
expect(Data.get(div, TEST_KEY)).toBeNull()
|
||||
})
|
||||
|
||||
/* eslint-disable no-console */
|
||||
it('should console.error a message if called with multiple keys', () => {
|
||||
console.error = jasmine.createSpy('console.error')
|
||||
|
||||
@@ -102,5 +101,4 @@ describe('Data', () => {
|
||||
expect(console.error).toHaveBeenCalled()
|
||||
expect(Data.get(div, UNKNOWN_KEY)).toBeNull()
|
||||
})
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import EventHandler from '../../../src/dom/event-handler'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import { noop } from '../../../src/util'
|
||||
import EventHandler from '../../../src/dom/event-handler.js'
|
||||
import { noop } from '../../../src/util/index.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('EventHandler', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Manipulator from '../../../src/dom/manipulator'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import Manipulator from '../../../src/dom/manipulator.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('Manipulator', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SelectorEngine from '../../../src/dom/selector-engine'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import SelectorEngine from '../../../src/dom/selector-engine.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('SelectorEngine', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Dropdown from '../../src/dropdown'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { noop } from '../../src/util/index'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import Dropdown from '../../src/dropdown.js'
|
||||
import { noop } from '../../src/util/index.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Dropdown', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* eslint-env jquery */
|
||||
|
||||
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 { clearFixture, getFixture } from '../helpers/fixture'
|
||||
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'
|
||||
import { clearFixture, getFixture } from '../helpers/fixture.js'
|
||||
|
||||
describe('jQuery', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Modal from '../../src/modal'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import ScrollBarHelper from '../../src/util/scrollbar'
|
||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import Modal from '../../src/modal.js'
|
||||
import ScrollBarHelper from '../../src/util/scrollbar.js'
|
||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Modal', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Offcanvas from '../../src/offcanvas'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import { isVisible } from '../../src/util/index'
|
||||
import ScrollBarHelper from '../../src/util/scrollbar'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import Offcanvas from '../../src/offcanvas.js'
|
||||
import { isVisible } from '../../src/util/index.js'
|
||||
import ScrollBarHelper from '../../src/util/scrollbar.js'
|
||||
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Offcanvas', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Popover from '../../src/popover'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import Popover from '../../src/popover.js'
|
||||
import { clearFixture, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Popover', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import ScrollSpy from '../../src/scrollspy'
|
||||
|
||||
/** Test helpers */
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import ScrollSpy from '../../src/scrollspy.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('ScrollSpy', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Tab from '../../src/tab'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import Tab from '../../src/tab.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Tab', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Toast from '../../src/toast'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import Toast from '../../src/toast.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Toast', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Tooltip from '../../src/tooltip'
|
||||
import EventHandler from '../../src/dom/event-handler'
|
||||
import { noop } from '../../src/util/index'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
|
||||
import EventHandler from '../../src/dom/event-handler.js'
|
||||
import Tooltip from '../../src/tooltip.js'
|
||||
import { noop } from '../../src/util/index.js'
|
||||
import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js'
|
||||
|
||||
describe('Tooltip', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Backdrop from '../../../src/util/backdrop'
|
||||
import { getTransitionDurationFromElement } from '../../../src/util/index'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import Backdrop from '../../../src/util/backdrop.js'
|
||||
import { getTransitionDurationFromElement } from '../../../src/util/index.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
const CLASS_BACKDROP = '.modal-backdrop'
|
||||
const CLASS_NAME_FADE = 'fade'
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* Test helpers */
|
||||
|
||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture'
|
||||
import { enableDismissTrigger } from '../../../src/util/component-functions'
|
||||
import BaseComponent from '../../../src/base-component'
|
||||
import BaseComponent from '../../../src/base-component.js'
|
||||
import { enableDismissTrigger } from '../../../src/util/component-functions.js'
|
||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
class DummyClass2 extends BaseComponent {
|
||||
static get NAME() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Config from '../../../src/util/config'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import Config from '../../../src/util/config.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
class DummyConfigClass extends Config {
|
||||
static get NAME() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import FocusTrap from '../../../src/util/focustrap'
|
||||
import EventHandler from '../../../src/dom/event-handler'
|
||||
import SelectorEngine from '../../../src/dom/selector-engine'
|
||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture'
|
||||
import EventHandler from '../../../src/dom/event-handler.js'
|
||||
import SelectorEngine from '../../../src/dom/selector-engine.js'
|
||||
import FocusTrap from '../../../src/util/focustrap.js'
|
||||
import { clearFixture, createEvent, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('FocusTrap', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Util from '../../../src/util/index'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import { noop } from '../../../src/util/index'
|
||||
import * as Util from '../../../src/util/index.js'
|
||||
import { noop } from '../../../src/util/index.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('Util', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DefaultAllowlist, sanitizeHtml } from '../../../src/util/sanitizer'
|
||||
import { DefaultAllowlist, sanitizeHtml } from '../../../src/util/sanitizer.js'
|
||||
|
||||
describe('Sanitizer', () => {
|
||||
describe('sanitizeHtml', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { clearBodyAndDocument, clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import Manipulator from '../../../src/dom/manipulator'
|
||||
import ScrollBarHelper from '../../../src/util/scrollbar'
|
||||
import Manipulator from '../../../src/dom/manipulator.js'
|
||||
import ScrollBarHelper from '../../../src/util/scrollbar.js'
|
||||
import { clearBodyAndDocument, clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('ScrollBar', () => {
|
||||
let fixtureEl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import EventHandler from '../../../src/dom/event-handler'
|
||||
import Swipe from '../../../src/util/swipe'
|
||||
import { noop } from '../../../src/util'
|
||||
import EventHandler from '../../../src/dom/event-handler.js'
|
||||
import { noop } from '../../../src/util/index.js'
|
||||
import Swipe from '../../../src/util/swipe.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('Swipe', () => {
|
||||
const { Simulator, PointerEvent } = window
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture'
|
||||
import TemplateFactory from '../../../src/util/template-factory'
|
||||
import TemplateFactory from '../../../src/util/template-factory.js'
|
||||
import { clearFixture, getFixture } from '../../helpers/fixture.js'
|
||||
|
||||
describe('TemplateFactory', () => {
|
||||
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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user