File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
2424export interface LanguageServiceContainer {
2525 readonly tsconfigPath : string ;
2626 readonly compilerOptions : ts . CompilerOptions ;
27+ readonly configErrors : ts . Diagnostic [ ] ;
2728 /**
2829 * @internal Public for tests only
2930 */
@@ -167,6 +168,7 @@ async function createLanguageService(
167168
168169 const {
169170 options : compilerOptions ,
171+ errors : configErrors ,
170172 fileNames : files ,
171173 raw,
172174 extendedConfigPaths
@@ -247,6 +249,7 @@ async function createLanguageService(
247249 return {
248250 tsconfigPath,
249251 compilerOptions,
252+ configErrors,
250253 getService : ( ) => languageService ,
251254 updateSnapshot,
252255 deleteSnapshot,
Original file line number Diff line number Diff line change @@ -181,6 +181,12 @@ export class SvelteCheck {
181181
182182 private async getDiagnosticsForTsconfig ( tsconfigPath : string ) {
183183 const lsContainer = await this . getLSContainer ( tsconfigPath ) ;
184+
185+ const noInputsFoundError = lsContainer . configErrors ?. find ( ( e ) => e . code === 18003 ) ;
186+ if ( noInputsFoundError ) {
187+ throw new Error ( noInputsFoundError . messageText . toString ( ) ) ;
188+ }
189+
184190 const lang = lsContainer . getService ( ) ;
185191 const files = lang . getProgram ( ) ?. getSourceFiles ( ) || [ ] ;
186192 const options = lang . getProgram ( ) ?. getCompilerOptions ( ) || { } ;
Original file line number Diff line number Diff line change @@ -81,7 +81,9 @@ export function parseOptions(cb: (opts: SvelteCheckCliOptions) => any) {
8181 } ) ;
8282 } ) ;
8383
84- prog . parse ( process . argv ) ;
84+ prog . parse ( process . argv , {
85+ unknown : ( arg ) => `Unknown option ${ arg } `
86+ } ) ;
8587}
8688
8789const outputFormats = [ 'human' , 'human-verbose' , 'machine' ] as const ;
Original file line number Diff line number Diff line change @@ -112,8 +112,13 @@ export class HumanFriendlyWriter implements Writer {
112112 const message = [
113113 'svelte-check found ' ,
114114 `${ errorCount } ${ errorCount === 1 ? 'error' : 'errors' } and ` ,
115- `${ warningCount } ${ warningCount === 1 ? 'warning' : 'warnings' } in ` ,
116- `${ fileCountWithProblems } ${ fileCountWithProblems === 1 ? 'file' : 'files' } \n`
115+ `${ warningCount } ${ warningCount === 1 ? 'warning' : 'warnings' } ` ,
116+ `${
117+ fileCountWithProblems
118+ ? // prettier-ignore
119+ ` in ${ fileCountWithProblems } ${ fileCountWithProblems === 1 ? 'file' : 'files' } `
120+ : ''
121+ } \n`
117122 ] . join ( '' ) ;
118123 if ( errorCount !== 0 ) {
119124 this . stream . write ( pc . red ( message ) ) ;
You can’t perform that action at this time.
0 commit comments