Skip to content

Commit

Permalink
Enable no unused locals to disable deepscan
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Nov 1, 2022
1 parent fc0cab5 commit f49215e
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 41 deletions.
1 change: 1 addition & 0 deletions code/addons/actions/src/containers/ActionLogger/index.tsx
Expand Up @@ -26,6 +26,7 @@ const safeDeepEqual = (a: any, b: any): boolean => {
};

export default class ActionLogger extends Component<ActionLoggerProps, ActionLoggerState> {
// @ts-expect-error Unused, possibly remove, leaving, because it could be accessed even though it is private
private mounted: boolean;

constructor(props: ActionLoggerProps) {
Expand Down
10 changes: 1 addition & 9 deletions code/addons/toolbars/src/components/ToolbarMenuList.tsx
@@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useGlobals } from '@storybook/api';
import { deprecate } from '@storybook/client-logger';
Expand All @@ -10,14 +10,6 @@ import { getSelectedIcon, getSelectedTitle } from '../utils/get-selected';
import type { ToolbarMenuProps } from '../types';
import { ToolbarMenuListItem } from './ToolbarMenuListItem';

type ItemProps = {
left?: ReactNode;
title?: ReactNode;
right?: ReactNode;
active?: boolean;
onClick?: () => void;
};

type ToolbarMenuListProps = ToolbarMenuProps & WithKeyboardCycleProps;

export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
Expand Down
Expand Up @@ -304,10 +304,7 @@ describe('RendererFactory', () => {
global.document.getElementById('root').appendChild(global.document.createElement('👾'));

expect(global.document.getElementById('root').innerHTML).toContain('Canvas 🖼');
const render = await rendererFactory.getRendererInstance(
'my-story-in-docs',
rootDocstargetDOMNode
);
await rendererFactory.getRendererInstance('my-story-in-docs', rootDocstargetDOMNode);
expect(global.document.getElementById('root').innerHTML).toBe('');
});
});
Expand Down
Expand Up @@ -34,11 +34,8 @@ describe('framework-preset-angular-cli', () => {
});

describe('without angular.json', () => {
let consoleErrorSpy: jest.SpyInstance;

beforeEach(() => {
initMockWorkspace('');
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation();
});
it('should return webpack base config and display log error', async () => {
const webpackBaseConfig = newWebpackConfiguration();
Expand Down Expand Up @@ -421,10 +418,6 @@ describe('framework-preset-angular-cli', () => {
it('should set webpack "module.rules"', async () => {
const baseWebpackConfig = newWebpackConfiguration();
const webpackFinalConfig = await webpackFinal(baseWebpackConfig, options);
const stylePaths = [
path.join(workspaceRoot, 'src', 'styles.css'),
path.join(workspaceRoot, 'src', 'styles.scss'),
];

const expectedRules: any = [
{
Expand Down Expand Up @@ -507,10 +500,6 @@ describe('framework-preset-angular-cli', () => {
it('should set webpack "module.rules"', async () => {
const baseWebpackConfig = newWebpackConfiguration();
const webpackFinalConfig = await webpackFinal(baseWebpackConfig, options);
const stylePaths = [
path.join(workspaceRoot, 'src', 'styles.css'),
path.join(workspaceRoot, 'src', 'styles.scss'),
];

const expectedRules: any = [
{
Expand Down
Expand Up @@ -217,6 +217,7 @@ export class DocButtonComponent<T> {
*
* @param password Some `password`.
*/
// @ts-expect-error Unused, leaving for doc generation.
private privateMethod(password: string) {
console.log(password);
}
Expand Down
3 changes: 2 additions & 1 deletion code/lib/cli/src/generators/baseGenerator.ts
Expand Up @@ -128,7 +128,8 @@ export async function baseGenerator(
const {
packages: frameworkPackages,
type,
renderer: rendererInclude, // deepscan-disable-line UNUSED_DECL
// @ts-expect-error Possibly remove this unused variable?
renderer: rendererInclude,
rendererId,
framework: frameworkInclude,
builder: builderInclude,
Expand Down
2 changes: 1 addition & 1 deletion code/lib/core-client/src/start.test.ts
Expand Up @@ -384,7 +384,7 @@ describe('start', () => {
it('re-emits SET_INDEX when a story is added', async () => {
const renderToDOM = jest.fn(({ storyFn }) => storyFn());

const { configure, clientApi, forceReRender } = start(renderToDOM);
const { configure, clientApi } = start(renderToDOM);

let disposeCallback: () => void = () => {};
const module = {
Expand Down
8 changes: 4 additions & 4 deletions code/renderers/svelte/src/public-types.test.ts
Expand Up @@ -42,7 +42,7 @@ describe('Meta', () => {
});

test('Events are inferred from component', () => {
const meta: Meta<Button> = {
({
component: Button,
args: {
label: 'good',
Expand All @@ -57,11 +57,11 @@ describe('Meta', () => {
},
},
}),
};
}) satisfies Meta<Button>;
});

test('Events fallback to custom events when no component is specified', () => {
const meta: Meta<{ disabled: boolean; label: string }> = {
({
component: Button,
args: { label: 'good', disabled: false },
render: (args) => ({
Expand All @@ -73,7 +73,7 @@ describe('Meta', () => {
},
},
}),
};
}) satisfies Meta<{ disabled: boolean; label: string }>;
});
});

Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue3/src/public-types.test.ts
Expand Up @@ -41,7 +41,7 @@ describe('Meta', () => {
});

test('Events are inferred from component', () => {
const meta: Meta<typeof Button> = {
({
component: Button,
args: {
label: 'good',
Expand All @@ -58,7 +58,7 @@ describe('Meta', () => {
},
});
},
};
}) satisfies Meta<typeof Button>;
});
});

Expand Down
8 changes: 0 additions & 8 deletions code/renderers/web-components/src/docs/custom-elements.ts
Expand Up @@ -37,14 +37,6 @@ interface Module {
interface Declaration {
tagName: string;
}
interface Sections {
attributes?: any;
properties?: any;
events?: any;
slots?: any;
cssCustomProperties?: any;
cssShadowParts?: any;
}

function mapItem(item: TagItem, category: string): API_ArgType {
const type =
Expand Down
3 changes: 2 additions & 1 deletion code/tsconfig.json
Expand Up @@ -15,7 +15,8 @@
"isolatedModules": true,
"strictBindCallApply": true,
"types": ["jest"],
"lib": ["dom", "esnext"]
"lib": ["dom", "esnext"],
"noUnusedLocals": true
},
"exclude": ["dist", "**/dist", "node_modules", "**/node_modules", "**/setup-jest.ts"],
"ts-node": {
Expand Down
1 change: 1 addition & 0 deletions code/ui/manager/src/runtime.ts
Expand Up @@ -18,6 +18,7 @@ const { FEATURES, SERVER_CHANNEL_URL } = global;
class ReactProvider extends Provider {
private addons: AddonStore;

// @ts-expect-error Unused, possibly remove, leaving, because it could be accessed even though it is private
private channel: Channel;

private serverChannel?: Channel;
Expand Down

0 comments on commit f49215e

Please sign in to comment.