11import { LINT_MESSAGES } from '../constants.mjs' ;
2- import { valid } from 'semver' ;
2+ import { valid , parse } from 'semver' ;
33import { env } from 'node:process' ;
44
55const NODE_RELEASED_VERSIONS = env . NODE_RELEASED_VERSIONS ?. split ( ',' ) ;
@@ -14,6 +14,21 @@ const NODE_RELEASED_VERSIONS = env.NODE_RELEASED_VERSIONS?.split(',');
1414const isValidReplaceMe = ( version , length ) =>
1515 length === 1 && version === 'REPLACEME' ;
1616
17+ /**
18+ * Checks if a given semantic version should be ignored.
19+ * A version is considered ignored if its major version is 0 and minor version is less than 2.
20+ *
21+ * These versions are extremely old, and are not shown in the changelog used to generate
22+ * `NODE_RELEASED_VERSIONS`, so they must be hardcoded.
23+ *
24+ * @param {string } version - The version to check.
25+ * @returns {boolean } Returns true if the version is ignored, false otherwise.
26+ */
27+ const isIgnoredVersion = version => {
28+ const { major, minor } = parse ( version ) || { } ;
29+ return major === 0 && minor < 2 ;
30+ } ;
31+
1732/**
1833 * Determines if a given version is invalid.
1934 *
@@ -26,6 +41,7 @@ const isInvalid = NODE_RELEASED_VERSIONS
2641 ? ( version , _ , { length } ) =>
2742 ! (
2843 isValidReplaceMe ( version , length ) ||
44+ isIgnoredVersion ( version ) ||
2945 NODE_RELEASED_VERSIONS . includes ( version . replace ( / ^ v / , '' ) )
3046 )
3147 : ( version , _ , { length } ) =>
0 commit comments