]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Minor lint tweaks and rules cleanup
authorXhmikosR <xhmikosr@gmail.com>
Fri, 8 May 2020 16:19:14 +0000 (19:19 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Tue, 12 May 2020 16:21:36 +0000 (19:21 +0300)
14 files changed:
.eslintrc.json
build/.eslintrc.json
build/change-version.js
js/src/dropdown.js
js/src/modal.js
js/src/tools/sanitizer.js
js/src/util.js
js/tests/karma.conf.js
js/tests/unit/modal.js
js/tests/unit/toast.js
js/tests/unit/util.js
package.json
site/docs/4.4/assets/js/src/application.js
site/docs/4.4/assets/js/src/ie-emulation-modes-warning.js

index e97ed0b0c6f8937b1e99b5d1b018f0c93d09de31..78963350af403869a8f1addce0dd33f655284d24 100644 (file)
     "no-shadow": "off",
     "no-shadow-restricted-names": "error",
     "no-undef-init": "error",
-    "no-undefined": "error",
     "no-use-before-define": "off",
 
     // Node.js and CommonJS
     "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",
index 76e7f37b6348334aeae551261b2484708e9a7d41..e406f9f69d3dc0cd84206d4c3956fd66ae5aebdc 100644 (file)
@@ -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"
index 509cd5ff9cf42a5e3d91a8a73d9259d7642854ee..ec3c77857ad2ec52bee28bd8633784a3daf113ba 100755 (executable)
@@ -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
index 767fa52077538bcc7e683c168a4c09d4a0aee25d..d32fc74af362a35534bcaf18d526990d5d1afa7c 100644 (file)
@@ -531,5 +531,4 @@ $.fn[NAME].noConflict = () => {
   return Dropdown._jQueryInterface
 }
 
-
 export default Dropdown
index 6b80bb2f0dfde3d33f56caa9a5d710d7945ded37..5dc7cd39388362946af54dc7388d116804f32118 100644 (file)
@@ -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)
 
index f108c66d5acb5778a620e088a9305f5219c9cbba..0c3d4813b981399ad163dd7841a0215f5b27aab3 100644 (file)
@@ -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()
index 802e574e51e7e71abd021cc565822af9ca8e7b10..c8168c4758401421b8cff072806a886f0646d59f 100644 (file)
@@ -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
     }
   }
 }
index aacafe3d3b2ae71e852e9f00bc5639b642079704..fc3c7703b450c37c03e72235de289bcdb4ab2dd8 100644 (file)
@@ -1,5 +1,4 @@
 /* eslint-env node */
-/* eslint no-process-env: 0 */
 
 const path = require('path')
 const ip = require('ip')
index 95c3340328a0c3e4381f132f4d700f1b60f51060..71229a79cfe529055b45fbac4e31a3ed9321be5c 100644 (file)
@@ -826,7 +826,6 @@ $(function () {
       '</div>'
     ].join('')).appendTo('#qunit-fixture')
 
-
     $modal.on('shown.bs.modal', function () {
       assert.strictEqual($modal.scrollTop(), 0)
       done()
index 3b5da05f3f1c7b74e4f02f072994ee3e8fe791b7..89bcaf9b6452e123e09665e87b392c4fdc55e419 100644 (file)
@@ -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()
index 20c1e6ba38858c3bcae50f2d63728b1365169f7c..887bad3f857759f4db6527f6779caf0acf218e6d 100644 (file)
@@ -63,7 +63,6 @@ $(function () {
 
     Util.typeCheckConfig(namePlugin, config, defaultType)
 
-    // eslint-disable-next-line
     config.toggle = undefined
 
     Util.typeCheckConfig(namePlugin, config, defaultType)
index 0e04e8a866a170ba31277b5feb5a0db44bad3866..459a7affba8b808c670a9b91e992664fb1d16777 100644 (file)
@@ -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",
index eb22ea6ea114ecd5970ac64c135ac3325f159939..0a870261a2b58a1786cc17b01c2c6eac129acfd9 100644 (file)
@@ -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)
index 610128e2739fd889f3e6f6f72d28b90d224f8018..6e6ed9c27369e90ca09381678d955b649d4beeb9 100644 (file)
@@ -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
     }