eslint: Enable no-jquery/no-append-html.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-03 14:26:17 -07:00 committed by Tim Abbott
parent 8fb1117cef
commit b9e55f2c4d
6 changed files with 24 additions and 5 deletions

View File

@ -73,6 +73,7 @@
"no-implied-eval": "error", "no-implied-eval": "error",
"no-inner-declarations": "off", "no-inner-declarations": "off",
"no-iterator": "error", "no-iterator": "error",
"no-jquery/no-append-html": "error",
"no-jquery/no-constructor-attributes": "error", "no-jquery/no-constructor-attributes": "error",
"no-jquery/no-parse-html-literal": "error", "no-jquery/no-parse-html-literal": "error",
"no-label-var": "error", "no-label-var": "error",

View File

@ -159,7 +159,8 @@
"source-map@^0.6": "npm:source-map-js@1.0.1" "source-map@^0.6": "npm:source-map-js@1.0.1"
}, },
"patchedDependencies": { "patchedDependencies": {
"source-sans@3.46.0": "patches/source-sans@3.46.0.patch" "source-sans@3.46.0": "patches/source-sans@3.46.0.patch",
"eslint-plugin-no-jquery@2.7.0": "patches/eslint-plugin-no-jquery@2.7.0.patch"
} }
}, },
"nyc": { "nyc": {

View File

@ -0,0 +1,13 @@
diff --git a/src/rules/no-append-html.js b/src/rules/no-append-html.js
index 4dd1499f140d307433664b4aadec589473cd41fa..bcca359faf7d5a196bc58ad2fbda39992b012ec2 100644
--- a/src/rules/no-append-html.js
+++ b/src/rules/no-append-html.js
@@ -1,7 +1,7 @@
'use strict';
const utils = require( '../utils.js' );
-const methods = [ 'append', 'prepend', 'before', 'after', 'replaceWith' ];
+const methods = [ 'append', 'prepend', 'before', 'after', 'replaceWith', 'add', 'appendTo', 'prependTo' ];
function alljQueryOrEmpty( context, node ) {
if ( node.type === 'ConditionalExpression' ) {

View File

@ -8,6 +8,9 @@ overrides:
source-map@^0.6: npm:source-map-js@1.0.1 source-map@^0.6: npm:source-map-js@1.0.1
patchedDependencies: patchedDependencies:
eslint-plugin-no-jquery@2.7.0:
hash: 3o6vd4atcpz6wln5ovpbrt3cea
path: patches/eslint-plugin-no-jquery@2.7.0.patch
source-sans@3.46.0: source-sans@3.46.0:
hash: 4n7ij66tzyhzaqnxsenbilrxr4 hash: 4n7ij66tzyhzaqnxsenbilrxr4
path: patches/source-sans@3.46.0.patch path: patches/source-sans@3.46.0.patch
@ -392,7 +395,7 @@ devDependencies:
version: 2.29.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-webpack@0.13.8)(eslint@8.57.0) version: 2.29.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-webpack@0.13.8)(eslint@8.57.0)
eslint-plugin-no-jquery: eslint-plugin-no-jquery:
specifier: ^2.7.0 specifier: ^2.7.0
version: 2.7.0(eslint@8.57.0) version: 2.7.0(patch_hash=3o6vd4atcpz6wln5ovpbrt3cea)(eslint@8.57.0)
eslint-plugin-unicorn: eslint-plugin-unicorn:
specifier: ^51.0.1 specifier: ^51.0.1
version: 51.0.1(eslint@8.57.0) version: 51.0.1(eslint@8.57.0)
@ -6234,13 +6237,14 @@ packages:
- supports-color - supports-color
dev: true dev: true
/eslint-plugin-no-jquery@2.7.0(eslint@8.57.0): /eslint-plugin-no-jquery@2.7.0(patch_hash=3o6vd4atcpz6wln5ovpbrt3cea)(eslint@8.57.0):
resolution: {integrity: sha512-Aeg7dA6GTH1AcWLlBtWNzOU9efK5KpNi7b0EhBO0o0M+awyzguUUo8gF6hXGjQ9n5h8/uRtYv9zOqQkeC5CG0w==} resolution: {integrity: sha512-Aeg7dA6GTH1AcWLlBtWNzOU9efK5KpNi7b0EhBO0o0M+awyzguUUo8gF6hXGjQ9n5h8/uRtYv9zOqQkeC5CG0w==}
peerDependencies: peerDependencies:
eslint: '>=2.3.0' eslint: '>=2.3.0'
dependencies: dependencies:
eslint: 8.57.0 eslint: 8.57.0
dev: true dev: true
patched: true
/eslint-plugin-unicorn@51.0.1(eslint@8.57.0): /eslint-plugin-unicorn@51.0.1(eslint@8.57.0):
resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==} resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==}

View File

@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 246
# historical commits sharing the same major version, in which case a # historical commits sharing the same major version, in which case a
# minor version bump suffices. # minor version bump suffices.
PROVISION_VERSION = (267, 0) PROVISION_VERSION = (267, 1)

View File

@ -329,7 +329,7 @@ export function build_stream_list(force_rerender: boolean): void {
add_sidebar_li(stream_id); add_sidebar_li(stream_id);
} }
$parent.append(elems); $parent.append(elems); // eslint-disable-line no-jquery/no-append-html
} }
export function get_stream_li(stream_id: number): JQuery | undefined { export function get_stream_li(stream_id: number): JQuery | undefined {