From b9e55f2c4d281d9ccb075223c51bd0cfe9549904 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 3 Apr 2024 14:26:17 -0700 Subject: [PATCH] eslint: Enable no-jquery/no-append-html. Signed-off-by: Anders Kaseorg --- .eslintrc.json | 1 + package.json | 3 ++- patches/eslint-plugin-no-jquery@2.7.0.patch | 13 +++++++++++++ pnpm-lock.yaml | 8 ++++++-- version.py | 2 +- web/src/stream_list.ts | 2 +- 6 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 patches/eslint-plugin-no-jquery@2.7.0.patch diff --git a/.eslintrc.json b/.eslintrc.json index c4e3bf500e..5bec542a31 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -73,6 +73,7 @@ "no-implied-eval": "error", "no-inner-declarations": "off", "no-iterator": "error", + "no-jquery/no-append-html": "error", "no-jquery/no-constructor-attributes": "error", "no-jquery/no-parse-html-literal": "error", "no-label-var": "error", diff --git a/package.json b/package.json index 061330e906..8916f27d7b 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,8 @@ "source-map@^0.6": "npm:source-map-js@1.0.1" }, "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": { diff --git a/patches/eslint-plugin-no-jquery@2.7.0.patch b/patches/eslint-plugin-no-jquery@2.7.0.patch new file mode 100644 index 0000000000..47c241297f --- /dev/null +++ b/patches/eslint-plugin-no-jquery@2.7.0.patch @@ -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' ) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dd916def4d..823422f43c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ overrides: source-map@^0.6: npm:source-map-js@1.0.1 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: hash: 4n7ij66tzyhzaqnxsenbilrxr4 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) eslint-plugin-no-jquery: 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: specifier: ^51.0.1 version: 51.0.1(eslint@8.57.0) @@ -6234,13 +6237,14 @@ packages: - supports-color 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==} peerDependencies: eslint: '>=2.3.0' dependencies: eslint: 8.57.0 dev: true + patched: true /eslint-plugin-unicorn@51.0.1(eslint@8.57.0): resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==} diff --git a/version.py b/version.py index 4c092e7137..ac54b9b59d 100644 --- a/version.py +++ b/version.py @@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 246 # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = (267, 0) +PROVISION_VERSION = (267, 1) diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts index 7aef763965..e7b253c588 100644 --- a/web/src/stream_list.ts +++ b/web/src/stream_list.ts @@ -329,7 +329,7 @@ export function build_stream_list(force_rerender: boolean): void { 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 {