Skip to content

Commit

Permalink
Merge branch 'main' of github.com:carbon-design-system/carbon into re…
Browse files Browse the repository at this point in the history
…novate/eslint-plugin-jest-27.x
  • Loading branch information
tay1orjones committed Jul 17, 2023
2 parents 7b8eced + f2aa208 commit 2510869
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 54 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/add-to-merge-queue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Add To Merge Queue
on:
pull_request:
types: [labeled, opened, reopened]

jobs:
add-to-merge-queue:
name: Add to Merge Queue if the PR is labelled with any of the automerge labels
runs-on: ubuntu-latest
if: ${{ contains(github.event.issue.labels.*.name, 'status: ready to merge 🎉') || contains(github.event.issue.labels.*.name, 'status: enable automerge 🟠')}}
steps:
- name: 'Add the PR to the merge queue via the GitHub CLI'
run: gh pr merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
branches:
- main
merge_group:
types: [checks_requested]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -138,7 +140,8 @@ jobs:
- name: Build project
run: yarn build
- name: Build storybook
run: STORYBOOK_STORE_7=false yarn workspace @carbon/react storybook:build
run:
STORYBOOK_STORE_7=false yarn workspace @carbon/react storybook:build
- name: Run storybook
id: storybook
run: |
Expand Down Expand Up @@ -196,7 +199,8 @@ jobs:
- name: Build project
run: yarn build
- name: Build storybook
run: STORYBOOK_STORE_7=false yarn workspace @carbon/react storybook:build
run:
STORYBOOK_STORE_7=false yarn workspace @carbon/react storybook:build
- name: Run storybook
id: storybook
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main, v10]
pull_request:
branches: [main, v10]
merge_group:
types: [checks_requested]
schedule:
- cron: '0 12 * * 1'

Expand Down
37 changes: 25 additions & 12 deletions .github/workflows/dco.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
name: "DCO Assistant"
name: 'DCO Assistant'
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]
merge_group:
types: [checks_requested]

