1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-10 23:54:08 +02:00

Tweak ESLint rules.

This commit is contained in:
XhmikosR
2017-07-27 13:39:55 +03:00
parent 0492c3a4cd
commit ef8c77d8dc
21 changed files with 39 additions and 40 deletions

View File

@@ -443,7 +443,7 @@ const Carousel = (($) => {
if (typeof config === 'number') {
data.to(config)
} else if (typeof action === 'string') {
if (data[action] === undefined) {
if (typeof data[action] === 'undefined') {
throw new Error(`No method named "${action}"`)
}
data[action]()

View File

@@ -343,7 +343,7 @@ const Collapse = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -204,7 +204,7 @@ const Dropdown = (($) => {
_getConfig(config) {
const elementData = $(this._element).data()
if (elementData.placement !== undefined) {
if (typeof elementData.placement !== 'undefined') {
elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]
}
@@ -287,7 +287,7 @@ const Dropdown = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -507,7 +507,7 @@ const Modal = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config](relatedTarget)

View File

@@ -162,7 +162,7 @@ const Popover = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -231,7 +231,7 @@ const ScrollSpy = (($) => {
for (let i = this._offsets.length; i--;) {
const isActiveTarget = this._activeTarget !== this._targets[i]
&& scrollTop >= this._offsets[i]
&& (this._offsets[i + 1] === undefined ||
&& (typeof this._offsets[i + 1] === 'undefined' ||
scrollTop < this._offsets[i + 1])
if (isActiveTarget) {
@@ -246,6 +246,7 @@ const ScrollSpy = (($) => {
this._clear()
let queries = this._selector.split(',')
// eslint-disable-next-line arrow-body-style
queries = queries.map((selector) => {
return `${selector}[data-target="${target}"],` +
`${selector}[href="${target}"]`
@@ -287,7 +288,7 @@ const ScrollSpy = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -238,7 +238,7 @@ const Tab = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -698,7 +698,7 @@ const Tooltip = (($) => {
}
if (typeof config === 'string') {
if (data[config] === undefined) {
if (typeof data[config] === 'undefined') {
throw new Error(`No method named "${config}"`)
}
data[config]()

View File

@@ -42,7 +42,7 @@ const Util = (($) => {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
}
return undefined
return undefined // eslint-disable-line no-undefined
}
}
}
@@ -55,7 +55,7 @@ const Util = (($) => {
const el = document.createElement('bootstrap')
for (const name in TransitionEndEvent) {
if (el.style[name] !== undefined) {
if (typeof el.style[name] !== 'undefined') {
return {
end: TransitionEndEvent[name]
}
@@ -138,7 +138,7 @@ const Util = (($) => {
typeCheckConfig(componentName, config, configTypes) {
for (const property in configTypes) {
if (configTypes.hasOwnProperty(property)) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
const expectedTypes = configTypes[property]
const value = config[property]
const valueType = value && isElement(value) ?