You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2023/03/30 03:57:35 UTC

[superset] branch master updated: fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513)

This is an automated email from the ASF dual-hosted git repository.

tai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new de42c11f99 fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513)
de42c11f99 is described below

commit de42c11f99355e5fba2c2162ff180ee273801766
Author: Alex Bain <12...@users.noreply.github.com>
AuthorDate: Wed Mar 29 20:57:27 2023 -0700

    fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513)
---
 .../generators/plugin-chart/templates/package.erb             |  2 +-
 .../generators/plugin-chart/templates/src/MyChart.erb         | 11 ++++++-----
 .../plugin-chart/templates/src/plugin/controlPanel.erb        |  6 +++++-
 .../generators/plugin-chart/templates/src/types.erb           |  6 +++++-
 .../templates/test/plugin/transformProps.test.erb             |  3 ++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/package.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/package.erb
index 2cf6c0027e..ec4a13e517 100644
--- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/package.erb
+++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/package.erb
@@ -28,12 +28,12 @@
   },
   "dependencies": {},
   "peerDependencies": {
+    "@airbnb/config-babel": "^2.0.1",
     "@superset-ui/chart-controls": "*",
     "@superset-ui/core": "*",
     "react": "^16.13.1"
   },
   "devDependencies": {
-    "@airbnb/config-babel": "^2.0.1",
     "@babel/cli": "^7.16.0",
     "@types/jest": "^26.0.4",
     "jest": "^26.6.3",
diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/MyChart.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/MyChart.erb
index 1b9a2b4a9d..c5b8583de1 100644
--- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/MyChart.erb
+++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/MyChart.erb
@@ -38,14 +38,15 @@ const Styles = styled.div<<%= packageLabel %>StylesProps>`
     /* You can use your props to control CSS! */
     margin-top: 0;
     margin-bottom: ${({ theme }) => theme.gridUnit * 3}px;
-    font-size: ${({ theme, headerFontSize }) => theme.typography.sizes[headerFontSize]}px;
-    font-weight: ${({ theme, boldText }) => theme.typography.weights[boldText ? 'bold' : 'normal']};
+    font-size: ${({ theme, headerFontSize }) =>
+      theme.typography.sizes[headerFontSize]}px;
+    font-weight: ${({ theme, boldText }) =>
+      theme.typography.weights[boldText ? 'bold' : 'normal']};
   }
 
   pre {
-    height: ${({ theme, headerFontSize, height }) => (
-      height - theme.gridUnit * 12 - theme.typography.sizes[headerFontSize]
-    )}px;
+    height: ${({ theme, headerFontSize, height }) =>
+      height - theme.gridUnit * 12 - theme.typography.sizes[headerFontSize]}px;
   }
 `;
 
diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb
index 998e68b685..14fe5b479f 100644
--- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb
+++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb
@@ -17,7 +17,11 @@
  * under the License.
  */
 import { t, validateNonEmpty } from '@superset-ui/core';
-import { ControlPanelConfig, sections, sharedControls } from '@superset-ui/chart-controls';
+import {
+  ControlPanelConfig,
+  sections,
+  sharedControls,
+} from '@superset-ui/chart-controls';
 
 const config: ControlPanelConfig = {
   /**
diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/types.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/types.erb
index 509fd1121e..4666626993 100644
--- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/types.erb
+++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/types.erb
@@ -16,7 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { QueryFormData, supersetTheme, TimeseriesDataRecord } from '@superset-ui/core';
+import {
+  QueryFormData,
+  supersetTheme,
+  TimeseriesDataRecord,
+} from '@superset-ui/core';
 
 export interface <%= packageLabel %>StylesProps {
   height: number;
diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/test/plugin/transformProps.test.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/test/plugin/transformProps.test.erb
index 5081180b6b..a849b12e68 100644
--- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/test/plugin/transformProps.test.erb
+++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/test/plugin/transformProps.test.erb
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { ChartProps } from '@superset-ui/core';
+import { ChartProps, supersetTheme } from '@superset-ui/core';
 import transformProps from '../../src/plugin/transformProps';
 
 describe('<%= packageLabel %> transformProps', () => {
@@ -34,6 +34,7 @@ describe('<%= packageLabel %> transformProps', () => {
     formData,
     width: 800,
     height: 600,
+    theme: supersetTheme,
     queriesData: [{
       data: [{ name: 'Hulk', sum__num: 1<%if (chartType === 'timeseries') { %>, __timestamp: 599616000000<% } %> }],
     }],