You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2023/12/07 23:06:56 UTC
(superset) branch reduce-innerHTML-use updated: Wave 3
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch reduce-innerHTML-use
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/reduce-innerHTML-use by this push:
new cb0eb39dad Wave 3
cb0eb39dad is described below
commit cb0eb39dad0d589322c8fe2ea7ec30c7b9739a53
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Dec 7 16:06:44 2023 -0700
Wave 3
---
superset-frontend/.eslintrc.js | 4 +++-
.../packages/superset-ui-core/test/chart/components/reactify.test.tsx | 2 +-
superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js | 2 +-
superset-frontend/plugins/legacy-plugin-chart-heatmap/src/Heatmap.js | 3 +--
superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js | 2 +-
5 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 048f0f1213..60a918cf31 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -42,7 +42,6 @@ module.exports = {
'prettier',
'prettier/react',
'plugin:react-hooks/recommended',
- 'plugin:no-unsanitized/DOM',
],
parser: '@babel/eslint-parser',
parserOptions: {
@@ -74,6 +73,7 @@ module.exports = {
'file-progress',
'theme-colors',
'translation-vars',
+ 'no-unsanitized',
],
overrides: [
{
@@ -128,6 +128,8 @@ module.exports = {
'no-prototype-builtins': 0,
'no-restricted-properties': 0,
'no-shadow': 0, // re-enable up for discussion
+ 'no-unsanitized/method': 'error',
+ 'no-unsanitized/property': 'error',
'no-use-before-define': 0, // disabled temporarily
'padded-blocks': 0,
'prefer-arrow-callback': 0,
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
index a1086c14f9..5ec3c3036f 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
@@ -27,7 +27,7 @@ describe('reactify(renderFn)', () => {
const renderFn: RenderFuncType<{ content?: string }> = jest.fn(
(element, props) => {
const container = element;
- container.innerHTML = '';
+ container.replaceChildren();
const child = document.createElement('b');
// TODO: make this safer
// eslint-disable-next-line no-unsanitized/property
diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js b/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js
index d0aed798de..3fda51887e 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-chord/src/Chord.js
@@ -38,7 +38,7 @@ const propTypes = {
function Chord(element, props) {
const { data, width, height, numberFormat, colorScheme, sliceId } = props;
- element.innerHTML = '';
+ element.replaceChildren();
const div = d3.select(element);
div.classed('superset-legacy-chart-chord', true);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/Heatmap.js b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/Heatmap.js
index a6967301c6..d455f32b98 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/Heatmap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/Heatmap.js
@@ -211,8 +211,7 @@ function Heatmap(element, props) {
return d3.scale.ordinal().domain(domain).range(d3.range(domain.length));
}
- // eslint-disable-next-line no-param-reassign
- element.innerHTML = '';
+ element.replaceChildren();
const matrix = {};
adjustMargins();
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js
index 81287b18ec..79bd649b20 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js
@@ -305,7 +305,7 @@ function nvd3Vis(element, props) {
const isExplore = document.querySelector('#explorer-container') !== null;
const container = element;
- container.innerHTML = '';
+ container.removeChildren();
const activeAnnotationLayers = annotationLayers.filter(layer => layer.show);
// Search for the chart id in a parent div from the nvd3 chart