Skip to content

Commit c6303fe

Browse files
committed
chore: deprecated the no-goto-without-base rule
1 parent e0d6ec8 commit c6303fe

File tree

8 files changed

+24
-14
lines changed

8 files changed

+24
-14
lines changed

.changeset/loud-rockets-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': minor
3+
---
4+
5+
chore: deprecated the no-navigation-without-base rule

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ These rules relate to SvelteKit and its best Practices.
363363
| Rule ID | Description | |
364364
|:--------|:------------|:---|
365365
| [svelte/no-export-load-in-svelte-module-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-export-load-in-svelte-module-in-kit-pages/) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | :star: |
366-
| [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
367366
| [svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/) | disallow props other than data or errors in SvelteKit page components. | :star: |
368367

369368
## Experimental
@@ -393,7 +392,8 @@ These rules relate to this plugin works:
393392
|:--------|:------------|
394393
| [svelte/@typescript-eslint/no-unnecessary-condition](https://sveltejs.github.io/eslint-plugin-svelte/rules/@typescript-eslint/no-unnecessary-condition/) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
395394
| [svelte/no-dynamic-slot-name](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-dynamic-slot-name/) | Now Svelte compiler itself throws an compile error. |
396-
| [svelte/no-goto-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-goto-without-base/) | [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) |
395+
| [svelte/no-goto-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-goto-without-base/) | [svelte/no-navigation-without-resolve](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-resolve/) |
396+
| [svelte/no-navigation-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/) | [svelte/no-navigation-without-resolve](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-resolve/) |
397397

398398
<!--RULES_TABLE_END-->
399399
<!--RULES_SECTION_END-->

docs/rules.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ These rules extend the rules provided by ESLint itself, or other plugins to work
117117

118118
These rules relate to SvelteKit and its best Practices.
119119

120-
| Rule ID | Description | |
121-
| :------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :----- |
122-
| [svelte/no-export-load-in-svelte-module-in-kit-pages](./rules/no-export-load-in-svelte-module-in-kit-pages.md) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | :star: |
123-
| [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) | disallow using navigation (links, goto, pushState, replaceState) without the base path | |
124-
| [svelte/valid-prop-names-in-kit-pages](./rules/valid-prop-names-in-kit-pages.md) | disallow props other than data or errors in SvelteKit page components. | :star: |
120+
| Rule ID | Description | |
121+
| :------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- | :----- |
122+
| [svelte/no-export-load-in-svelte-module-in-kit-pages](./rules/no-export-load-in-svelte-module-in-kit-pages.md) | disallow exporting load functions in `*.svelte` module in SvelteKit page components. | :star: |
123+
| [svelte/valid-prop-names-in-kit-pages](./rules/valid-prop-names-in-kit-pages.md) | disallow props other than data or errors in SvelteKit page components. | :star: |
125124

126125
## Experimental
127126

@@ -146,8 +145,9 @@ These rules relate to this plugin works:
146145
- :warning: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
147146
- :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resources.
148147

149-
| Rule ID | Replaced by |
150-
| :----------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------- |
151-
| [svelte/@typescript-eslint/no-unnecessary-condition](./rules/@typescript-eslint/no-unnecessary-condition.md) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
152-
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | Now Svelte compiler itself throws an compile error. |
153-
| [svelte/no-goto-without-base](./rules/no-goto-without-base.md) | [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) |
148+
| Rule ID | Replaced by |
149+
| :----------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- |
150+
| [svelte/@typescript-eslint/no-unnecessary-condition](./rules/@typescript-eslint/no-unnecessary-condition.md) | This rule is no longer needed when using svelte-eslint-parser>=v0.19.0. |
151+
| [svelte/no-dynamic-slot-name](./rules/no-dynamic-slot-name.md) | Now Svelte compiler itself throws an compile error. |
152+
| [svelte/no-goto-without-base](./rules/no-goto-without-base.md) | [svelte/no-navigation-without-resolve](./rules/no-navigation-without-resolve.md) |
153+
| [svelte/no-navigation-without-base](./rules/no-navigation-without-base.md) | [svelte/no-navigation-without-resolve](./rules/no-navigation-without-resolve.md) |

docs/rules/no-goto-without-base.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ since: 'v2.36.0-next.9'
1010

1111
> disallow using goto() without the base path
1212
13-
- :warning: This rule was **deprecated** and replaced by [svelte/no-navigation-without-base](no-navigation-without-base.md) rule.
13+
- :warning: This rule was **deprecated** and replaced by [svelte/no-navigation-without-resolve](no-navigation-without-resolve.md) rule.
1414

1515
## :book: Rule Details
1616

docs/rules/no-navigation-without-base.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ since: 'v2.36.0-next.9'
1010

1111
> disallow using navigation (links, goto, pushState, replaceState) without the base path
1212
13+
- :warning: This rule was **deprecated** and replaced by [svelte/no-navigation-without-resolve](no-navigation-without-resolve.md) rule.
14+
1315
## :book: Rule Details
1416

1517
This rule reports navigation using HTML `<a>` tags, SvelteKit's `goto()`, `pushState()` and `replaceState()` functions without prefixing a relative URL with the base path. All four of these may be used for navigation, with `goto()`, `pushState()` and `replaceState()` being intended solely for iternal navigation (i.e. not leaving the site), while `<a>` tags may be used for both internal and external navigation. When using any way of internal navigation, the base path must be prepended, otherwise the site may break. For programmatic navigation to external URLs, using `window.location` is advised.

packages/eslint-plugin-svelte/src/rule-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export interface RuleOptions {
189189
/**
190190
* disallow using navigation (links, goto, pushState, replaceState) without the base path
191191
* @see https://sveltejs.github.io/eslint-plugin-svelte/rules/no-navigation-without-base/
192+
* @deprecated
192193
*/
193194
'svelte/no-navigation-without-base'?: Linter.RuleEntry<SvelteNoNavigationWithoutBase>
194195
/**

packages/eslint-plugin-svelte/src/rules/no-goto-without-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { RuleContext } from '../types.js';
77
export default createRule('no-goto-without-base', {
88
meta: {
99
deprecated: true,
10-
replacedBy: ['no-navigation-without-base'],
10+
replacedBy: ['no-navigation-without-resolve'],
1111
docs: {
1212
description: 'disallow using goto() without the base path',
1313
category: 'SvelteKit',

packages/eslint-plugin-svelte/src/rules/no-navigation-without-base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import type { AST } from 'svelte-eslint-parser';
88

99
export default createRule('no-navigation-without-base', {
1010
meta: {
11+
deprecated: true,
12+
replacedBy: ['no-navigation-without-resolve'],
1113
docs: {
1214
description:
1315
'disallow using navigation (links, goto, pushState, replaceState) without the base path',

0 commit comments

Comments
 (0)