-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(no-navigation-without-base): added namespace import tests
- Loading branch information
1 parent
23e52f0
commit 1b9b252
Showing
10 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...sts/fixtures/rules/no-navigation-without-base/invalid/goto-namespace-import01-errors.yaml
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,4 @@ | ||
- message: Found a goto() call with a url that isn't prefixed with the base path. | ||
line: 4 | ||
column: 18 | ||
suggestions: null |
5 changes: 5 additions & 0 deletions
5
...ts/fixtures/rules/no-navigation-without-base/invalid/goto-namespace-import01-input.svelte
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 @@ | ||
<script> | ||
import * as navigation from '$app/navigation'; | ||
navigation.goto('/foo'); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
...ixtures/rules/no-navigation-without-base/invalid/pushState-namespace-import01-errors.yaml
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,4 @@ | ||
- message: Found a pushState() call with a url that isn't prefixed with the base path. | ||
line: 4 | ||
column: 23 | ||
suggestions: null |
5 changes: 5 additions & 0 deletions
5
...xtures/rules/no-navigation-without-base/invalid/pushState-namespace-import01-input.svelte
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 @@ | ||
<script> | ||
import * as navigation from '$app/navigation'; | ||
navigation.pushState('/foo'); | ||
</script> |
5 changes: 5 additions & 0 deletions
5
...ures/rules/no-navigation-without-base/invalid/replaceState-namespace-import01-errors.yaml
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 @@ | ||
- message: Found a replaceState() call with a url that isn't prefixed with the | ||
base path. | ||
line: 4 | ||
column: 26 | ||
suggestions: null |
5 changes: 5 additions & 0 deletions
5
...res/rules/no-navigation-without-base/invalid/replaceState-namespace-import01-input.svelte
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 @@ | ||
<script> | ||
import * as navigation from '$app/navigation'; | ||
navigation.replaceState('/foo'); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
...fixtures/rules/no-navigation-without-base/valid/goto-base-namespace-import01-input.svelte
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,8 @@ | ||
<script> | ||
import * as paths from '$app/paths'; | ||
import { goto } from '$app/navigation'; | ||
// eslint-disable-next-line prefer-template -- Testing both variants | ||
goto(paths.base + '/foo/'); | ||
goto(`${alias}/foo/`); | ||
</script> |
6 changes: 6 additions & 0 deletions
6
...fixtures/rules/no-navigation-without-base/valid/link-base-namespace-import01-input.svelte
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,6 @@ | ||
<script> | ||
import * as paths from '$app/paths'; | ||
</script> | ||
|
||
<a href={paths.base + '/foo/'}>Click me!</a>; | ||
<a href={`${alias}/foo/`}>Click me!</a>; |
8 changes: 8 additions & 0 deletions
8
...res/rules/no-navigation-without-base/valid/pushState-base-namespace-import01-input.svelte
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,8 @@ | ||
<script> | ||
import * as paths from '$app/paths'; | ||
import { pushState } from '$app/navigation'; | ||
// eslint-disable-next-line prefer-template -- Testing both variants | ||
pushState(paths.base + '/foo/'); | ||
pushState(`${alias}/foo/`); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
.../rules/no-navigation-without-base/valid/replaceState-base-namespace-import01-input.svelte
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,8 @@ | ||
<script> | ||
import * as paths from '$app/paths'; | ||
import { replaceState } from '$app/navigation'; | ||
// eslint-disable-next-line prefer-template -- Testing both variants | ||
replaceState(paths.base + '/foo/'); | ||
replaceState(`${alias}/foo/`); | ||
</script> |