File tree Expand file tree Collapse file tree 7 files changed +53
-4
lines changed
packages/eslint-plugin-svelte
tests/fixtures/rules/sort-attributes Expand file tree Collapse file tree 7 files changed +53
-4
lines changed Original file line number Diff line number Diff line change 5656 "sass" : " ^1.81.0" ,
5757 "source-map-js" : " ^1.2.1" ,
5858 "stylus" : " ^0.64.0" ,
59- "svelte" : " ^5.2.10 " ,
59+ "svelte" : " ^5.30.1 " ,
6060 "svelte-adapter-ghpages" : " 0.2.2" ,
6161 "twoslash-eslint" : " ^0.3.0" ,
6262 "twoslash-protocol" : " ^0.3.0" ,
Original file line number Diff line number Diff line change 6464 "postcss-load-config" : " ^3.1.4" ,
6565 "postcss-safe-parser" : " ^7.0.0" ,
6666 "semver" : " ^7.6.3" ,
67- "svelte-eslint-parser" : " ^1.1.1 "
67+ "svelte-eslint-parser" : " ^1.2.0 "
6868 },
6969 "devDependencies" : {
7070 "@babel/core" : " ^7.26.0" ,
9595 "sass" : " ^1.81.0" ,
9696 "source-map-js" : " ^1.2.1" ,
9797 "stylus" : " ^0.64.0" ,
98- "svelte" : " ^5.2.9 " ,
98+ "svelte" : " ^5.30.1 " ,
9999 "svelte-i18n" : " ^4.0.1" ,
100100 "tsx" : " ^4.19.2" ,
101101 "type-coverage" : " ^2.29.7" ,
Original file line number Diff line number Diff line change @@ -462,7 +462,8 @@ export function getAttributeKeyText(
462462 | SvAST . SvelteStyleDirective
463463 | SvAST . SvelteDirective
464464 | SvAST . SvelteSpecialDirective
465- | SvAST . SvelteGenericsDirective ,
465+ | SvAST . SvelteGenericsDirective
466+ | SvAST . SvelteAttachTag ,
466467 context : RuleContext
467468) : string {
468469 switch ( node . type ) {
@@ -480,6 +481,8 @@ export function getAttributeKeyText(
480481 node . key . modifiers . length ? `|${ node . key . modifiers . join ( '|' ) } ` : ''
481482 } `;
482483 }
484+ case 'SvelteAttachTag' :
485+ return '@attach' ;
483486 default :
484487 throw new Error (
485488 `Unknown node type: ${
Original file line number Diff line number Diff line change 1+ - message : Attribute '@attach' should go before 'foo'.
2+ line : 14
3+ column : 10
4+ suggestions : null
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import type { Attachment } from ' svelte/attachments' ;
3+
4+
5+ const myAttachment: Attachment = (element ) => {
6+ console .log (element .nodeName ); // 'DIV'
7+
8+ return () => {
9+ console .log (' cleaning up' );
10+ };
11+ };
12+ </script >
13+
14+ <div foo {@attach myAttachment }>...</div >
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import type { Attachment } from ' svelte/attachments' ;
3+
4+
5+ const myAttachment: Attachment = (element ) => {
6+ console .log (element .nodeName ); // 'DIV'
7+
8+ return () => {
9+ console .log (' cleaning up' );
10+ };
11+ };
12+ </script >
13+
14+ <div {@attach myAttachment } foo >...</div >
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import type { Attachment } from ' svelte/attachments' ;
3+
4+
5+ const myAttachment: Attachment = (element ) => {
6+ console .log (element .nodeName ); // 'DIV'
7+
8+ return () => {
9+ console .log (' cleaning up' );
10+ };
11+ };
12+ </script >
13+
14+ <div {@attach myAttachment }>...</div >
You can’t perform that action at this time.
0 commit comments