@@ -90,6 +90,59 @@ fn no_recovery_remains_incomplete_and_javascript_does_not_use_typescript_grammar
9090 assert ! ( js_report. get( "syntax_precheck" ) . is_none( ) ) ;
9191}
9292
93+ #[ test]
94+ fn observed_project_local_eslint_candidate_is_not_treated_as_missing_native_lint ( ) {
95+ let project = Project :: new ( ) ;
96+ fs:: write ( project. 0 . join ( "app.ts" ) , "const value: number = ;\n " ) . unwrap ( ) ;
97+ fs:: write (
98+ project. 0 . join ( "package.json" ) ,
99+ r#"{"devDependencies":{"eslint":"10.0.0"}}"# ,
100+ )
101+ . unwrap ( ) ;
102+ fs:: write ( project. 0 . join ( "eslint.config.mjs" ) , "export default [];\n " ) . unwrap ( ) ;
103+ fs:: create_dir_all ( project. 0 . join ( "node_modules/eslint/bin" ) ) . unwrap ( ) ;
104+ fs:: write (
105+ project. 0 . join ( "node_modules/eslint/package.json" ) ,
106+ r#"{"name":"eslint","version":"10.0.0","bin":{"eslint":"bin/eslint.js"}}"# ,
107+ )
108+ . unwrap ( ) ;
109+ fs:: write (
110+ project. 0 . join ( "node_modules/eslint/bin/eslint.js" ) ,
111+ "process.exit(99);\n " ,
112+ )
113+ . unwrap ( ) ;
114+
115+ let ( status, report) = project. lint ( "app.ts" ) ;
116+ assert_eq ! ( status, 3 ) ;
117+ assert_eq ! ( report[ "reason" ] , "eslint_execution_context_missing" ) ;
118+ assert ! ( report. get( "syntax_precheck" ) . is_none( ) ) ;
119+ assert ! (
120+ report[ "next_action" ]
121+ . as_str( )
122+ . unwrap( )
123+ . contains( "项目本地 ESLint 候选" )
124+ ) ;
125+ assert_eq ! ( report[ "delivery_decision" ] , "not_evaluated" ) ;
126+ }
127+
128+ #[ test]
129+ fn configured_but_uninstalled_eslint_still_allows_candidate_precheck ( ) {
130+ let project = Project :: new ( ) ;
131+ fs:: write ( project. 0 . join ( "app.ts" ) , "const value: number = ;\n " ) . unwrap ( ) ;
132+ fs:: write (
133+ project. 0 . join ( "package.json" ) ,
134+ r#"{"devDependencies":{"eslint":"10.0.0"}}"# ,
135+ )
136+ . unwrap ( ) ;
137+ fs:: write ( project. 0 . join ( "eslint.config.mjs" ) , "export default [];\n " ) . unwrap ( ) ;
138+
139+ let ( status, report) = project. lint ( "app.ts" ) ;
140+ assert_eq ! ( status, 3 ) ;
141+ assert_eq ! ( report[ "native" ] [ "status" ] , "not_run" ) ;
142+ assert ! ( report. get( "syntax_precheck" ) . is_some( ) ) ;
143+ assert_eq ! ( report[ "delivery_decision" ] , "not_evaluated" ) ;
144+ }
145+
93146#[ test]
94147fn tsx_uses_its_own_grammar_instead_of_reporting_valid_jsx_as_suspect ( ) {
95148 let project = Project :: new ( ) ;
0 commit comments