-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update no-exports-from-components rule to allow exceptions (#395)
* Update no-exports-from-components rule to allow exceptions * Create many-carrots-doubt.md * fix
- Loading branch information
Showing
6 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"eslint-plugin-astro": patch | ||
--- | ||
|
||
Update `astro/no-exports-from-components` rule to allow exceptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/fixtures/rules/no-exports-from-components/valid/exceptions-01-input.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
// This file is used to test the exceptions for the `no-exports-from-components` rule. | ||
// The following exports are allowed as exceptions. | ||
export const getStaticPath = (): { param: unknown }[] => { | ||
// logic here | ||
return [{ param: "value" }] | ||
} | ||
export const prerender = true | ||
--- | ||
|
||
<div>Hello World</div> |
9 changes: 9 additions & 0 deletions
9
tests/fixtures/rules/no-exports-from-components/valid/exceptions-02-input.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
// This file is used to test the exception for the `getStaticPath` function in the `no-exports-from-components` rule. | ||
export async function getStaticPath(): Promise<{ param: unknown }[]> { | ||
// logic here | ||
return [] | ||
} | ||
--- | ||
|
||
<div>Hello World</div> |
13 changes: 13 additions & 0 deletions
13
tests/fixtures/rules/no-exports-from-components/valid/exceptions-03-input.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
// This file is used to test the exceptions for the `no-exports-from-components` rule. | ||
// The following exports are allowed as exceptions. | ||
const getStaticPath = (): { param: unknown }[] => { | ||
// logic here | ||
return [] | ||
} | ||
const prerender = true | ||
export { getStaticPath, prerender } | ||
--- | ||
|
||
<div>Hello World</div> |