@@ -31,9 +31,7 @@ const calculateScore = (diagnostics: DiagnosticInput[]): number => {
3131 }
3232 }
3333
34- const penalty =
35- errorRules . size * ERROR_RULE_PENALTY +
36- warningRules . size * WARNING_RULE_PENALTY ;
34+ const penalty = errorRules . size * ERROR_RULE_PENALTY + warningRules . size * WARNING_RULE_PENALTY ;
3735
3836 return Math . max ( 0 , Math . round ( PERFECT_SCORE - penalty ) ) ;
3937} ;
@@ -54,8 +52,7 @@ const CORS_HEADERS = {
5452 "Access-Control-Allow-Headers" : "Content-Type" ,
5553} ;
5654
57- export const OPTIONS = ( ) : Response =>
58- new Response ( null , { status : 204 , headers : CORS_HEADERS } ) ;
55+ export const OPTIONS = ( ) : Response => new Response ( null , { status : 204 , headers : CORS_HEADERS } ) ;
5956
6057export const POST = async ( request : Request ) : Promise < Response > => {
6158 const body = await request . json ( ) . catch ( ( ) => null ) ;
@@ -67,21 +64,19 @@ export const POST = async (request: Request): Promise<Response> => {
6764 ) ;
6865 }
6966
70- const isValidPayload = body . diagnostics . every (
71- ( entry : unknown ) => isValidDiagnostic ( entry ) ,
72- ) ;
67+ const isValidPayload = body . diagnostics . every ( ( entry : unknown ) => isValidDiagnostic ( entry ) ) ;
7368
7469 if ( ! isValidPayload ) {
7570 return Response . json (
76- { error : "Each diagnostic must have 'plugin' (string), 'rule' (string), and 'severity' ('error' | 'warning')" } ,
71+ {
72+ error :
73+ "Each diagnostic must have 'plugin' (string), 'rule' (string), and 'severity' ('error' | 'warning')" ,
74+ } ,
7775 { status : 400 , headers : CORS_HEADERS } ,
7876 ) ;
7977 }
8078
8179 const score = calculateScore ( body . diagnostics ) ;
8280
83- return Response . json (
84- { score, label : getScoreLabel ( score ) } ,
85- { headers : CORS_HEADERS } ,
86- ) ;
81+ return Response . json ( { score, label : getScoreLabel ( score ) } , { headers : CORS_HEADERS } ) ;
8782} ;
0 commit comments