]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Change remaining JS files to comply with ESLint config.
authorBardi Harborow <bardi@bardiharborow.com>
Sat, 31 Dec 2016 05:25:26 +0000 (16:25 +1100)
committerBardi Harborow <bardi@bardiharborow.com>
Sat, 31 Dec 2016 05:49:15 +0000 (16:49 +1100)
Gruntfile.js
docs/assets/js/ie-emulation-modes-warning.js
docs/assets/js/ie10-viewport-bug-workaround.js
docs/assets/js/src/application.js
grunt/bs-sass-compile/libsass.js
grunt/bs-sass-compile/sass.js
grunt/change-version.js

index b707034f6c2bf0e05ac67d00050625c20d9c8b7a..d699e4c8e4c387e0bd99707dcb8c47c06fd327f7 100644 (file)
@@ -7,26 +7,25 @@
  */
 
 module.exports = function (grunt) {
-  'use strict';
+  'use strict'
 
   // Force use of Unix newlines
-  grunt.util.linefeed = '\n';
+  grunt.util.linefeed = '\n'
 
   RegExp.quote = function (string) {
-    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
-  };
+    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
+  }
 
-  var fs = require('fs');
-  var path = require('path');
-  var isTravis = require('is-travis');
+  var path = require('path')
+  var isTravis = require('is-travis')
 
-  var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' });
+  var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' })
 
   Object.keys(configBridge.paths).forEach(function (key) {
     configBridge.paths[key].forEach(function (val, i, arr) {
-      arr[i] = path.join('./docs', val);
-    });
-  });
+      arr[i] = path.join('./docs', val)
+    })
+  })
 
   // Project configuration.
   grunt.initConfig({
@@ -100,7 +99,7 @@ module.exports = function (grunt) {
       options: {
         // Custom function to remove all export and import statements
         process: function (src) {
-          return src.replace(/^(export|import).*/gm, '');
+          return src.replace(/^(export|import).*/gm, '')
         }
       },
       bootstrap: {
@@ -275,83 +274,83 @@ module.exports = function (grunt) {
       }
     }
 
-  });
+  })
 
 
   // These plugins provide necessary tasks.
   require('load-grunt-tasks')(grunt, { scope: 'devDependencies',
     // Exclude Sass compilers. We choose the one to load later on.
-    pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] });
-  require('time-grunt')(grunt);
+    pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] })
+  require('time-grunt')(grunt)
 
   // Docs HTML validation task
-  grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint', 'exec:htmlhint']);
+  grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint', 'exec:htmlhint'])
 
   var runSubset = function (subset) {
-    return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset;
-  };
+    return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset
+  }
   var isUndefOrNonZero = function (val) {
-    return val === undefined || val !== '0';
-  };
+    return val === undefined || val !== '0'
+  }
 
   // Test task.
-  var testSubtasks = [];
+  var testSubtasks = []
   // Skip core tests if running a different subset of the test suite
   if (runSubset('core') &&
     // Skip core tests if this is a Savage build
     process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') {
-    testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'qunit', 'docs']);
+    testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'qunit', 'docs'])
   }
   // Skip HTML validation if running a different subset of the test suite
   if (runSubset('validate-html') &&
       isTravis &&
       // Skip HTML5 validator when [skip validator] is in the commit message
       isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR)) {
-    testSubtasks.push('validate-html');
+    testSubtasks.push('validate-html')
   }
   // Only run Sauce Labs tests if there's a Sauce access key
   if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
       // Skip Sauce if running a different subset of the test suite
       runSubset('sauce-js-unit')) {
-    testSubtasks = testSubtasks.concat(['dist', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']);
+    testSubtasks = testSubtasks.concat(['dist', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs'])
     // Skip Sauce on Travis when [skip sauce] is in the commit message
     if (isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
-      testSubtasks.push('connect');
-      testSubtasks.push('saucelabs-qunit');
+      testSubtasks.push('connect')
+      testSubtasks.push('saucelabs-qunit')
     }
   }
-  grunt.registerTask('test', testSubtasks);
+  grunt.registerTask('test', testSubtasks)
 
   // JS distribution task.
-  grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'exec:uglify']);
+  grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'exec:uglify'])
 
   grunt.registerTask('test-scss', ['exec:scss-lint']);
 
   // CSS distribution task.
   // Supported Compilers: sass (Ruby) and libsass.
   (function (sassCompilerName) {
-    require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt);
-  })(process.env.TWBS_SASS || 'libsass');
+    require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt)
+  }(process.env.TWBS_SASS || 'libsass'))
   // grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
