Skip to content
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
4 changes: 2 additions & 2 deletions packages/demo-app/src/examples/PopoverExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const PopoverExample = memo(() => {
return (
<div className="example-row">
<ExampleCard label="Popover" subLabel="Text content" width={200}>
{/* eslint-disable-next-line @typescript-eslint/no-deprecated */}
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components, @typescript-eslint/no-deprecated */}
<Popover
content={
<div style={{ minWidth: 100 }}>
Expand All @@ -60,7 +60,7 @@ export const PopoverExample = memo(() => {
</Popover>
</ExampleCard>
<ExampleCard label="Popover" subLabel="Dropdown menu" width={200}>
{/* eslint-disable-next-line @typescript-eslint/no-deprecated */}
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components, @typescript-eslint/no-deprecated */}
<Popover content={textEditorMenu} fill={true} placement="bottom-start" minimal={true}>
<Button fill={true} text="Click to open" endIcon="caret-down" />
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const PopoverDismissExample: React.FC<ExampleProps> = props => {

return (
<Example options={false} {...props}>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
// don't autofocus or enforce focus because it is open by default on the page,
// and that will make unexpectedly users scroll to this example
Expand All @@ -58,6 +59,7 @@ export const PopoverDismissExample: React.FC<ExampleProps> = props => {
label="Capture dismiss"
onChange={handleDismissChange}
/>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
autoFocus={false}
captureDismiss={captureDismiss}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export const PopoverExample: React.FC<ExampleProps> = props => {
return (
<Example options={options} {...props}>
<div className="docs-popover-example-scroll" ref={centerScroll}>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
boundary={
boundary === "scrollParent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const PopoverInteractionKindExample: React.FC<ExampleProps> = props => {
// MenuItem's default shouldDismissPopover={true} behavior is confusing
// in this example, since it introduces an additional way popovers can
// close. set it to false here for clarity.
// eslint-disable-next-line @blueprintjs/no-deprecated-components
<Popover
key={interactionKind}
content={<FileMenu shouldDismissPopover={false} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { FileMenu } from "../core-examples/common/fileMenu";

export const PopoverMinimalExample: React.FC<ExampleProps> = props => (
<Example options={false} {...props}>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
content={<FileMenu />}
minimal={true}
Expand All @@ -29,6 +30,7 @@ export const PopoverMinimalExample: React.FC<ExampleProps> = props => (
<Button {...rest} active={isOpen} intent={Intent.PRIMARY} text="Minimal" />
)}
/>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
content={<FileMenu />}
placement="bottom-end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const PlacementPopover: React.FC<{ placement: Placement }> = ({ placement }) =>
);

return (
// eslint-disable-next-line @blueprintjs/no-deprecated-components
<Popover
content={content}
placement={placement}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const PopoverPortalExample: React.FC<ExampleProps> = props => {
ref={scrollContainerLeftRef}
>
<div className="docs-popover-portal-example-scroll-content">
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
{...POPOVER_PROPS}
content="I am in a Portal (default)."
Expand All @@ -114,6 +115,7 @@ export const PopoverPortalExample: React.FC<ExampleProps> = props => {
ref={scrollContainerRightRef}
>
<div className="docs-popover-portal-example-scroll-content">
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
{...POPOVER_PROPS}
content="I am an inline popover."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { FileMenu } from "./common/fileMenu";
export const PopoverSizingExample: React.FC<ExampleProps> = props => {
return (
<Example options={false} {...props}>
{/* eslint-disable-next-line @blueprintjs/no-deprecated-components */}
<Popover
content={<FileMenu className="docs-popover-sizing-example" />}
placement="bottom-end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

import type { TSESLint } from "@typescript-eslint/utils";

import { createNoDeprecatedComponentsRule } from "./createNoDeprecatedComponentsRule";
import { createNoDeprecatedComponentsRule, type DeprecatedComponentsConfig } from "./createNoDeprecatedComponentsRule";

export const coreComponentsMigrationMapping = {
export const coreComponentsMigrationMapping: DeprecatedComponentsConfig = {
// TODO(@adidahiya): Blueprint v6
// PanelStack: "PanelStack2",
Popover: "PopoverNext",
};
Comment thread
ggdouglas marked this conversation as resolved.

/**
Expand Down
35 changes: 34 additions & 1 deletion packages/eslint-plugin/test/no-deprecated-components.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,40 @@ const ruleTester = new RuleTester({
});

ruleTester.run("no-deprecated-components", noDeprecatedComponentsRule, {
invalid: [],
invalid: [
{
code: dedent`
import { Popover } from "@blueprintjs/core";

return <Popover />;
Comment thread
ggdouglas marked this conversation as resolved.
`,
Comment thread
ggdouglas marked this conversation as resolved.
errors: [
{
data: {
deprecatedComponentName: "Popover",
newComponentName: "PopoverNext",
},
messageId: "migration",
},
],
},
{
code: dedent`
import * as Blueprint from "@blueprintjs/core";

return <Blueprint.Popover />;
`,
errors: [
{
data: {
deprecatedComponentName: "Popover",
newComponentName: "PopoverNext",
},
messageId: "migration",
},
],
},
],
valid: [
{
code: dedent`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,40 @@ const ruleTester = new RuleTester({
ruleTester.run("no-deprecated-core-components", noDeprecatedCoreComponentsRule, {
// N.B. most other deprecated components are tested by no-deprecated-components.test.ts, this suite just tests
// for more specific violations which involve certain deprecated props
invalid: [],
invalid: [
{
code: dedent`
import { Popover } from "@blueprintjs/core";

return <Popover />;
Comment thread
ggdouglas marked this conversation as resolved.
`,
errors: [
{
data: {
deprecatedComponentName: "Popover",
newComponentName: "PopoverNext",
},
messageId: "migration",
},
],
},
{
code: dedent`
import * as Blueprint from "@blueprintjs/core";

return <Blueprint.Popover />;
Comment thread
ggdouglas marked this conversation as resolved.
`,
errors: [
{
data: {
deprecatedComponentName: "Popover",
newComponentName: "PopoverNext",
},
messageId: "migration",
},
],
},
],
valid: [
{
code: dedent`
Expand Down