diff --git a/boot/boot.js b/boot/boot.js index 6ac64c5868..d49f866f96 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -8,6 +8,8 @@ On the server this file is executed directly to boot TiddlyWiki. In the browser, \*/ +/* eslint-disable @stylistic/indent */ + var _boot = (function($tw) { /*jslint node: true, browser: true */ @@ -630,7 +632,7 @@ $tw.utils.evalGlobal = function(code,context,filename,sandbox,allowGlobals) { // Compile the code into a function var fn; if($tw.browser) { - fn = window["eval"](code + "\n\n//# sourceURL=" + filename); + fn = window["eval"](code + "\n\n//# sourceURL=" + filename); // eslint-disable-line no-eval -- See https://github.com/TiddlyWiki/TiddlyWiki5/issues/6839 } else { if(sandbox){ fn = vm.runInContext(code,sandbox,filename) @@ -2801,6 +2803,8 @@ return $tw; }); +/* eslint-enable @stylistic/indent */ + if(typeof(exports) !== "undefined") { exports.TiddlyWiki = _boot; } else { diff --git a/boot/bootprefix.js b/boot/bootprefix.js index 92785d8235..c4ebc61727 100644 --- a/boot/bootprefix.js +++ b/boot/bootprefix.js @@ -12,6 +12,8 @@ See Boot.js for further details of the boot process. \*/ +/* eslint-disable @stylistic/indent */ + var _bootprefix = (function($tw) { "use strict"; @@ -114,6 +116,8 @@ return $tw; }); +/* eslint-enable @stylistic/indent */ + if(typeof(exports) === "undefined") { // Set up $tw global for the browser window.$tw = _bootprefix(window.$tw); diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/leilei332-update-eslint-config.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/leilei332-update-eslint-config.tid index 86eb60b054..59ab2bd19a 100644 --- a/editions/tw5.com/tiddlers/releasenotes/5.4.0/leilei332-update-eslint-config.tid +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/leilei332-update-eslint-config.tid @@ -4,9 +4,11 @@ release: 5.4.0 tags: $:/tags/ChangeNote change-type: enhancement change-category: developer -github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9457 +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9457 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9474 github-contributors: Leilei332 * Enforce tab indentation, semicolon * Switch off `max-classes-per-file` +* Switch on `no-eval` rule and disable it in [[$:/boot/boot.js]] with one comment * Show warning for unused variables +* Disable `@stylistic/indent` rule in [[$:/boot/boot.js]] and [[$:/boot/bootprefix.js]] diff --git a/eslint.config.mjs b/eslint.config.mjs index 2b0db2296c..b0bea34d9c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -152,7 +152,7 @@ js.configs.recommended, "no-else-return": "off", "no-empty-function": "off", "no-eq-null": "off", - "no-eval": "off", + "no-eval": "error", "no-extend-native": "off", "no-extra-bind": "off", "no-extra-label": "off",