Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: primer/eslint-plugin-primer-react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.1
Choose a base ref
...
head repository: primer/eslint-plugin-primer-react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Sep 24, 2024

  1. fix(no-wildcard-imports): use local name when changing imports (#234)

    * fix(no-wildcard-imports): use local name when changing imports
    
    * chore: remove unused sourceCode
    
    * chore: add changeset
    
    * chore: fix imports for hooks
    
    * chore: add fix for when we insert multiple imports
    
    * fix: move SelectPanel import to deprecated
    
    * chore: add to stable
    
    * test: update test
    
    * test: update expected output
    joshblack authored Sep 24, 2024
    Copy the full SHA
    9a58afb View commit details
  2. fix: include deprecated props in rule (#239)

    * fix: include deprecated props in rule
    
    * chore: add changeset
    
    * fix: include TabNavLinkprops
    joshblack authored Sep 24, 2024
    Copy the full SHA
    3b2e023 View commit details
  3. Version Packages (#240)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    primer-css and github-actions[bot] authored Sep 24, 2024
    Copy the full SHA
    827d70a View commit details

Commits on Sep 25, 2024

  1. Bump eslint from 8.57.0 to 8.57.1 (#236)

    Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 8.57.1.
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](eslint/eslint@v8.57.0...v8.57.1)
    
    ---
    updated-dependencies:
    - dependency-name: eslint
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Sep 25, 2024
    Copy the full SHA
    c860192 View commit details

Commits on Oct 7, 2024

  1. fix(no-wildcard-imports): support test-helpers, mix-and-match imports (

    …#242)
    
    * fix(no-wildcard-imports): add test case for mix-and-match
    
    * chore: add changeset
    
    * feat: add support for ResponsiveValue
    
    * feat: add support for useFeatureFlag migration
    joshblack authored Oct 7, 2024
    Copy the full SHA
    e139c02 View commit details
  2. Version Packages (#248)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    primer-css and github-actions[bot] authored Oct 7, 2024
    Copy the full SHA
    2c5ea48 View commit details

Commits on Oct 9, 2024

  1. fix(no-wildcard-imports): mix-and-match import types (#249)

    * fix(no-wildcard-imports): mix-and-match import types
    
    * chore: add changeset
    
    * refactor: update logic to reuse imports
    
    * fix: add support for default
    
    * fix: reuse existing type import declarations if they exist
    
    * chore: fix eslint warnings
    
    * fix: lookup for specifiers
    
    * fix: update overlap when removing and replacing node
    joshblack authored Oct 9, 2024
    Copy the full SHA
    f8c8a9d View commit details
  2. Version Packages (#250)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    primer-css and github-actions[bot] authored Oct 9, 2024
    Copy the full SHA
    60d8088 View commit details
  3. fix(no-wildcard-imports): move ButtonBase to experimental (#253)

    * feat: move ButtonBase to experimental
    
    * chore: add changeset
    joshblack authored Oct 9, 2024
    Copy the full SHA
    456bf4d View commit details
  4. Version Packages (#254)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    primer-css and github-actions[bot] authored Oct 9, 2024
    Copy the full SHA
    bf767c6 View commit details

Commits on Oct 10, 2024

  1. fix(no-wildcard-imports): remove migration for TokenSizeKeys (#255)

    * fix(no-wildcard-imports): remove migration for TokenSizeKeys
    
    * chore: add changeset
    joshblack authored Oct 10, 2024
    Copy the full SHA
    fd2cb55 View commit details
  2. Version Packages (#256)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    primer-css and github-actions[bot] authored Oct 10, 2024
    Copy the full SHA
    704d44c View commit details

Commits on Oct 22, 2024

  1. Copy the full SHA
    906bd97 View commit details

Commits on Oct 24, 2024

  1. add enforce-css-module-identifier-casing rule (#258)

    * add enforce-css-module-identifier-casing rule
    
    * changeset
    
    * formatting
    keithamus authored Oct 24, 2024
    Copy the full SHA
    83f29f3 View commit details
  2. Copy the full SHA
    650bbca View commit details

Commits on Oct 28, 2024

  1. add enforce-css-module-default-import rule (#266)

    * add enforce-css-module-default-import rule
    
    * changeset
    keithamus authored Oct 28, 2024
    Copy the full SHA
    90134bc View commit details

Commits on Nov 15, 2024

  1. Update a11y-use-next-tooltip to be a11y-use-accessible-tooltip and ma…

    …ke the changes accordingly (#270)
    
    * Update the tooltip eslint rule as we now export the new one from main bundle and the old one from deprecated
    
    * oops
    
    * just make the code a lil better
    
    * Create gorgeous-frogs-cover.md
    
    * reuse rootImport and fix method
    
    * Update .changeset/gorgeous-frogs-cover.md
    
    * improve the rule docs so that it can be used as a migration guide
    broccolinisoup authored Nov 15, 2024
    Copy the full SHA
    17814a2 View commit details

Commits on Dec 2, 2024

  1. Bump eslint-plugin-jsx-a11y from 6.10.0 to 6.10.2 (#277)

    Bumps [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) from 6.10.0 to 6.10.2.
    - [Release notes](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/releases)
    - [Changelog](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/CHANGELOG.md)
    - [Commits](jsx-eslint/eslint-plugin-jsx-a11y@v6.10.0...v6.10.2)
    
    ---
    updated-dependencies:
    - dependency-name: eslint-plugin-jsx-a11y
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 2, 2024
    Copy the full SHA
    fdef34a View commit details
  2. Bump typescript from 5.6.2 to 5.7.2 (#276)

    Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.7.2.
    - [Release notes](https://github.com/microsoft/TypeScript/releases)
    - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
    - [Commits](microsoft/TypeScript@v5.6.2...v5.7.2)
    
    ---
    updated-dependencies:
    - dependency-name: typescript
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 2, 2024
    Copy the full SHA
    17b314b View commit details

Commits on Dec 3, 2024

  1. Bump @changesets/cli from 2.27.9 to 2.27.10 (#275)

    Bumps [@changesets/cli](https://github.com/changesets/changesets) from 2.27.9 to 2.27.10.
    - [Release notes](https://github.com/changesets/changesets/releases)
    - [Changelog](https://github.com/changesets/changesets/blob/main/docs/modifying-changelog-format.md)
    - [Commits](https://github.com/changesets/changesets/compare/@changesets/cli@2.27.9...@changesets/cli@2.27.10)
    
    ---
    updated-dependencies:
    - dependency-name: "@changesets/cli"
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 3, 2024
    Copy the full SHA
    0b8d981 View commit details

Commits on Dec 9, 2024

  1. Bump @typescript-eslint/utils from 7.16.0 to 8.17.0 (#283)

    Bumps [@typescript-eslint/utils](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/utils) from 7.16.0 to 8.17.0.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/utils/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.17.0/packages/utils)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/utils"
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 9, 2024
    Copy the full SHA
    9235b25 View commit details

Commits on Dec 27, 2024

  1. Bump @typescript-eslint/utils from 8.17.0 to 8.18.1 (#289)

    * Bump @typescript-eslint/utils from 8.17.0 to 8.18.1
    
    Bumps [@typescript-eslint/utils](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/utils) from 8.17.0 to 8.18.1.
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/utils/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.18.1/packages/utils)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/utils"
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    * empty commit
    
    ---------
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Marie Lucca <francinelucca@github.com>
    dependabot[bot] and francinelucca authored Dec 27, 2024
    Copy the full SHA
    5b5b0b2 View commit details

Commits on Jan 9, 2025

  1. Bump markdownlint-cli2 from 0.14.0 to 0.17.1 (#297)

    Bumps [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) from 0.14.0 to 0.17.1.
    - [Changelog](https://github.com/DavidAnson/markdownlint-cli2/blob/main/CHANGELOG.md)
    - [Commits](DavidAnson/markdownlint-cli2@v0.14.0...v0.17.1)
    
    ---
    updated-dependencies:
    - dependency-name: markdownlint-cli2
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jan 9, 2025
    Copy the full SHA
    e4a87c2 View commit details
5 changes: 5 additions & 0 deletions .changeset/gorgeous-frogs-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-primer-react": major
---

Update a11y-use-next-tooltip to be a11y-use-accessible-tooltip and make the changes accordingly
5 changes: 5 additions & 0 deletions .changeset/purple-pears-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-primer-react': minor
---

Add enforce-css-module-default-import rule
5 changes: 5 additions & 0 deletions .changeset/slimy-zebras-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-primer-react': minor
---

Add enforce-css-module-identifier-casing rule
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# eslint-plugin-primer-react

## 6.1.6

### Patch Changes

- [#255](https://github.com/primer/eslint-plugin-primer-react/pull/255) [`fd2cb55`](https://github.com/primer/eslint-plugin-primer-react/commit/fd2cb551cdf219c2ac690ce610fbbab102cc5e48) Thanks [@joshblack](https://github.com/joshblack)! - Update no-wildcard-imports rule to no longer migrate the TokenSizeKeys import

## 6.1.5

### Patch Changes

- [#253](https://github.com/primer/eslint-plugin-primer-react/pull/253) [`456bf4d`](https://github.com/primer/eslint-plugin-primer-react/commit/456bf4d3c1f5e5dde70030f24c1c6b821e685cc5) Thanks [@joshblack](https://github.com/joshblack)! - Update no-wildcard-imports rule to move ButtonBase to `@primer/react/experimental`

## 6.1.4

### Patch Changes

- [#249](https://github.com/primer/eslint-plugin-primer-react/pull/249) [`f8c8a9d`](https://github.com/primer/eslint-plugin-primer-react/commit/f8c8a9df1b49cb7f487eb0dba3e7f46ac7f7e23b) Thanks [@joshblack](https://github.com/joshblack)! - Update no-wildcard-imports rule to not create separate imports for type only imports. This prevents an issue downstream with autofixers

## 6.1.3

### Patch Changes

- [#242](https://github.com/primer/eslint-plugin-primer-react/pull/242) [`e139c02`](https://github.com/primer/eslint-plugin-primer-react/commit/e139c02ae0d0d656d2276320ae0e4756b3a1debd) Thanks [@joshblack](https://github.com/joshblack)! - Update no-wildcard-imports rule to work for imports that specify value and type imports

## 6.1.2

### Patch Changes

- [#239](https://github.com/primer/eslint-plugin-primer-react/pull/239) [`3b2e023`](https://github.com/primer/eslint-plugin-primer-react/commit/3b2e023ce2215feff50a1b7f263d23db99f79ec2) Thanks [@joshblack](https://github.com/joshblack)! - Update use-deprecated-from-deprecated rule to include prop types

- [#234](https://github.com/primer/eslint-plugin-primer-react/pull/234) [`9a58afb`](https://github.com/primer/eslint-plugin-primer-react/commit/9a58afb35f848bd8fcf11901653615f84c09f8f8) Thanks [@joshblack](https://github.com/joshblack)! - Update no-wildcard-imports rule to use local name for updated imports

## 6.1.1

### Patch Changes
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -39,4 +39,4 @@ ESLint rules for Primer React
- [a11y-explicit-heading](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-explicit-heading.md)
- [a11y-link-in-text-block](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-link-in-text-block.md)
- [a11y-remove-disable-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-remove-disable-tooltip.md)
- [a11y-use-next-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-next-tooltip.md)
- [a11y-use-accessible-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-accessible-tooltip.md)
47 changes: 47 additions & 0 deletions docs/rules/a11y-use-accessible-tooltip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Recommends to use the new accessible tooltip instead of the deprecated one.

## Rule details

This rule suggests switching to the new accessible tooltip from @primer/react instead of the deprecated version. Deprecated props like wrap, noDelay, and align should also be removed.

Note that the new tooltip is intended for interactive elements only, such as buttons and links, whereas the deprecated tooltip could be applied to any element, though it lacks screen reader accessibility. As a result, the autofix for this rule will only work if the deprecated tooltip is on an interactive element. If it is applied to a non-interactive element, please consult your design team for [an alternative approach](https://primer.style/guides/accessibility/tooltip-alternatives).

👎 Examples of **incorrect** code for this rule:

```jsx
import {Tooltip} from '@primer/react/deprecated'

const App = () => (
<Tooltip aria-label="This change cannot be undone" direction="w" wrap={true} noDelay={true} align="left">
<Button onClick={onClick}>Delete</Button>
</Tooltip>
)
```

👍 Examples of **correct** code for this rule:

```jsx
import {Tooltip} from '@primer/react'

const App = () => (
<Tooltip text="This change cannot be undone" direction="w">
<Button onClick={onClick}>Delete</Button>
</Tooltip>
)
```

## Icon buttons and tooltips

Even though the below code is perfectly valid, since icon buttons now come with tooltips by default, it is not required to explicitly use the Tooltip component on icon buttons.

```jsx
import {IconButton, Tooltip} from '@primer/react'

function ExampleComponent() {
return (
<Tooltip text="Search" direction="e">
<IconButton icon={SearchIcon} aria-label="Search" />
</Tooltip>
)
}
```
33 changes: 0 additions & 33 deletions docs/rules/a11y-use-next-tooltip.md

This file was deleted.

53 changes: 53 additions & 0 deletions docs/rules/enforce-css-module-default-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Enforce CSS Module Default Import (enforce-css-module-default-import)

CSS Modules should import only the default import. Avoid named imports which can often conflict with other variables (including the function name of the React component) when importing css modules.

Additionally, for consistency among the codebase the default import should be consistently named. This rule allows enforcing the name of the default import, which by default expects it to be named either `classes` or be suffixed `Classes`.

## Rule details

This rule disallows the use of any CSS Module property that does not match the desired casing.

👎 Examples of **incorrect** code for this rule:

```jsx
/* eslint primer-react/enforce-css-module-default-import: "error" */
import {Button} from '@primer/react'
import {Button as ButtonClass} from './some.module.css' // oops! Conflict!
```

```jsx
/* eslint primer-react/enforce-css-module-default-import: ["error",{enforceName:"^classes$"}] */
import {Button} from '@primer/react'
import classnames from './some.module.css' // This default import should match /^classes$/
```

👍 Examples of **correct** code for this rule:

```jsx
/* eslint primer-react/enforce-css-module-default-import: "error" */
import {Button} from '@primer/react'
import classes from './some.module.css'
```

```jsx
/* eslint primer-react/enforce-css-module-default-import: ["error",{enforceName:"^classes$"}] */
import {Button} from '@primer/react'
import classes from './some.module.css'
```

```jsx
/* eslint primer-react/enforce-css-module-default-import: ["error",{enforceName:"(^classes$|Classes$)"}] */
import {Button} from '@primer/react'
import classes from './some.module.css'
import sharedClasses from './shared.module.css'
import utilClasses from './util.module.css'
```

## Options

- `enforceName` (default: `.*`)

By default, the `enforce-css-module-default-import` rule will allow any name for the default export,
however in the _recommended_ ruleset this is set to `(^classes$|Classes$)` meaning that the default
export name must either be exactly `classes` or end in `Classes`, for example `sharedClasses`.
39 changes: 39 additions & 0 deletions docs/rules/enforce-css-module-identifier-casing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Enforce CSS Module Identifier Casing (enforce-css-module-identifier-casing)

CSS Modules should expose class names written in PascalCase.

## Rule details

This rule disallows the use of any CSS Module property that does not match the desired casing.

👎 Examples of **incorrect** code for this rule:

```jsx
/* eslint primer-react/enforce-css-module-identifier-casing: "error" */
import {Button} from '@primer/react'
import classes from './some.module.css'

<Button className={classes.button} />
<Button className={classes['button']} />
<Button className={clsx(classes.button)} />

let ButtonClass = "button"
<Button className={clsx(classes[ButtonClass])} />
```

👍 Examples of **correct** code for this rule:

```jsx
/* eslint primer-react/enforce-css-module-identifier-casing: "error" */
import {Button} from '@primer/react'
import classes from './some.module.css'
;<Button className={classes.Button} />
```

## Options

- `casing` (default: `'pascal'`)

By default, the `enforce-css-module-identifier-casing` rule will check for identifiers matching PascalCase.
Changing this to `'camel'` will instead enforce camelCasing rules. Changing this to `'kebab'` will instead
enforce kebab-casing rules.
Loading