Skip to content

Commit

Permalink
chore: fix GitHub 'Unchanged files with check annotations' reports in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jan 20, 2024
1 parent e86d4d3 commit 0e6e702
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/superset-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
working-directory: ./superset-frontend
run: |
npm run lint -- --quiet
npm run type
npm run prettier-check
- name: Build plugins packages
if: steps.check.outcome == 'failure'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/superset-websocket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: lint
working-directory: ./superset-websocket
run: npm run lint
- name: typescript checks
working-directory: ./superset-websocket
run: npm run type
- name: prettier
working-directory: ./superset-websocket
run: npm run prettier-check
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,10 @@ is configured as a pre-commit hook. There are also numerous [editor integrations
```bash
cd superset-frontend
npm ci
# run eslint checks
npm run lint
# run tsc checks
npm run type
```
If using the eslint extension with vscode, put the following in your workspace `settings.json` file:
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/contributing/hooks-and-linting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ is configured as a pre-commit hook. There are also numerous [editor integrations
```bash
cd superset-frontend
npm ci
# run eslint checks
npm run lint
# run tsc (typescript) checks
npm run type
```

If using the eslint extension with vscode, put the following in your workspace `settings.json` file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const drillBy = (targetDrillByColumn: string, isLegacy = false) => {

const verifyExpectedFormData = (
interceptedRequest: Interception,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expectedFormData: Record<string, any>,
) => {
const actualFormData = interceptedRequest.request.body?.form_data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function visitEdit(sampleDashboard = SAMPLE_DASHBOARD_1) {
}

function resetTabbedDashboard(go = false) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
cy.getDashboard('tabbed_dash').then((r: Record<string, any>) => {
const jsonMetadata = r?.json_metadata || '{}';
const metadata = JSON.parse(jsonMetadata);
Expand Down
2 changes: 2 additions & 0 deletions superset-frontend/cypress-base/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import '@cypress/code-coverage/support';
import '@applitools/eyes-cypress/commands';
import failOnConsoleError from 'cypress-fail-on-console-error';

/* eslint-disable @typescript-eslint/no-explicit-any */

require('cy-verify-downloads').addCustomCommand();

// fail on console error, allow config to override individual tests
Expand Down
29 changes: 17 additions & 12 deletions superset-frontend/cypress-base/cypress/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ export function clearAllInputs() {
});
}

const toSlicelike = ($chart: JQuery<HTMLElement>): Slice => ({
slice_id: parseInt($chart.attr('data-test-chart-id')!, 10),
form_data: {
viz_type: $chart.attr('data-test-viz-type')!,
},
});
const toSlicelike = ($chart: JQuery<HTMLElement>): Slice => {
const chartId = $chart.attr('data-test-chart-id');
const vizType = $chart.attr('data-test-viz-type');

return {
slice_id: chartId ? parseInt(chartId, 10) : null,
form_data: {
viz_type: vizType || null,
},
};
};

export function getChartGridComponent({ name, viz }: ChartSpec) {
return cy
.get(`[data-test-chart-name="${name}"]`)
.should('have.attr', 'data-test-viz-type', viz);
}

export function getChartAliasBySpec(chart: ChartSpec) {
return getChartGridComponent(chart).then($chart =>
Expand All @@ -67,12 +78,6 @@ export function getChartAliasesBySpec(charts: readonly ChartSpec[]) {
return cy.wrap(aliases);
}

export function getChartGridComponent({ name, viz }: ChartSpec) {
return cy
.get(`[data-test-chart-name="${name}"]`)
.should('have.attr', 'data-test-viz-type', viz);
}

export function waitForChartLoad(chart: ChartSpec) {
return getChartGridComponent(chart).then(gridComponent => {
const chartId = gridComponent.attr('data-test-chart-id');
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/cypress-base/cypress/utils/vizPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function isLegacyChart(vizType: string): boolean {
return !V1_PLUGINS.includes(vizType);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function isLegacyResponse(response: any): boolean {
return !response.result;
}
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/js_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ npm --version
node --version
time npm ci
time npm run lint
time npm run check
time npm run cover # this also runs the tests, so no need to 'npm run test'
time npm run build
7 changes: 4 additions & 3 deletions superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"src/setup/*"
],
"scripts": {
"_lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx .",
"_lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx,.ts,tsx",
"_prettier": "prettier './({src,spec,cypress-base,plugins,packages,.storybook}/**/*{.js,.jsx,.ts,.tsx,.css,.less,.scss,.sass}|package.json)'",
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=\"${BABEL_ENV:=production}\" webpack --mode=production --color",
"build-dev": "cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development webpack --mode=development --color",
Expand All @@ -51,8 +51,9 @@
"dev": "webpack --mode=development --color --watch",
"dev-server": "cross-env NODE_ENV=development BABEL_ENV=development node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --mode=development",
"format": "npm run _prettier -- --write",
"lint": "npm run _lint && npm run type",
"lint-fix": "npm run _lint -- --fix && npm run type",
"lint": "npm run _lint -- .",
"lint-fix": "npm run _lint -- --fix",
"lint-file": "npm run _lint",
"plugins:build": "node ./scripts/build.js",
"plugins:build-assets": "node ./scripts/copyAssets.js",
"plugins:build-storybook": "cd packages/superset-ui-demo && npm run build-storybook",
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ let scope = getPackages(glob);

if (shouldLint) {
run(`npm run lint --fix {packages,plugins}/${scope}/{src,test}`);
run(`npm run type`);
}

if (shouldCleanup) {
Expand Down

0 comments on commit 0e6e702

Please sign in to comment.