@@ -101,19 +101,22 @@ describe('PackageURL', () => {
101101 }
102102
103103 it ( 'should validate required params' , ( ) => {
104- const testValid = paramName => {
104+ // eslint-disable-next-line unicorn/consistent-function-scoping
105+ function testValid ( paramName ) {
105106 const paramIndex = paramMap [ paramName ]
106107 const args = createArgs ( paramName , paramName )
107108 const message = JSON . stringify ( args [ paramIndex ] )
108109 try {
110+ // eslint-disable-next-line no-new
109111 new PackageURL ( ...args )
110112 assert . ok ( true , message )
111113 } catch {
112114 assert . ok ( false , message )
113115 }
114116 }
115117
116- const testInvalid = paramName => {
118+ // eslint-disable-next-line unicorn/consistent-function-scoping
119+ function testInvalid ( paramName ) {
117120 const paramIndex = paramMap [ paramName ]
118121 ; [
119122 createArgs ( paramName , 0 ) ,
@@ -127,6 +130,7 @@ describe('PackageURL', () => {
127130 ] . forEach ( args => {
128131 const message = JSON . stringify ( args [ paramIndex ] )
129132 try {
133+ // eslint-disable-next-line no-new
130134 new PackageURL ( ...args )
131135 assert . ok ( false , message )
132136 } catch {
@@ -135,14 +139,15 @@ describe('PackageURL', () => {
135139 } )
136140 }
137141
138- ; [ 'type' , 'name' ] . forEach ( paramName => {
142+ for ( const paramName of [ 'type' , 'name' ] ) {
139143 testValid ( paramName )
140144 testInvalid ( paramName )
141- } )
145+ }
142146 } )
143147
144148 it ( 'should validate string params' , ( ) => {
145- const testValid = paramName => {
149+ // eslint-disable-next-line unicorn/consistent-function-scoping
150+ function testValid ( paramName ) {
146151 const paramIndex = paramMap [ paramName ]
147152 ; [
148153 createArgs ( paramName , paramName ) ,
@@ -152,6 +157,7 @@ describe('PackageURL', () => {
152157 ] . forEach ( args => {
153158 const message = JSON . stringify ( args [ paramIndex ] )
154159 try {
160+ // eslint-disable-next-line no-new
155161 new PackageURL ( ...args )
156162 assert . ok ( true , message )
157163 } catch {
@@ -160,7 +166,8 @@ describe('PackageURL', () => {
160166 } )
161167 }
162168
163- const testInvalid = paramName => {
169+ // eslint-disable-next-line unicorn/consistent-function-scoping
170+ function testInvalid ( paramName ) {
164171 const paramIndex = paramMap [ paramName ]
165172 ; [
166173 createArgs ( paramName , 0 ) ,
@@ -171,6 +178,7 @@ describe('PackageURL', () => {
171178 ] . forEach ( args => {
172179 const message = JSON . stringify ( args [ paramIndex ] )
173180 try {
181+ // eslint-disable-next-line no-new
174182 new PackageURL ( ...args )
175183 assert . ok ( false , message )
176184 } catch {
@@ -179,10 +187,10 @@ describe('PackageURL', () => {
179187 } )
180188 }
181189
182- ; [ 'namespace' , 'version' , 'subpath' ] . forEach ( paramName => {
190+ for ( const paramName of [ 'namespace' , 'version' , 'subpath' ] ) {
183191 testValid ( paramName )
184192 testInvalid ( paramName )
185- } )
193+ }
186194 } )
187195
188196 it ( 'should not decode params' , ( ) => {
@@ -489,7 +497,7 @@ describe('PackageURL', () => {
489497 const parts = builtinName . split ( '/' )
490498 const namespace = parts . length > 1 ? parts [ 0 ] : ''
491499 const name = parts . at ( - 1 )
492-
500+ // eslint-disable-next-line no-new
493501 new PackageURL ( 'npm' , namespace , name )
494502 } , `assert for ${ builtinName } ` )
495503 }
0 commit comments