@@ -205,12 +205,12 @@ export interface AbsoluteVersionCheckerResult {
205
205
206
206
/**
207
207
* Determines whether or not all dependency versions are absolute
208
- * @param { object } packageJsonData Valid JSON
209
- * @param { string } nodeName Name of a node in the package.json file
210
- * @param { object } config Rule configuration
211
- * @return { boolean } False if the package has an non-absolute version. True if it is not or the node is missing.
208
+ * @param packageJsonData Valid JSON
209
+ * @param nodeName Name of a node in the package.json file
210
+ * @param config Rule configuration
211
+ * @return False if the package has an non-absolute version. True if it is not or the node is missing.
212
212
*/
213
- const absoluteVersionChecker = (
213
+ const auditAbsoluteVersions = (
214
214
// eslint-disable-next-line @typescript-eslint/no-explicit-any
215
215
packageJsonData : PackageJson | any ,
216
216
nodeName : string ,
@@ -256,32 +256,72 @@ const absoluteVersionChecker = (
256
256
} ;
257
257
} ;
258
258
259
+ export interface AuditDependenciesForAbsoluteVersionResponse {
260
+ onlyAbsoluteVersionsDetected : boolean ;
261
+ dependenciesWithAbsoluteVersion : string [ ] ;
262
+ dependenciesWithoutAbsoluteVersion : string [ ] ;
263
+ }
264
+
259
265
/**
260
266
* Determines whether or not all dependency versions are absolut
261
- * @param { object } packageJsonData Valid JSON
262
- * @param { string } nodeName Name of a node in the package.json file
263
- * @param { object } config Rule configuration
264
- * @return { boolean } False if the package has an non-absolute version. True if it is not or the node is missing.
267
+ * @param packageJsonData Valid JSON
268
+ * @param nodeName Name of a node in the package.json file
269
+ * @param config Rule configuration
270
+ * @return False if the package has an non-absolute version. True if it is not or the node is missing.
265
271
*/
266
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
- export const areVersionsAbsolute = ( packageJsonData : PackageJson | any , nodeName : string , config : any ) : boolean => {
268
- const { onlyAbsoluteVersionDetected, dependenciesChecked} = absoluteVersionChecker ( packageJsonData , nodeName , config ) ;
272
+ export const auditDependenciesForAbsoluteVersion = (
273
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
274
+ packageJsonData : PackageJson | any ,
275
+ nodeName : string ,
276
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
277
+ config : any
278
+ ) : AuditDependenciesForAbsoluteVersionResponse => {
279
+ const {
280
+ onlyAbsoluteVersionDetected,
281
+ dependenciesChecked,
282
+ dependenciesWithAbsoluteVersion,
283
+ dependenciesWithoutAbsoluteVersion,
284
+ } = auditAbsoluteVersions ( packageJsonData , nodeName , config ) ;
269
285
270
- return dependenciesChecked > 0 ? onlyAbsoluteVersionDetected : false ;
286
+ return {
287
+ onlyAbsoluteVersionsDetected : dependenciesChecked > 0 ? onlyAbsoluteVersionDetected : false ,
288
+ dependenciesWithAbsoluteVersion,
289
+ dependenciesWithoutAbsoluteVersion,
290
+ } ;
271
291
} ;
272
292
293
+ export interface AuditDependenciesForNonAbsoluteVersionResponse {
294
+ onlyNonAbsoluteVersionsDetected : boolean ;
295
+ dependenciesWithAbsoluteVersion : string [ ] ;
296
+ dependenciesWithoutAbsoluteVersion : string [ ] ;
297
+ }
298
+
273
299
/**
274
300
* Determines whether or not all dependency versions are absolut
275
301
* @param packageJsonData Valid JSON
276
302
* @param nodeName Name of a node in the package.json file
277
303
* @param config Rule configuration
278
304
* @return False if the package has an non-absolute version. True if it is not or the node is missing.
279
305
*/
280
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
281
- export const doVersContainNonAbsolute = ( packageJsonData : PackageJson | any , nodeName : string , config : any ) : boolean => {
282
- const { onlyAbsoluteVersionDetected, dependenciesChecked} = absoluteVersionChecker ( packageJsonData , nodeName , config ) ;
306
+ export const auditDependenciesForNonAbsoluteVersion = (
307
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
+ packageJsonData : PackageJson | any ,
309
+ nodeName : string ,
310
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
311
+ config : any
312
+ ) : AuditDependenciesForNonAbsoluteVersionResponse => {
313
+ const {
314
+ onlyAbsoluteVersionDetected,
315
+ dependenciesChecked,
316
+ dependenciesWithAbsoluteVersion,
317
+ dependenciesWithoutAbsoluteVersion,
318
+ } = auditAbsoluteVersions ( packageJsonData , nodeName , config ) ;
283
319
284
- return dependenciesChecked > 0 ? ! onlyAbsoluteVersionDetected : false ;
320
+ return {
321
+ onlyNonAbsoluteVersionsDetected : dependenciesChecked > 0 ? ! onlyAbsoluteVersionDetected : false ,
322
+ dependenciesWithAbsoluteVersion,
323
+ dependenciesWithoutAbsoluteVersion,
324
+ } ;
285
325
} ;
286
326
287
327
const GITHUB_SHORTCUT_URL = / ^ ( g i t h u b : ) ? [ ^ / ] + \/ [ ^ / ] + / ;
0 commit comments