1- import { createHandler , BaseHandlerOptions } from '../shared/utils/handler-helpers.js' ;
21import {
3- createProjectAnalysisSchema ,
2+ BaseHandlerOptions ,
3+ createHandler ,
4+ } from '../shared/utils/handler-helpers.js' ;
5+ import {
46 COMMON_ANNOTATIONS ,
7+ createProjectAnalysisSchema ,
58} from '../shared/models/schema-helpers.js' ;
6- import {
7- analyzeProjectCoverage ,
8- } from '../shared/violation-analysis/coverage-analyzer.js' ;
9+ import { analyzeProjectCoverage } from '../shared/violation-analysis/coverage-analyzer.js' ;
910import { formatViolations } from '../shared/violation-analysis/formatters.js' ;
1011import { loadAndValidateDsComponentsFile } from '../../../validation/ds-components-file-loader.validation.js' ;
1112
@@ -17,7 +18,7 @@ interface ReportAllViolationsOptions extends BaseHandlerOptions {
1718export const reportAllViolationsSchema = {
1819 name : 'report-all-violations' ,
1920 description :
20- 'Report all deprecated DS CSS usage for every component defined in the config file within a directory. ' ,
21+ 'Scan a directory for deprecated design system CSS classes defined in the config at `deprecatedCssClassesPath`, and output a usage report ' ,
2122 inputSchema : createProjectAnalysisSchema ( {
2223 groupBy : {
2324 type : 'string' ,
@@ -32,9 +33,6 @@ export const reportAllViolationsSchema = {
3233 } ,
3334} ;
3435
35-
36- // Reuse centralized loader+validator for DS components config
37-
3836export const reportAllViolationsHandler = createHandler <
3937 ReportAllViolationsOptions ,
4038 string [ ]
@@ -57,20 +55,17 @@ export const reportAllViolationsHandler = createHandler<
5755 const raw = coverageResult . rawData ?. rawPluginResult ;
5856 if ( ! raw ) return [ ] ;
5957
60- // Reuse the existing minimal formatter so output format matches report-violations
61- // and respect groupBy option.
6258 const formattedContent = formatViolations ( raw , params . directory , {
6359 groupBy : groupBy === 'file' ? 'file' : 'folder' ,
6460 } ) ;
6561
66- // Extract text items to string[]
67- const lines = formattedContent . map ( ( item : { type ?: string ; text ?: string } | string ) => {
68- if ( typeof item === 'string' ) return item ;
69- if ( item && typeof item . text === 'string' ) return item . text ;
70- return String ( item ) ;
71- } ) ;
72-
73- return lines ;
62+ return formattedContent . map (
63+ ( item : { type ?: string ; text ?: string } | string ) => {
64+ if ( typeof item === 'string' ) return item ;
65+ if ( item && typeof item . text === 'string' ) return item . text ;
66+ return String ( item ) ;
67+ } ,
68+ ) ;
7469 } ,
7570 ( result ) => result ,
7671) ;
0 commit comments