Skip to content

Commit

Permalink
Update polaris component urls in READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
laurkim committed Mar 9, 2023
1 parent f4031cd commit 628417a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ This plugin also provides the following tool-specific configurations, which can
```

- [react](lib/config/react.js): Use this for React projects.
- [polaris](lib/config/polaris.js): Use this for projects that use [Shopify’s React Polaris components](https://polaris.shopify.com/components/get-started).
- [polaris](lib/config/polaris.js): Use this for projects that use [Shopify’s React Polaris components](https://polaris.shopify.com/components).
- [prettier](lib/config/prettier.js): Use [prettier](https://github.com/prettier/prettier) for consistent formatting. Extending this Shopify's prettier config will [override](https://github.com/prettier/eslint-config-prettier/blob/master/index.js) the default Shopify eslint rules in favor of prettier formatting. Prettier must be installed within your project, as @shopify/eslint-plugin does not provide the dependency itself.
- [webpack](lib/config/webpack.js): Use this for projects built by [webpack](https://webpack.js.org/).

Expand Down
20 changes: 10 additions & 10 deletions packages/eslint-plugin/docs/rules/polaris-no-bare-stack-item.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the use of Polaris’s `Stack.Item` without any custom props. (polaris-no-bare-stack-item)
# Disallow the use of Polaris’s `LegacyStack.Item` without any custom props. (polaris-no-bare-stack-item)

The Polaris [`Stack` component](https://polaris.shopify.com/components/structure/stack) has an `Item` subcomponent that is automatically wrapped around all children. As such, it is useless to wrap any content in a `Stack.Item` unless a non-default prop value is provided. This rule prevents creating such items.
The Polaris [`LegacyStack` component](https://polaris.shopify.com/components/layout-and-structure/legacy-stack) has an `Item` subcomponent that is automatically wrapped around all children. As such, it is useless to wrap any content in a `LegacyStack.Item` unless a non-default prop value is provided. This rule prevents creating such items.

Note that this rule will only work if the Stack component was explicitly imported using a named, default, or namespace import, and not when using dynamic imports (`import('@shopify/polaris')`).

Expand All @@ -10,20 +10,20 @@ The following patterns are considered warnings:

```js
import * as Polaris from '@shopify/polaris';
import {Stack} from '@shopify/polaris';
import {Stack as PolarisStack} from '@shopify/polaris';
import {LegacyStack} from '@shopify/polaris';
import {LegacyStack as PolarisLegacyStack} from '@shopify/polaris';

<Stack><Stack.Item>Content</Stack.Item></Stack>
<Polaris.Stack.Item>Content</Polaris.Stack.Item>
<PolarisStack.Item>Content</PolarisStack.Item>
<LegacyStack><LegacyStack.Item>Content</LegacyStack.Item></LegacyStack>
<Polaris.LegacyStack.Item>Content</Polaris.LegacyStack.Item>
<PolarisLegacyStack.Item>Content</PolarisLegacyStack.Item>
```

The following patterns are not warnings:

```js
import {Stack} from '@shopify/polaris';
import {LegacyStack} from '@shopify/polaris';

<Stack.Item fill><span>Content</span></Stack.Item>
<Stack><span>No wrapping item</span></Stack>
<LegacyStack.Item fill><span>Content</span></LegacyStack.Item>
<LegacyStack><span>No wrapping item</span></LegacyStack>
```

Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ Polaris provides a convenience `sectioned` prop for some components that wraps t

This rule currently Require the use of the `sectioned` prop over the `Section` subcomponent for the following components:

* [`Card`](https://polaris.shopify.com/components/structure/card)
* [`LegacyCard`](https://polaris.shopify.com/components/layout-and-structure/legacy-card)
* [`Popover`](https://polaris.shopify.com/components/overlays/popover)
* [`Layout`](https://polaris.shopify.com/components/structure/layout)
* [`Layout`](https://polaris.shopify.com/components/layout-and-structure/layout)

This rule only takes effect when the `Section` subcomponent is the only top-level child of the components specified above, and when the `Section` component has no props.

The following patterns are considered warnings:

```js
import {Card, Popover, Layout} from '@shopify/polaris';
import {LegacyCard, Popover, Layout} from '@shopify/polaris';

<Card><Card.Section>Contents</Card.Section></Card>
<LegacyCard><LegacyCard.Section>Contents</LegacyCard.Section></LegacyCard>
<Popover><Popover.Section>Contents</Popover.Section></Popover>
<Layout><Layout.Section>Contents</Layout.Section></Layout>
```

The following patterns are not warnings:

```js
import {Card, Layout, Popover} from '@shopify/polaris';
import {LegacyCard, Layout, Popover} from '@shopify/polaris';

<Card sectioned>Contents</Card>
<LegacyCard sectioned>Contents</LegacyCard>

<Card>
<Card.Section subdued>Contents</Card.Section>
</Card>
<LegacyCard>
<LegacyCard.Section subdued>Contents</LegacyCard.Section>
</LegacyCard>

<Layout>
<Layout.AnnotatedSection></Layout.AnnotatedSection>
Expand Down

0 comments on commit 628417a

Please sign in to comment.