Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change js code blocks containing JSX elements to jsx #3168

Merged
merged 1 commit into from
Jun 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div aria-hidden="true" tabIndex="0" />
/// ```
///
/// ```js, expect_diagnostic
/// ```jsx,expect_diagnostic
/// <a href="/" aria-hidden="true" />
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <button aria-hidden="true" tabIndex="-1" />
/// ```
///
/// ```js
/// ```jsx
/// <div aria-hidden="true"><a href="#"></a></div>
/// ```
///
Expand Down
24 changes: 12 additions & 12 deletions crates/biome_js_analyze/src/lint/a11y/no_svg_without_title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <svg>foo</svg>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <svg>
/// <title></title>
/// <circle />
/// </svg>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <svg>foo</svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg role="img" aria-label="">
/// <span id="">Pass</span>
/// </svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg role="presentation">foo</svg>
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <svg>
/// <rect />
/// <rect />
Expand All @@ -58,33 +58,33 @@ declare_rule! {
/// </svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg>
/// <title>Pass</title>
/// <circle />
/// </svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg role="img" aria-labelledby="title">
/// <span id="title">Pass</span>
/// </svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg role="img" aria-label="title">
/// <span id="title">Pass</span>
/// </svg>
/// ```
/// ```js
/// ```jsx
/// <svg role="graphics-symbol"><rect /></svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg role="graphics-symbol img"><rect /></svg>
/// ```
///
/// ```js
/// ```jsx
/// <svg aria-hidden="true"><rect /></svg>
/// ```
///
Expand Down
10 changes: 5 additions & 5 deletions crates/biome_js_analyze/src/lint/a11y/use_valid_aria_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div role="datepicker"></div>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div role="range"></div>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div role=""></div>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Foo role="foo"></Foo>
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <>
/// <div role="button"></div>
/// <div role={role}></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <FirstComponent children={'foo'} />
/// ```
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// [<Hello />];
/// ```
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// data.map((x) => <Hello>{x}</Hello>);
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// [<Hello key="first" />, <Hello key="second" />, <Hello key="third" />];
/// data.map((x) => <Hello key={x.id}>{x}</Hello>);
/// ```
Expand Down Expand Up @@ -92,7 +92,7 @@ impl Rule for UseJsxKeyInIterable {
///
/// Examples
///
/// ```js
/// ```jsx
/// [<h1></h1>, <h1></h1>]
/// ```
fn handle_collections(node: &JsArrayExpression, model: &SemanticModel) -> Vec<TextRange> {
Expand All @@ -114,7 +114,7 @@ fn handle_collections(node: &JsArrayExpression, model: &SemanticModel) -> Vec<Te
///
/// Examples
///
/// ```js
/// ```jsx
/// data.map(x => <h1>{x}</h1>)
/// ```
fn handle_iterators(node: &JsCallExpression, model: &SemanticModel) -> Option<Vec<TextRange>> {
Expand Down Expand Up @@ -285,7 +285,7 @@ fn handle_react_component(
///
/// Examples
///
/// ```js
/// ```jsx
/// <Hello></Hello>
/// ```
fn handle_jsx_tag(node: &JsxTagExpression, model: &SemanticModel) -> Option<Vec<TextRange>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Hello className="John" />
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <Hello class="Doe" />
/// ```
pub NoReactSpecificProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div role="button" />
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div role="tab" />
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <div role="button" tabIndex={0} />
/// ```
///
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_js_analyze/src/lint/style/use_fragment_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Fragment>child</Fragment>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <React.Fragment>child</React.Fragment>
/// ```
pub UseFragmentSyntax {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <div></div>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Component></Component>
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Foo.bar></Foo.bar>
/// ```
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl Rule for NoArrayIndexKey {
/// and check if the method called by this function belongs to an array method
/// and if the parameter is an array index
///
/// ```js
/// ```jsx
/// Array.map((_, index) => {
/// return <Component key={index} />
/// })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// const a3 = <div>// comment</div>;
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// const a4 = <div>/* comment */</div>;
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// const a5 = <div>/** comment */</div>;
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// const a = <div>{/* comment */}</div>;
/// const a1 = <div>{/** comment */}</div>;
/// const a2 = <div className={"cls" /* comment */}></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <Hello name="John" name="John" />
/// ```
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// <label xml:lang="en-US" xml:lang="en-US"></label>
/// ```
///
/// ### Valid
///
/// ```js
/// ```jsx
/// <Hello firstname="John" lastname="Doe" />
/// ```
///
/// ```js
/// ```jsx
/// <label xml:lang="en-US" lang="en-US"></label>
/// ```
pub NoDuplicateJsxProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare_rule! {
///
/// ### Invalid
///
/// ```js,expect_diagnostic
/// ```jsx,expect_diagnostic
/// const Component = () => {
/// return (
/// <div>
Expand All @@ -24,7 +24,7 @@ declare_rule! {
///
/// ### Valid
///
/// ```js
/// ```jsx
/// const Component = () => {
/// return (
/// <div>
Expand Down