-  grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
+  grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs'])
 
-  grunt.registerTask('dist-css', ['sass-compile', 'exec:postcss', 'exec:clean-css', 'exec:clean-css-docs']);
+  grunt.registerTask('dist-css', ['sass-compile', 'exec:postcss', 'exec:clean-css', 'exec:clean-css-docs'])
 
   // Full distribution task.
-  grunt.registerTask('dist', ['clean:dist', 'dist-css', 'dist-js']);
+  grunt.registerTask('dist', ['clean:dist', 'dist-css', 'dist-js'])
 
   // Default task.
-  grunt.registerTask('default', ['clean:dist', 'test']);
+  grunt.registerTask('default', ['clean:dist', 'test'])
 
   // Docs task.
-  grunt.registerTask('docs-css', ['exec:clean-css-docs', 'exec:postcss-docs']);
-  grunt.registerTask('lint-docs-css', ['exec:scss-lint-docs']);
-  grunt.registerTask('docs-js', ['exec:uglify-docs']);
-  grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']);
-  grunt.registerTask('docs-github', ['jekyll:github']);
+  grunt.registerTask('docs-css', ['exec:clean-css-docs', 'exec:postcss-docs'])
+  grunt.registerTask('lint-docs-css', ['exec:scss-lint-docs'])
+  grunt.registerTask('docs-js', ['exec:uglify-docs'])
+  grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs'])
+  grunt.registerTask('docs-github', ['jekyll:github'])
 
-  grunt.registerTask('prep-release', ['dist', 'docs', 'docs-github', 'compress']);
+  grunt.registerTask('prep-release', ['dist', 'docs', 'docs-github', 'compress'])
 
   // Publish to GitHub
-  grunt.registerTask('publish', ['buildcontrol:pages']);
-};
+  grunt.registerTask('publish', ['buildcontrol:pages'])
+}
index 452c1268f6d34bbc21d34362c38fcb8870dc643e..7996b9e3402f654c5adbabf42a004c229758f49d 100644 (file)
@@ -10,7 +10,7 @@
  */
 // Intended to prevent false-positive bug reports about Bootstrap not working properly in old versions of IE due to folks testing using IE's unreliable emulation modes.
 (function () {
-  'use strict';
+  'use strict'
 
   function emulatedIEMajorVersion() {
     var groups = /MSIE ([0-9.]+)/.exec(window.navigator.userAgent)
@@ -49,4 +49,4 @@
   if (emulated !== nonEmulated) {
     window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
   }
-})();
+}())
index 0aecf6b305bbd19936dbfd0e069a53401c986caa..36afc46b85897d552d80d14cf8685eb3628c80cb 100644 (file)
@@ -9,7 +9,7 @@
 // https://getbootstrap.com/getting-started/#support-ie10-width
 
 (function () {
-  'use strict';
+  'use strict'
 
   if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
     var msViewportStyle = document.createElement('style')
@@ -21,4 +21,4 @@
     document.head.appendChild(msViewportStyle)
   }
 
-})();
+}())
index 529b0c1b895fbfa230480a62d55db58eab9dce58..fee96113d708042fd1ca5b31254714a378b7ce78 100644 (file)
@@ -12,8 +12,8 @@
 
 /* global Clipboard, anchors */
 
-!function ($) {
-  'use strict';
+(function ($) {
+  'use strict'
 
   $(function () {
 
 
   })
 
-}(jQuery)
+}(jQuery))
 
 ;(function () {
-  'use strict';
+  'use strict'
 
-  anchors.options.placement = 'left';
+  anchors.options.placement = 'left'
   anchors.add('.bd-content > h1, .bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')
-})();
+}())
index 3abfbd6d0d364a6f813668196d3e624c58fa23db..06b9dcc0cdadb53ad80b646c20237e57b41cb642 100644 (file)
@@ -28,6 +28,6 @@ module.exports = function configureLibsass(grunt) {
         }
       }
     }
