Skip to content

Commit 1117dee

Browse files
committed
update
1 parent 913d0b3 commit 1117dee

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

docs/rules/no-svelte-internal.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description: 'svelte/internal will be removed in Svelte 6.'
1313

1414
## :book: Rule Details
1515

16-
This rule reports ???.
16+
This rule reports the use of the deprecated API `svelte/internal` and `svelte/internal/xxx`. `svelte/internal` is deprecated in Svelte 5. And it will be deleted in Svelte 6. These APIs can change in breaking ways at any time without notice.
1717

1818
<ESLintCodeBlock>
1919

@@ -22,28 +22,26 @@ This rule reports ???.
2222
```svelte
2323
<script>
2424
/* eslint svelte/no-svelte-internal: "error" */
25-
</script>
26-
27-
<!-- ✓ GOOD -->
25+
// ✓ GOOD
26+
import { mount } from 'svelte';
2827
29-
<!-- ✗ BAD -->
28+
// ✗ BAD
29+
import { get_current_component } from 'svelte/internal';
30+
import { inspect } from 'svelte/internal/client';
31+
</script>
3032
```
3133

3234
</ESLintCodeBlock>
3335

3436
## :wrench: Options
3537

36-
```json
37-
{
38-
"svelte/no-svelte-internal": ["error", {}]
39-
}
40-
```
38+
Nothing.
4139

4240
-
4341

4442
## :books: Further Reading
4543

46-
-
44+
Nothing.
4745

4846
## :mag: Implementation
4947

src/rules/no-svelte-internal.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export default createRule('no-svelte-internal', {
1818
create(context) {
1919
return {
2020
ImportDeclaration(node) {
21-
if (node.source.value === 'svelte/internal') {
21+
if (
22+
node.source.value === 'svelte/internal' ||
23+
node.source.value.startsWith('svelte/internal/')
24+
) {
2225
context.report({
2326
node,
2427
messageId: 'unexpected'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- message: Importing from svelte/internal is prohibited. This will be removed in Svelte 6.
2+
line: 2
3+
column: 2
4+
suggestions: null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
import { inspect } from 'svelte/internal/client';
3+
</script>

0 commit comments

Comments
 (0)