File tree Expand file tree Collapse file tree 9 files changed +61
-6
lines changed
packages/eslint-plugin-svelte
tests/fixtures/rules/sort-attributes Expand file tree Collapse file tree 9 files changed +61
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' eslint-plugin-svelte ' : minor
3
+ ---
4
+
5
+ feat(sort-attributes): support ` {@attach} `
Original file line number Diff line number Diff line change 56
56
"sass" : " ^1.81.0" ,
57
57
"source-map-js" : " ^1.2.1" ,
58
58
"stylus" : " ^0.64.0" ,
59
- "svelte" : " ^5.2.10 " ,
59
+ "svelte" : " ^5.30.1 " ,
60
60
"svelte-adapter-ghpages" : " 0.2.2" ,
61
61
"twoslash-eslint" : " ^0.3.0" ,
62
62
"twoslash-protocol" : " ^0.3.0" ,
Original file line number Diff line number Diff line change 64
64
"postcss-load-config" : " ^3.1.4" ,
65
65
"postcss-safe-parser" : " ^7.0.0" ,
66
66
"semver" : " ^7.6.3" ,
67
- "svelte-eslint-parser" : " ^1.1.1 "
67
+ "svelte-eslint-parser" : " ^1.2.0 "
68
68
},
69
69
"devDependencies" : {
70
70
"@babel/core" : " ^7.26.0" ,
95
95
"sass" : " ^1.81.0" ,
96
96
"source-map-js" : " ^1.2.1" ,
97
97
"stylus" : " ^0.64.0" ,
98
- "svelte" : " ^5.2.9 " ,
98
+ "svelte" : " ^5.30.1 " ,
99
99
"svelte-i18n" : " ^4.0.1" ,
100
100
"tsx" : " ^4.19.2" ,
101
101
"type-coverage" : " ^2.29.7" ,
Original file line number Diff line number Diff line change 1
1
// IMPORTANT!
2
2
// This file has been automatically generated,
3
3
// in order to update its content execute "pnpm run update"
4
- export const name = 'eslint-plugin-svelte' as const ;
5
- export const version = '3.6.0' as const ;
4
+ export const name = 'eslint-plugin-svelte' ;
5
+ export const version = '3.6.0' ;
Original file line number Diff line number Diff line change @@ -462,7 +462,8 @@ export function getAttributeKeyText(
462
462
| SvAST . SvelteStyleDirective
463
463
| SvAST . SvelteDirective
464
464
| SvAST . SvelteSpecialDirective
465
- | SvAST . SvelteGenericsDirective ,
465
+ | SvAST . SvelteGenericsDirective
466
+ | SvAST . SvelteAttachTag ,
466
467
context : RuleContext
467
468
) : string {
468
469
switch ( node . type ) {
@@ -480,6 +481,8 @@ export function getAttributeKeyText(
480
481
node . key . modifiers . length ? `|${ node . key . modifiers . join ( '|' ) } ` : ''
481
482
} `;
482
483
}
484
+ case 'SvelteAttachTag' :
485
+ return '@attach' ;
483
486
default :
484
487
throw new Error (
485
488
`Unknown node type: ${
@@ -556,6 +559,7 @@ export function findClassesInAttribute(
556
559
| SvAST . SvelteStyleDirective
557
560
| SvAST . SvelteSpecialDirective
558
561
| SvAST . SvelteGenericsDirective
562
+ | SvAST . SvelteAttachTag
559
563
) : string [ ] {
560
564
if ( attribute . type === 'SvelteAttribute' && attribute . key . name === 'class' ) {
561
565
return attribute . value . flatMap ( ( value ) =>
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