-  });
-  grunt.loadNpmTasks('grunt-sass');
-};
+  })
+  grunt.loadNpmTasks('grunt-sass')
+}
index 665212e0cb2e8664eb25491cd40074e9bf36c87b..dadd93d40522e58bffb6fdbd1e9c273eafe24731 100644 (file)
@@ -9,7 +9,7 @@ module.exports = function configureRubySass(grunt) {
     style: 'expanded',
     trace: true,
     bundleExec: true
-  };
+  }
   grunt.config.merge({
     sass: {
       core: {
@@ -32,6 +32,6 @@ module.exports = function configureRubySass(grunt) {
         }
       }
     }
-  });
-  grunt.loadNpmTasks('grunt-contrib-sass');
-};
+  })
+  grunt.loadNpmTasks('grunt-contrib-sass')
+}
index 4ad5825f28c4c4f15a0fa4466f1b1c29481966af..12794f60875f0f01856d4ebdf8577ce20d94e6e8 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env node
-'use strict';
+
+'use strict'
 
 /*!
  * Script to update version number references in the project.
@@ -7,87 +8,90 @@
  * Copyright 2015 Twitter, Inc.
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
-var fs = require('fs');
-var path = require('path');
-var sh = require('shelljs');
-sh.config.fatal = true;
-var sed = sh.sed;
+
+/* global Set */
+
+var fs = require('fs')
+var path = require('path')
+var sh = require('shelljs')
+sh.config.fatal = true
+var sed = sh.sed
 
 // Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
 RegExp.quote = function (string) {
-  return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
-};
+  return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&')
+}
 RegExp.quoteReplacement = function (string) {
-  return string.replace(/[$]/g, '$$');
-};
+  return string.replace(/[$]/g, '$$')
+}
 
-var DRY_RUN = false;
+var DRY_RUN = false
 
 function walkAsync(directory, excludedDirectories, fileCallback, errback) {
   if (excludedDirectories.has(path.parse(directory).base)) {
-    return;
+    return
   }
   fs.readdir(directory, function (err, names) {
     if (err) {
-      errback(err);
-      return;
+      errback(err)
+      return
     }
     names.forEach(function (name) {
-      var filepath = path.join(directory, name);
+      var filepath = path.join(directory, name)
       fs.lstat(filepath, function (err, stats) {
         if (err) {
-          process.nextTick(errback, err);
-          return;
+          process.nextTick(errback, err)
+          return
         }
         if (stats.isSymbolicLink()) {
-          return;
+          return
         }
         else if (stats.isDirectory()) {
-          process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback);
+          process.nextTick(walkAsync, filepath, excludedDirectories, fileCallback, errback)
         }
         else if (stats.isFile()) {
-          process.nextTick(fileCallback, filepath);
+          process.nextTick(fileCallback, filepath)
         }
-      });
-    });
-  });
+      })
+    })
+  })
 }
 
 function replaceRecursively(directory, excludedDirectories, allowedExtensions, original, replacement) {
-  original = new RegExp(RegExp.quote(original), 'g');
-  replacement = RegExp.quoteReplacement(replacement);
+  original = new RegExp(RegExp.quote(original), 'g')
+  replacement = RegExp.quoteReplacement(replacement)
   var updateFile = !DRY_RUN ? function (filepath) {
     if (allowedExtensions.has(path.parse(filepath).ext)) {
-      sed('-i', original, replacement, filepath);
+      sed('-i', original, replacement, filepath)
     }
   } : function (filepath) {
     if (allowedExtensions.has(path.parse(filepath).ext)) {
-      console.log('FILE: ' + filepath);
+      console.log('FILE: ' + filepath)
     }
     else {
-      console.log('EXCLUDED:' + filepath);
+      console.log('EXCLUDED:' + filepath)
     }
-  };
+  }
   walkAsync(directory, excludedDirectories, updateFile, function (err) {
-    console.error('ERROR while traversing directory!:');
-    console.error(err);
-    process.exit(1);
-  });
+    console.error('ERROR while traversing directory!:')
+    console.error(err)
+    process.exit(1)
+  })
 }
 
 function main(args) {
   if (args.length !== 2) {
-    console.error('USAGE: change-version old_version new_version');
-    console.error('Got arguments:', args);
-    process.exit(1);
+    console.error('USAGE: change-version old_version new_version')
+    console.error('Got arguments:', args)
+    process.exit(1)
   }
-  var oldVersion = args[0];
-  var newVersion = args[1];
+  var oldVersion = args[0]
+  var newVersion = args[1]
   var EXCLUDED_DIRS = new Set([
     '.git',
     'node_modules',
     'vendor'
-  ]);
+  ])
   var INCLUDED_EXTENSIONS = new Set([
     // This extension whitelist is how we avoid modifying binary files
     '',
@@ -99,8 +103,8 @@ function main(args) {
     '.scss',
     '.txt',
     '.yml'
-  ]);
-  replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion);
+  ])
+  replaceRecursively('.', EXCLUDED_DIRS, INCLUDED_EXTENSIONS, oldVersion, newVersion)
 }
 
-main(process.argv.slice(2));
+main(process.argv.slice(2))