fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513)

This commit is contained in:
Alex Bain 2023-03-29 20:57:27 -07:00 committed by GitHub
parent f2be53dd53
commit de42c11f99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -28,12 +28,12 @@
}, },
"dependencies": {}, "dependencies": {},
"peerDependencies": { "peerDependencies": {
"@airbnb/config-babel": "^2.0.1",
"@superset-ui/chart-controls": "*", "@superset-ui/chart-controls": "*",
"@superset-ui/core": "*", "@superset-ui/core": "*",
"react": "^16.13.1" "react": "^16.13.1"
}, },
"devDependencies": { "devDependencies": {
"@airbnb/config-babel": "^2.0.1",
"@babel/cli": "^7.16.0", "@babel/cli": "^7.16.0",
"@types/jest": "^26.0.4", "@types/jest": "^26.0.4",
"jest": "^26.6.3", "jest": "^26.6.3",

View File

@ -38,14 +38,15 @@ const Styles = styled.div<<%= packageLabel %>StylesProps>`
/* You can use your props to control CSS! */ /* You can use your props to control CSS! */
margin-top: 0; margin-top: 0;
margin-bottom: ${({ theme }) => theme.gridUnit * 3}px; margin-bottom: ${({ theme }) => theme.gridUnit * 3}px;
font-size: ${({ theme, headerFontSize }) => theme.typography.sizes[headerFontSize]}px; font-size: ${({ theme, headerFontSize }) =>
font-weight: ${({ theme, boldText }) => theme.typography.weights[boldText ? 'bold' : 'normal']}; theme.typography.sizes[headerFontSize]}px;
font-weight: ${({ theme, boldText }) =>
theme.typography.weights[boldText ? 'bold' : 'normal']};
} }
pre { pre {
height: ${({ theme, headerFontSize, height }) => ( height: ${({ theme, headerFontSize, height }) =>
height - theme.gridUnit * 12 - theme.typography.sizes[headerFontSize] height - theme.gridUnit * 12 - theme.typography.sizes[headerFontSize]}px;
)}px;
} }
`; `;

View File

@ -17,7 +17,11 @@
* under the License. * under the License.
*/ */
import { t, validateNonEmpty } from '@superset-ui/core'; 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 = { const config: ControlPanelConfig = {
/** /**

View File

@ -16,7 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { QueryFormData, supersetTheme, TimeseriesDataRecord } from '@superset-ui/core'; import {
QueryFormData,
supersetTheme,
TimeseriesDataRecord,
} from '@superset-ui/core';
export interface <%= packageLabel %>StylesProps { export interface <%= packageLabel %>StylesProps {
height: number; height: number;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { ChartProps } from '@superset-ui/core'; import { ChartProps, supersetTheme } from '@superset-ui/core';
import transformProps from '../../src/plugin/transformProps'; import transformProps from '../../src/plugin/transformProps';
describe('<%= packageLabel %> transformProps', () => { describe('<%= packageLabel %> transformProps', () => {
@ -34,6 +34,7 @@ describe('<%= packageLabel %> transformProps', () => {
formData, formData,
width: 800, width: 800,
height: 600, height: 600,
theme: supersetTheme,
queriesData: [{ queriesData: [{
data: [{ name: 'Hulk', sum__num: 1<%if (chartType === 'timeseries') { %>, __timestamp: 599616000000<% } %> }], data: [{ name: 'Hulk', sum__num: 1<%if (chartType === 'timeseries') { %>, __timestamp: 599616000000<% } %> }],
}], }],