Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No unused locals in tsconfig to disable deepscan #20012

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/addons/actions/src/containers/ActionLogger/index.tsx
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react';
import type { FC } from 'react';
import React, { useCallback } from 'react';
import { useGlobals } from '@storybook/manager-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
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,7 @@ describe('RendererFactory', () => {
.appendChild(global.document.createElement('👾'));

expect(global.document.getElementById('storybook-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('storybook-root').innerHTML).toBe('');
});
});
Expand Down
Original file line number Diff line number Diff line change
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
3 changes: 2 additions & 1 deletion code/frameworks/angular/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"allowJs": true,
"pretty": true,
"noErrorTruncation": true,
"listEmittedFiles": false
"listEmittedFiles": false,
"noUnusedLocals": false
},
"include": ["src/**/*", "src/**/*.json"]
}
1 change: 0 additions & 1 deletion code/lib/cli/src/generators/baseGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export async function baseGenerator(
const {
packages: frameworkPackages,
type,
renderer: rendererInclude, // deepscan-disable-line UNUSED_DECL
rendererId,
framework: frameworkInclude,
builder: builderInclude,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export const Component: FC<Props> = ({
...rest
}: Props) => {
const props = { any, string, bool, number, ...rest };
return <>JSON.stringify(props)</>;
return <>{JSON.stringify(props)}</>;
};
1 change: 0 additions & 1 deletion code/lib/manager-api/src/tests/stories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,6 @@ describe('stories API', () => {

const {
api: { setIndex, jumpToStory },
state,
} = initStories({ store, navigate, provider } as any);
setIndex({ v: 4, entries: navigationEntries });

Expand Down
2 changes: 1 addition & 1 deletion code/lib/preview-api/src/modules/core-client/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ describe('start', () => {
it('re-emits SET_INDEX when a story is added', async () => {
const renderToCanvas = jest.fn(({ storyFn }) => storyFn());

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

let disposeCallback: () => void = () => {};
const module = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ describe('PreviewWeb', () => {

it('passes globals in context to renderToCanvas', async () => {
document.location.search = '?id=component-one--a';
const preview = await createAndRenderPreview();
await createAndRenderPreview();

mockChannel.emit.mockClear();
projectAnnotations.renderToCanvas.mockClear();
Expand Down
2 changes: 1 addition & 1 deletion code/lib/preview-api/src/modules/store/StoryStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('StoryStore', () => {
store.setProjectAnnotations(projectAnnotations);
store.initialize({ storyIndex, importFn, cache: false });

const story = await store.loadStory({ storyId: 'component-one--a' });
await store.loadStory({ storyId: 'component-one--a' });
expect(processCSFFile).toHaveBeenCalledTimes(1);
expect(prepareStory).toHaveBeenCalledTimes(1);

Expand Down
2 changes: 2 additions & 0 deletions code/renderers/svelte/src/public-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('Meta', () => {
},
}),
};
expectTypeOf(meta).toMatchTypeOf<Meta<Button>>();
});

test('Events fallback to custom events when no component is specified', () => {
Expand All @@ -75,6 +76,7 @@ describe('Meta', () => {
},
}),
};
expectTypeOf(meta).toMatchTypeOf<Meta<Button>>();
});
});

Expand Down
1 change: 1 addition & 0 deletions code/renderers/vue3/src/public-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('Meta', () => {
});
},
};
expectTypeOf(meta).toMatchTypeOf<Meta<typeof Button>>();
});
});

Expand Down
8 changes: 0 additions & 8 deletions code/renderers/web-components/src/docs/custom-elements.ts
Original file line number Diff line number Diff line change
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): InputType {
const type =
Expand Down
3 changes: 2 additions & 1 deletion code/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"esModuleInterop": true,
"isolatedModules": true,
"strictBindCallApply": true,
"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
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"strict": false,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
Expand All @@ -33,7 +33,7 @@
"verdaccio": [
"./typings.d.ts"
]
}
},
},
"exclude": [
"dist",
Expand Down