Browse Source

style: align EsLint and JsHint to require use-strict in global mode

rugk 1 week ago
parent
commit
0992b03847
3 changed files with 4 additions and 5 deletions
  1. 1 0
      .jshintrc
  2. 2 2
      js/eslint.config.js
  3. 1 3
      js/privatebin.js

+ 1 - 0
.jshintrc

@@ -17,6 +17,7 @@
     "quotmark": "single",
     "singleGroups": true,
     "strict": true,
+    "globalstrict": true,
     "undef": true,
     "unused": true,
     "jquery": false,

+ 2 - 2
js/eslint.config.js

@@ -1,5 +1,5 @@
 const globals = require('globals');
-const { globalIgnores } = require('eslint/config')
+const { globalIgnores } = require('eslint/config');
 
 module.exports = [globalIgnores(["./*.*js", "!./privatebin.js"]), {
     languageOptions: {
@@ -111,7 +111,7 @@ module.exports = [globalIgnores(["./*.*js", "!./privatebin.js"]), {
         yoda: 0,
 
         // Strict
-        strict: 0,
+        strict: 2,
 
         // Variables
         "init-declarations": 0,

+ 1 - 3
js/privatebin.js

@@ -1,3 +1,4 @@
+'use strict';
 /**
  * PrivateBin
  *
@@ -15,7 +16,6 @@
  * adds draghoverstart and draghoverend events to an element
  */
 function draghover(element) {
-    'use strict';
     let collection = new Set();
 
     element.addEventListener('dragenter', function (e) {
@@ -41,7 +41,6 @@ function draghover(element) {
 }
 
 window.PrivateBin = (function () {
-    'use strict';
 
     /**
      * zlib library interface
@@ -6153,7 +6152,6 @@ window.PrivateBin = (function () {
 // skip auto-initialization in test environments (Node.js)
 if (typeof module === 'undefined' || !module.exports) {
     window.addEventListener('DOMContentLoaded', function () {
-        'use strict';
         // run main controller
         window.PrivateBin.Controller.init();
     });