aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-05-08 19:19:14 +0300
committerXhmikosR <[email protected]>2020-05-12 19:21:36 +0300
commiteb720f20ff3f49f58ee35b758f4783a3d1e858b2 (patch)
tree994d3668f071c2860d698a145aec0012ac171efa
parent53eace04dfe5bdb128771f2a765c6824aa5b4bbf (diff)
downloadbootstrap-eb720f20ff3f49f58ee35b758f4783a3d1e858b2.tar.xz
bootstrap-eb720f20ff3f49f58ee35b758f4783a3d1e858b2.zip
Minor lint tweaks and rules cleanup
-rw-r--r--.eslintrc.json2
-rw-r--r--build/.eslintrc.json1
-rwxr-xr-xbuild/change-version.js4
-rw-r--r--js/src/dropdown.js1
-rw-r--r--js/src/modal.js1
-rw-r--r--js/src/tools/sanitizer.js4
-rw-r--r--js/src/util.js2
-rw-r--r--js/tests/karma.conf.js1
-rw-r--r--js/tests/unit/modal.js1
-rw-r--r--js/tests/unit/toast.js1
-rw-r--r--js/tests/unit/util.js1
-rw-r--r--package.json4
-rw-r--r--site/docs/4.4/assets/js/src/application.js2
-rw-r--r--site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js2
14 files changed, 9 insertions, 18 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index e97ed0b0c..78963350a 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -102,7 +102,6 @@
"no-shadow": "off",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
- "no-undefined": "error",
"no-use-before-define": "off",
// Node.js and CommonJS
@@ -112,7 +111,6 @@
"no-mixed-requires": "error",
"no-new-require": "error",
"no-path-concat": "error",
- "no-process-env": "error",
"no-process-exit": "error",
"no-restricted-modules": "error",
"no-sync": "error",
diff --git a/build/.eslintrc.json b/build/.eslintrc.json
index 76e7f37b6..e406f9f69 100644
--- a/build/.eslintrc.json
+++ b/build/.eslintrc.json
@@ -12,7 +12,6 @@
"func-style": "off",
"no-console": "off",
"no-magic-numbers": "off",
- "no-process-env": "off",
"no-process-exit": "off",
"no-sync": "off",
"spaced-comment": "off"
diff --git a/build/change-version.js b/build/change-version.js
index 509cd5ff9..ec3c77857 100755
--- a/build/change-version.js
+++ b/build/change-version.js
@@ -17,11 +17,11 @@ sh.config.fatal = true
// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
function regExpQuote(string) {
- return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
+ return string.replace(/[$()*+.?[\\\]^{|}-]/g, '\\$&')
}
function regExpQuoteReplacement(string) {
- return string.replace(/[$]/g, '$$')
+ return string.replace(/\$/g, '$$')
}
const DRY_RUN = false
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index 767fa5207..d32fc74af 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -531,5 +531,4 @@ $.fn[NAME].noConflict = () => {
return Dropdown._jQueryInterface
}
-
export default Dropdown
diff --git a/js/src/modal.js b/js/src/modal.js
index 6b80bb2f0..5dc7cd393 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -179,7 +179,6 @@ class Modal {
$(this._element).off(EVENT_CLICK_DISMISS)
$(this._dialog).off(EVENT_MOUSEDOWN_DISMISS)
-
if (transition) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
diff --git a/js/src/tools/sanitizer.js b/js/src/tools/sanitizer.js
index f108c66d5..0c3d4813b 100644
--- a/js/src/tools/sanitizer.js
+++ b/js/src/tools/sanitizer.js
@@ -57,14 +57,14 @@ export const DefaultWhitelist = {
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
-const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
+const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
-const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
+const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i
function allowedAttribute(attr, allowedAttributeList) {
const attrName = attr.nodeName.toLowerCase()
diff --git a/js/src/util.js b/js/src/util.js
index 802e574e5..c8168c475 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -34,7 +34,7 @@ function getSpecialTransitionEndEvent() {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
}
- return undefined // eslint-disable-line no-undefined
+ return undefined
}
}
}
diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js
index aacafe3d3..fc3c7703b 100644
--- a/js/tests/karma.conf.js
+++ b/js/tests/karma.conf.js
@@ -1,5 +1,4 @@
/* eslint-env node */
-/* eslint no-process-env: 0 */
const path = require('path')
const ip = require('ip')
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 95c334032..71229a79c 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -826,7 +826,6 @@ $(function () {
'</div>'
].join('')).appendTo('#qunit-fixture')
-
$modal.on('shown.bs.modal', function () {
assert.strictEqual($modal.scrollTop(), 0)
done()
diff --git a/js/tests/unit/toast.js b/js/tests/unit/toast.js
index 3b5da05f3..89bcaf9b6 100644
--- a/js/tests/unit/toast.js
+++ b/js/tests/unit/toast.js
@@ -208,7 +208,6 @@ $(function () {
.bootstrapToast('show')
})
-
QUnit.test('should close toast when close element with data-dismiss attribute is set', function (assert) {
assert.expect(2)
var done = assert.async()
diff --git a/js/tests/unit/util.js b/js/tests/unit/util.js
index 20c1e6ba3..887bad3f8 100644
--- a/js/tests/unit/util.js
+++ b/js/tests/unit/util.js
@@ -63,7 +63,6 @@ $(function () {
Util.typeCheckConfig(namePlugin, config, defaultType)
- // eslint-disable-next-line
config.toggle = undefined
Util.typeCheckConfig(namePlugin, config, defaultType)
diff --git a/package.json b/package.json
index 0e04e8a86..459a7affb 100644
--- a/package.json
+++ b/package.json
@@ -47,8 +47,8 @@
"js-compile-plugins": "node build/build-plugins.js",
"js-compile-plugins-coverage": "cross-env NODE_ENV=test node build/build-plugins.js",
"js-lint": "npm-run-all --continue-on-error --parallel js-lint-*",
- "js-lint-main": "eslint --cache --cache-location .cache/.eslintcache js/src js/tests build/",
- "js-lint-docs": "eslint --cache --cache-location .cache/.eslintcache site/",
+ "js-lint-main": "eslint --report-unused-disable-directives --cache --cache-location .cache/.eslintcache js/src js/tests build/",
+ "js-lint-docs": "eslint --report-unused-disable-directives --cache --cache-location .cache/.eslintcache site/",
"js-minify": "npm-run-all --parallel js-minify-main js-minify-docs",
"js-minify-main": "npm-run-all js-minify-standalone js-minify-bundle",
"js-minify-standalone": "terser --compress typeofs=false --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",
diff --git a/site/docs/4.4/assets/js/src/application.js b/site/docs/4.4/assets/js/src/application.js
index eb22ea6ea..0a870261a 100644
--- a/site/docs/4.4/assets/js/src/application.js
+++ b/site/docs/4.4/assets/js/src/application.js
@@ -90,7 +90,7 @@
})
clipboard.on('error', function (e) {
- var modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-'
+ var modifierKey = /mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-'
var fallbackMsg = 'Press ' + modifierKey + 'C to copy'
$(e.trigger)
diff --git a/site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js b/site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js
index 610128e27..6e6ed9c27 100644
--- a/site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js
+++ b/site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js
@@ -7,7 +7,7 @@
'use strict'
function emulatedIEMajorVersion() {
- var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
+ var groups = /MSIE ([\d.]+)/.exec(window.navigator.userAgent)
if (groups === null) {
return null
}