@@ -46,33 +46,33 @@ const isIgnoredVersion = version => {
4646/**
4747 * Determines if a given version is invalid.
4848 *
49- * @param {Scalar } version - The version to check.
49+ * @param {import('yaml'). Scalar } version - The version to check.
5050 * @param {unknown } _ - Unused parameter.
5151 * @param {{ length: number } } context - Array containing the length property.
5252 * @returns {boolean } True if the version is invalid, otherwise false.
5353 */
5454const isInvalid = NODE_RELEASED_VERSIONS
55- ? ( version , _ , { length } ) =>
55+ ? ( { value } , _ , { length } ) =>
5656 ! (
57- isValidReplaceMe ( version . value , length ) ||
58- isIgnoredVersion ( version . value ) ||
59- NODE_RELEASED_VERSIONS . includes ( version . value . replace ( / ^ v / , '' ) )
57+ isValidReplaceMe ( value , length ) ||
58+ isIgnoredVersion ( value ) ||
59+ NODE_RELEASED_VERSIONS . includes ( value . replace ( / ^ v / , '' ) )
6060 )
61- : ( version , _ , { length } ) =>
62- ! ( isValidReplaceMe ( version . value , length ) || valid ( version . value ) ) ;
61+ : ( { value } , _ , { length } ) =>
62+ ! ( isValidReplaceMe ( value , length ) || valid ( value ) ) ;
6363
6464/**
6565 * Validates and extracts versions of a change node
6666 *
6767 * @param {object } root0
6868 * @param {import('../types.d.ts').LintContext } root0.context
6969 * @param {import('yaml').Node } root0.node
70- * @param {(message: string, node: import('yaml').Node<unknown>) => import('../types.d.ts').IssueDescriptor } root0.report
70+ * @param {(message: string, node: import('yaml').Node<unknown>) => import('../types.d.ts').IssueDescriptor } root0.createYamlIssue
7171 */
72- export const extractVersions = ( { context, node, report } ) => {
72+ export const extractVersions = ( { context, node, createYamlIssue } ) => {
7373 if ( ! isMap ( node ) ) {
7474 context . report (
75- report (
75+ createYamlIssue (
7676 LINT_MESSAGES . invalidChangeProperty . replace ( '{{type}}' , node . type ) ,
7777 node
7878 )
@@ -84,7 +84,7 @@ export const extractVersions = ({ context, node, report }) => {
8484 const versionNode = findPropertyByName ( node , 'version' ) ;
8585
8686 if ( ! versionNode ) {
87- context . report ( report ( LINT_MESSAGES . missingChangeVersion , node ) ) ;
87+ context . report ( createYamlIssue ( LINT_MESSAGES . missingChangeVersion , node ) ) ;
8888
8989 return [ ] ;
9090 }
@@ -107,7 +107,7 @@ export const invalidChangeVersion = context => {
107107 const lineCounter = new LineCounter ( ) ;
108108 const document = parseDocument ( normalizedYaml , { lineCounter } ) ;
109109
110- const report = createYamlIssueReporter ( node , lineCounter ) ;
110+ const createYamlIssue = createYamlIssueReporter ( node , lineCounter ) ;
111111
112112 // Skip if yaml isn't a mapping
113113 if ( ! isMap ( document . contents ) ) {
@@ -124,7 +124,7 @@ export const invalidChangeVersion = context => {
124124 // Validate changes node is a sequence
125125 if ( ! isSeq ( changesNode . value ) ) {
126126 return context . report (
127- report (
127+ createYamlIssue (
128128 LINT_MESSAGES . invalidChangeProperty . replace (
129129 '{{type}}' ,
130130 changesNode . value . type
@@ -135,12 +135,12 @@ export const invalidChangeVersion = context => {
135135 }
136136
137137 changesNode . value . items . forEach ( node => {
138- extractVersions ( { context, node, report } )
138+ extractVersions ( { context, node, createYamlIssue } )
139139 . filter ( Boolean ) // Filter already reported empt items,
140140 . filter ( isInvalid )
141141 . forEach ( version =>
142142 context . report (
143- report (
143+ createYamlIssue (
144144 version ?. value
145145 ? LINT_MESSAGES . invalidChangeVersion . replace (
146146 '{{version}}' ,
0 commit comments