File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -56,22 +56,11 @@ module.exports = function(eleventyConfig) {
56
56
// Load site-specific data
57
57
const siteName = process . env . ESLINT_SITE_NAME || "en" ;
58
58
59
- /**
60
- * Determines whether we are in the prerelease phase.
61
- * @returns {Promise<boolean> } `true` if there is a prerelease of the next major version, `false` otherwise.
62
- */
63
- async function isPrereleasePhase ( ) {
64
- const eslintVersions = await require ( "./src/_data/eslintVersions" ) ( ) ;
65
-
66
- return eslintVersions . items . some ( item => item . branch === "next" ) ;
67
- }
68
-
69
59
eleventyConfig . addGlobalData ( "site_name" , siteName ) ;
70
60
eleventyConfig . addGlobalData ( "GIT_BRANCH" , process . env . BRANCH ) ;
71
61
eleventyConfig . addGlobalData ( "HEAD" , process . env . BRANCH === "main" ) ;
72
62
eleventyConfig . addGlobalData ( "NOINDEX" , process . env . BRANCH !== "latest" ) ;
73
63
eleventyConfig . addGlobalData ( "PATH_PREFIX" , pathPrefix ) ;
74
- eleventyConfig . addGlobalData ( "is_prerelease_phase" , isPrereleasePhase ) ;
75
64
eleventyConfig . addGlobalData ( "is_number_version" , isNumberVersion ) ;
76
65
eleventyConfig . addDataExtension ( "yml" , contents => yaml . load ( contents ) ) ;
77
66
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ module.exports = async function() {
31
31
const { items } = data ;
32
32
33
33
let foundItemForThisBranch = false ;
34
+ let isPrereleasePhase = false ;
34
35
35
36
for ( const item of items ) {
36
37
const isItemForThisBranch = item . branch === thisBranch ;
@@ -54,6 +55,10 @@ module.exports = async function() {
54
55
if ( isItemForThisBranch ) {
55
56
item . selected = true ;
56
57
}
58
+
59
+ if ( item . branch === "next" ) {
60
+ isPrereleasePhase = true ;
61
+ }
57
62
}
58
63
59
64
// Add an empty item if this is not a production branch
@@ -67,5 +72,7 @@ module.exports = async function() {
67
72
} ) ;
68
73
}
69
74
75
+ data . isPrereleasePhase = isPrereleasePhase ;
76
+
70
77
return data ;
71
78
} ;
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ <h1>{{ title }}</h1>
102
102
{% if edit_link %}
103
103
{{ edit_link }}
104
104
{% else %}
105
- {% if is_prerelease_phase and GIT_BRANCH === 'latest' %}
105
+ {% if eslintVersions.isPrereleasePhase and GIT_BRANCH === 'latest' %}
106
106
{{ site.edit_link.start_with_latest }}{{ page.inputPath }}
107
107
{% elseif is_number_version %}
108
108
https://github.com/eslint/eslint/edit/{{ GIT_BRANCH }}/docs/{{ page.inputPath }}
You can’t perform that action at this time.
0 commit comments