jobs:
DCO:
runs-on: ubuntu-latest
steps:
- name: "DCO Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the DCO document and I hereby sign the DCO.') || github.event_name == 'pull_request_target'
- name: 'DCO Assistant'
if:
(github.event.comment.body == 'recheck' || github.event.comment.body
== 'I have read the DCO document and I hereby sign the DCO.') ||
github.event_name == 'pull_request_target'
uses: cla-assistant/github-action@v2.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: "dco-signatures.json"
path-to-document: "https://github.com/carbon-design-system/carbon-dco/blob/main/dco.md"
branch: "main"
path-to-signatures: 'dco-signatures.json'
path-to-document: 'https://github.com/carbon-design-system/carbon-dco/blob/main/dco.md'
branch: 'main'
allowlist: bot*
remote-organization-name: carbon-design-system
remote-repository-name: carbon-dco
create-file-commit-message: "chore: create file to store dco signatures"
signed-commit-message: "chore: $contributorName has signed the dco in #$pullRequestNo"
custom-notsigned-prcomment: "Thanks for your submission! We ask that $you sign our [Developer Certificate of Origin](https://github.com/carbon-design-system/carbon-dco/blob/main/dco.md) before we can accept your contribution. You can sign the DCO by adding a comment below using this text:"
custom-pr-sign-comment: "I have read the DCO document and I hereby sign the DCO."
custom-allsigned-prcomment: "All contributors have signed the DCO."
create-file-commit-message:
'chore: create file to store dco signatures'
signed-commit-message:
'chore: $contributorName has signed the dco in #$pullRequestNo'
custom-notsigned-prcomment:
'Thanks for your submission! We ask that $you sign our [Developer
Certificate of
Origin](https://github.com/carbon-design-system/carbon-dco/blob/main/dco.md)
before we can accept your contribution. You can sign the DCO by
adding a comment below using this text:'
custom-pr-sign-comment:
'I have read the DCO document and I hereby sign the DCO.'
custom-allsigned-prcomment: 'All contributors have signed the DCO.'
lock-pullrequest-aftermerge: false
use-dco-flag: true
use-dco-flag: true
7 changes: 0 additions & 7 deletions .kodiak.toml

This file was deleted.

Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion config/eslint-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-jest-dom": "^4.0.3",
"eslint-plugin-jest-dom": "^5.0.0",
"eslint-plugin-jsdoc": "^40.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
29 changes: 21 additions & 8 deletions docs/migration/v11.md
Original file line number Diff line number Diff line change
Expand Up @@ -661,14 +661,14 @@ instructions in [`@carbon/upgrade`](../../packages/upgrade/README.md).
#### Rewrite imports from `carbon-components-react` to `@carbon/react`.

```bash
npx @carbon/upgrade migrate update-carbon-components-react-import-to-scoped
npx @carbon/upgrade migrate update-carbon-components-react-import-to-scoped --write
```

#### Automates size prop changes.

```bash
npx @carbon/upgrade migrate small-to-size-props
npx @carbon/upgrade migrate size-prop-updates
npx @carbon/upgrade migrate small-to-size-props --write
npx @carbon/upgrade migrate size-prop-updates --write
```

For a full overview of changes to components, checkout our components section
Expand Down Expand Up @@ -1361,8 +1361,8 @@ The `@carbon/icons-react` package has been updated to minimize the number of
exports from the package to help reduce build and compile times. It also has
been updated to remove icons that were deprecated in v10.

_If you are using @carbon/react, you can now import icons directly from
@carbon/react/icons._
_If you are using `@carbon/react`, you can now import icons directly from
`@carbon/react/icons`._

### Changes to size

Expand Down Expand Up @@ -1444,15 +1444,28 @@ their replacement, if available, in v11.
### Migration

Most use-cases of the icons from the `@carbon/icons-react` package will be
covered by an automated codemod. To run this codemod, follow the instructions in
covered by automated codemods. To run these codemods, follow the instructions in
[`@carbon/upgrade`](../../packages/upgrade/README.md).

Update imports and size usage for @carbon/icons-react
#### Update imports and size usage for @carbon/icons-react

```bash
npx @carbon/upgrade migrate icons-react-size-prop
npx @carbon/upgrade migrate icons-react-size-prop --write
```

### Rewrite imports from `@carbon/icons-react` to `@carbon/react/icons`.

If you are using `@carbon/react`, you can now import icons directly from
`@carbon/react/icons`.

```bash
npx @carbon/upgrade migrate update-carbon-icons-react-import-to-carbon-react --write
```

Note: be sure to run this codemod _after `icons-react-size-prop`_.

#### Troubleshooting automated codemod migration

However, in certain situations, we will be unable to infer what the correct
update should be for a certain usage of the icon component. We have written the
codemod to work for most situations, but you will see console warnings for files
Expand Down
17 changes: 17 additions & 0 deletions packages/react/.storybook/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ body {
background: styles.$background;
color: styles.$text-primary;
}

// Docs overrides
.docblock-argstable-head ~ .docblock-argstable-body,
.docblock-argstable-head ~ .docblock-argstable-body p {
@include styles.type-style('body-01');
}

.docblock-argstable-head ~ .docblock-argstable-body table tbody {
filter: none;
}

/* stylelint-disable */
.docblock-argstable-head ~ .docblock-argstable-body table tbody > tr > td {
border: none !important;
box-shadow: none;
}
/* stylelint-enable */
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export const Default = () => (
<TableBatchAction
tabIndex={batchActionProps.shouldShowBatchActions ? 0 : -1}
renderIcon={TrashCan}
onClick={batchActionClick(selectedRows)}>
onClick={batchActionClick(selectedRows)}
disabled>
Delete
</TableBatchAction>
<TableBatchAction
Expand Down
31 changes: 31 additions & 0 deletions packages/upgrade/src/upgrades.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,37 @@ export const upgrades = [
});
},
},
{
name: 'update-carbon-icons-react-import-to-carbon-react',
description:
'Rewrites imports from `@carbon/icons-react` to `@carbon/react/icons`',
migrate: async (options) => {
const transform = path.join(
TRANSFORM_DIR,
'update-carbon-icons-react-import-to-carbon-react.js'
);
const paths =
Array.isArray(options.paths) && options.paths.length > 0
? options.paths
: await glob(['**/*.js', '**/*.jsx'], {
cwd: options.workspaceDir,
ignore: [
'**/es/**',
'**/lib/**',
'**/umd/**',
'**/node_modules/**',
'**/storybook-static/**',
],
});

await run({
dry: !options.write,
transform,
paths,
verbose: options.verbose,
});
},
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//prettier-ignore
import { Add } from '@carbon/icons-react';
//prettier-ignore
import { Settings, Search } from '@carbon/icons-react';
//prettier-ignore
import Icons from '@carbon/icons-react';
import Something from 'somewhere-else';
import { SomethingElse } from 'somewhere-else';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//prettier-ignore
import { Add } from "@carbon/react/icons";
//prettier-ignore
import { Settings, Search } from "@carbon/react/icons";
//prettier-ignore
import Icons from "@carbon/react/icons";
import Something from 'somewhere-else';
import { SomethingElse } from 'somewhere-else';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const { defineTest } = require('jscodeshift/dist/testUtils');

defineTest(__dirname, 'update-carbon-icons-react-import-to-carbon-react');
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*
* Rewrites imports from '@carbon/icons-react' to '@carbon/react/icons'
*
* Transforms:
*
* import { Add } from '@carbon/icons-react';
*
* Into:
*
* import { Add } from "@carbon/react/icons";
*/

function transformer(file, api) {
const j = api.jscodeshift;

return j(file.source)
.find(j.ImportDeclaration, {
source: {
value: '@carbon/icons-react',
},
})
.forEach((path) => {
path.get('source').replace(j.stringLiteral('@carbon/react/icons'));
})
.toSource();
}

module.exports = transformer;
30 changes: 7 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7114,22 +7114,6 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/dom@npm:^8.11.1":
version: 8.20.0
resolution: "@testing-library/dom@npm:8.20.0"
dependencies:
"@babel/code-frame": ^7.10.4
"@babel/runtime": ^7.12.5
"@types/aria-query": ^5.0.1
aria-query: ^5.0.0
chalk: ^4.1.0
dom-accessibility-api: ^0.5.9
lz-string: ^1.4.4
pretty-format: ^27.0.2
checksum: 1e599129a2fe91959ce80900a0a4897232b89e2a8e22c1f5950c36d39c97629ea86b4986b60b173b5525a05de33fde1e35836ea597b03de78cc51b122835c6f0
languageName: node
linkType: hard

"@testing-library/dom@npm:^9.0.0":
version: 9.0.1
resolution: "@testing-library/dom@npm:9.0.1"
Expand Down Expand Up @@ -14245,7 +14229,7 @@ __metadata:
eslint-config-prettier: ^8.8.0
eslint-plugin-import: ^2.27.5
eslint-plugin-jest: ^27.0.0
eslint-plugin-jest-dom: ^4.0.3
eslint-plugin-jest-dom: ^5.0.0
eslint-plugin-jsdoc: ^40.0.0
eslint-plugin-jsx-a11y: ^6.7.1
eslint-plugin-prettier: ^4.2.1
Expand Down Expand Up @@ -14472,16 +14456,16 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-jest-dom@npm:^4.0.3":
version: 4.0.3
resolution: "eslint-plugin-jest-dom@npm:4.0.3"
"eslint-plugin-jest-dom@npm:^5.0.0":
version: 5.0.1
resolution: "eslint-plugin-jest-dom@npm:5.0.1"
dependencies:
"@babel/runtime": ^7.16.3
"@testing-library/dom": ^8.11.1
requireindex: ^1.2.0
peerDependencies:
"@testing-library/dom": ^8.0.0 || ^9.0.0
eslint: ^6.8.0 || ^7.0.0 || ^8.0.0
checksum: 6bd22cdb7951a4b9ac65fe35c7bdc3e44cbe09918c79535fa698433d730392ef7a6faa55468b84d1cb0303a923266a05d45e38278d88380b0f09c8e8f57c75de
checksum: aad1ccae292e8b77be0e034499a62502e074d6d631320efa8b7d9de4a1e484f0ab27480820fb4974cec49101df35c9d4a320643a7c93d2a08778fec283b1e2fd
languageName: node
linkType: hard

Expand Down Expand Up @@ -21235,7 +21219,7 @@ __metadata:
languageName: node
linkType: hard

"lz-string@npm:^1.4.4, lz-string@npm:^1.5.0":
"lz-string@npm:^1.5.0":
version: 1.5.0
resolution: "lz-string@npm:1.5.0"
bin:
Expand Down

0 comments on commit 2510869

Please sign in to comment.