File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " next-css-linter" ,
3- "version" : " 1.4.1 " ,
3+ "version" : " 1.5.0 " ,
44 "description" : " Linter for NextJs CSS modules" ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -14,14 +14,8 @@ pub struct Properties {
1414 pub exclude : Vec < String > ,
1515}
1616
17- pub fn get_compiler_options ( ) -> Properties {
18- let tsconfig_contents = fs:: read_to_string ( "tsconfig.json" )
19- . expect ( "Could not load tsconfig. Is the provided directory is typescript project?" ) ;
17+ pub fn get_compiler_options ( ) -> anyhow:: Result < Properties > {
18+ let tsconfig_contents = fs:: read_to_string ( "tsconfig.json" ) ?;
2019
21- let v: Properties = match serde_json:: from_str ( & tsconfig_contents) {
22- Ok ( res) => res,
23- Err ( err) => panic ! ( "{}" , err) ,
24- } ;
25-
26- v
20+ Ok ( serde_json:: from_str ( & tsconfig_contents) ?)
2721}
Original file line number Diff line number Diff line change @@ -67,7 +67,13 @@ fn main() -> Result<()> {
6767 ) ;
6868 process:: exit ( 1 ) ;
6969 }
70- let tsconfig = get_compiler_options ( ) ;
70+ let tsconfig = get_compiler_options ( ) . unwrap_or_else ( |e| {
71+ eprintln ! (
72+ "\n {}Error{}: Could not load tsconfig.json. Is the provided directory is typescript project? ({})" ,
73+ COLOR_RED , COLOR_RESET , e
74+ ) ;
75+ process:: exit ( 1 ) ;
76+ } ) ;
7177
7278 let dir = list_files_in_directory ( Path :: new ( "." ) . to_path_buf ( ) , tsconfig. exclude ) ;
7379
You can’t perform that action at this time.
0 commit comments