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 {
24
24
export interface LanguageServiceContainer {
25
25
readonly tsconfigPath : string ;
26
26
readonly compilerOptions : ts . CompilerOptions ;
27
+ readonly configErrors : ts . Diagnostic [ ] ;
27
28
/**
28
29
* @internal Public for tests only
29
30
*/
@@ -167,6 +168,7 @@ async function createLanguageService(
167
168
168
169
const {
169
170
options : compilerOptions ,
171
+ errors : configErrors ,
170
172
fileNames : files ,
171
173
raw,
172
174
extendedConfigPaths
@@ -247,6 +249,7 @@ async function createLanguageService(
247
249
return {
248
250
tsconfigPath,
249
251
compilerOptions,
252
+ configErrors,
250
253
getService : ( ) => languageService ,
251
254
updateSnapshot,
252
255
deleteSnapshot,
Original file line number Diff line number Diff line change @@ -181,6 +181,12 @@ export class SvelteCheck {
181
181
182
182
private async getDiagnosticsForTsconfig ( tsconfigPath : string ) {
183
183
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
+
184
190
const lang = lsContainer . getService ( ) ;
185
191
const files = lang . getProgram ( ) ?. getSourceFiles ( ) || [ ] ;
186
192
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) {
81
81
} ) ;
82
82
} ) ;
83
83
84
- prog . parse ( process . argv ) ;
84
+ prog . parse ( process . argv , {
85
+ unknown : ( arg ) => `Unknown option ${ arg } `
86
+ } ) ;
85
87
}
86
88
87
89
const 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 {
112
112
const message = [
113
113
'svelte-check found ' ,
114
114
`${ 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`
117
122
] . join ( '' ) ;
118
123
if ( errorCount !== 0 ) {
119
124
this . stream . write ( pc . red ( message ) ) ;
You can’t perform that action at this time.
0 commit comments