@@ -2450,7 +2450,7 @@ const syncLintPendingState = () => {
24502450 setLintDiagnosticsPending ( componentLintPending || stylesLintPending )
24512451}
24522452
2453- const runComponentLint = async ( { userInitiated = false } = { } ) => {
2453+ const runComponentLint = ( { userInitiated = false , source = undefined } = { } ) => {
24542454 activeComponentLintAbortController ?. abort ( )
24552455 const controller = new AbortController ( )
24562456 activeComponentLintAbortController = controller
@@ -2460,24 +2460,28 @@ const runComponentLint = async ({ userInitiated = false } = {}) => {
24602460
24612461 setLintButtonLoading ( { button : lintComponentButton , isLoading : true } )
24622462
2463- try {
2464- const result = await lintDiagnostics . lintComponent ( {
2463+ return lintDiagnostics
2464+ . lintComponent ( {
24652465 signal : controller . signal ,
24662466 userInitiated,
2467+ source,
2468+ } )
2469+ . then ( result => {
2470+ if ( result ) {
2471+ lastComponentLintIssueCount = result . issueCount
2472+ }
2473+ return result
2474+ } )
2475+ . finally ( ( ) => {
2476+ decrementLintDiagnosticsRuns ( )
2477+ if ( activeComponentLintAbortController === controller ) {
2478+ activeComponentLintAbortController = null
2479+ setLintButtonLoading ( { button : lintComponentButton , isLoading : false } )
2480+ }
24672481 } )
2468- if ( result ) {
2469- lastComponentLintIssueCount = result . issueCount
2470- }
2471- } finally {
2472- decrementLintDiagnosticsRuns ( )
2473- if ( activeComponentLintAbortController === controller ) {
2474- activeComponentLintAbortController = null
2475- setLintButtonLoading ( { button : lintComponentButton , isLoading : false } )
2476- }
2477- }
24782482}
24792483
2480- const runStylesLint = async ( { userInitiated = false } = { } ) => {
2484+ const runStylesLint = ( { userInitiated = false , source = undefined } = { } ) => {
24812485 activeStylesLintAbortController ?. abort ( )
24822486 const controller = new AbortController ( )
24832487 activeStylesLintAbortController = controller
@@ -2487,21 +2491,25 @@ const runStylesLint = async ({ userInitiated = false } = {}) => {
24872491
24882492 setLintButtonLoading ( { button : lintStylesButton , isLoading : true } )
24892493
2490- try {
2491- const result = await lintDiagnostics . lintStyles ( {
2494+ return lintDiagnostics
2495+ . lintStyles ( {
24922496 signal : controller . signal ,
24932497 userInitiated,
2498+ source,
2499+ } )
2500+ . then ( result => {
2501+ if ( result ) {
2502+ lastStylesLintIssueCount = result . issueCount
2503+ }
2504+ return result
2505+ } )
2506+ . finally ( ( ) => {
2507+ decrementLintDiagnosticsRuns ( )
2508+ if ( activeStylesLintAbortController === controller ) {
2509+ activeStylesLintAbortController = null
2510+ setLintButtonLoading ( { button : lintStylesButton , isLoading : false } )
2511+ }
24942512 } )
2495- if ( result ) {
2496- lastStylesLintIssueCount = result . issueCount
2497- }
2498- } finally {
2499- decrementLintDiagnosticsRuns ( )
2500- if ( activeStylesLintAbortController === controller ) {
2501- activeStylesLintAbortController = null
2502- setLintButtonLoading ( { button : lintStylesButton , isLoading : false } )
2503- }
2504- }
25052513}
25062514
25072515const markTypeDiagnosticsStale = ( ) => {
@@ -2888,17 +2896,26 @@ if (diagnosticsClearAll) {
28882896}
28892897if ( typecheckButton ) {
28902898 typecheckButton . addEventListener ( 'click' , ( ) => {
2891- typeDiagnostics . triggerTypeDiagnostics ( { userInitiated : true } )
2899+ typeDiagnostics . triggerTypeDiagnostics ( {
2900+ userInitiated : true ,
2901+ source : getJsxSource ( ) ,
2902+ } )
28922903 } )
28932904}
28942905if ( lintComponentButton ) {
28952906 lintComponentButton . addEventListener ( 'click' , ( ) => {
2896- void runComponentLint ( { userInitiated : true } )
2907+ void runComponentLint ( {
2908+ userInitiated : true ,
2909+ source : getJsxSource ( ) ,
2910+ } )
28972911 } )
28982912}
28992913if ( lintStylesButton ) {
29002914 lintStylesButton . addEventListener ( 'click' , ( ) => {
2901- void runStylesLint ( { userInitiated : true } )
2915+ void runStylesLint ( {
2916+ userInitiated : true ,
2917+ source : getCssSource ( ) ,
2918+ } )
29022919 } )
29032920}
29042921renderButton . addEventListener ( 'click' , renderPreview )
0 commit comments