For local dev and CI we want to have the eslint-local-rules running, so let's make sure both have their dependencies installed. We don't use a monorepo setup here, which is why they're currently setup as a two completely independent yarn workspaces.
In https://github.com/facebook/react/pull/34462 for example, we found an issue where the compiler was incorrectly validating an example straight from the docs.
In order to find more issues like this + also provide more feedback to doc authors on valid/invalid patterns, this PR adds a new local eslint rule which validates all markdown codeblocks containing components/hooks with React Compiler. An autofixer is also provided.
To express that a codeblock has an expected error, we can use the following metadata:
```ts
// pseudo type def
type MarkdownCodeBlockMetadata = {
expectedErrors?: {
'react-compiler'?: number[];
};
};
```
and can be used like so:
````
```js {expectedErrors: {'react-compiler': [4]}}
// ❌ setState directly in render
function Component({value}) {
const [count, setCount] = useState(0);
setCount(value); // error on L4
return <div>{count}</div>;
}
```
````
Because this is defined as a local rule, we don't have the same granular reporting that `eslint-plugin-react-hooks` yet. I can look into that later but for now this first PR just sets us up with something basic.
* [ci] Fix permissions and don't use pull_request_target
Defaults permissions to none for all workflows, and only request extra permissions when needed.
Similar to https://github.com/facebook/react/pull/32708, prefer the less permissive `pull_request` trigger instead.
* [ci] Pin 3rd party actions to specific hash
Defaults permissions to none for all workflows, and only request extra permissions when needed.
Similar to https://github.com/facebook/react/pull/32708, prefer the less permissive `pull_request` trigger instead.
Ports over the fix in the facebook/react repo for this workflow. We don't have to wait for it to be labeled first, now that we have the reusable maintainer check.
* Upgrade React and Next
* Fix bug in useNestedScrollLock
I guess refs get disconnected before passive effect cleanup runs. useLayoutEffect would also fix it but maybe this is better.
* Added hook to validate if headings are present or not
* Remove un wanted default param
* Add validate Ids to ci check too
* Revamp heading id generation and validation workflow
* Update validateHeadingIDs.js
* Add prettier before commit and during CI
* Add workflow
* Reverse merge main to branch
* dry run prettier
* dry run prettier
* [warn] jsxBracketSameLine is deprecated so replaced it to bracketSameLine
* Revert "[warn] jsxBracketSameLine is deprecated so replaced it to bracketSameLine"
This reverts commit 43dbe9ed3f.
* Revert "dry run prettier"
This reverts commit b62948042c.
* Revert "dry run prettier"
This reverts commit 382f9a4691.
* Revert "Reverse merge main to branch"
This reverts commit 43667eaf29.
* [warn] jsxBracketSameLine is deprecated so replaced it to bracketSameLine