1
1
import { LINT_MESSAGES } from '../constants.mjs' ;
2
- import { valid } from 'semver' ;
2
+ import { valid , parse } from 'semver' ;
3
3
import { env } from 'node:process' ;
4
4
5
5
const NODE_RELEASED_VERSIONS = env . NODE_RELEASED_VERSIONS ?. split ( ',' ) ;
@@ -14,6 +14,21 @@ const NODE_RELEASED_VERSIONS = env.NODE_RELEASED_VERSIONS?.split(',');
14
14
const isValidReplaceMe = ( version , length ) =>
15
15
length === 1 && version === 'REPLACEME' ;
16
16
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
+
17
32
/**
18
33
* Determines if a given version is invalid.
19
34
*
@@ -26,6 +41,7 @@ const isInvalid = NODE_RELEASED_VERSIONS
26
41
? ( version , _ , { length } ) =>
27
42
! (
28
43
isValidReplaceMe ( version , length ) ||
44
+ isIgnoredVersion ( version ) ||
29
45
NODE_RELEASED_VERSIONS . includes ( version . replace ( / ^ v / , '' ) )
30
46
)
31
47
: ( version , _ , { length } ) =>
0 commit comments