Further update eslint configuration (#9474)

* Add comment to disable indent rule

* Enable no-eval rule

And only disable it in evalGlobal

* Diable indent rule in bootprefix

* Update change note

* 更新 boot.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

---------

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>
This commit is contained in:
XLBilly
2025-12-13 18:14:18 +08:00
committed by GitHub
parent 41dac42f3b
commit 65edda224b
4 changed files with 13 additions and 3 deletions

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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]]

View File

@@ -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",