Skip to content

Commit dac606c

Browse files
committed
fx local mode/eslint version
1 parent f53dea7 commit dac606c

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

cmd/init.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -225,26 +225,29 @@ func configFileTemplate(tools []domain.Tool) string {
225225
}
226226
} else {
227227
// In local mode with no tools specified, use the default tool list from plugins.GetToolVersions()
228-
var sortedTools []string
229-
seen := make(map[string]bool)
228+
// Write runtimes
229+
neededRuntimes := make(map[string]bool)
230230
for toolName := range defaultVersions {
231-
if defaultVersions[toolName] != "" && !seen[toolName] {
232-
sortedTools = append(sortedTools, toolName)
233-
seen[toolName] = true
231+
if runtime, ok := runtimeDependencies[toolName]; ok {
232+
if toolName == "dartanalyzer" {
233+
neededRuntimes["dart"] = true
234+
} else {
235+
neededRuntimes[runtime] = true
236+
}
234237
}
235238
}
236-
sort.Strings(sortedTools)
237-
238-
// Write sorted tools ONCE
239-
for _, toolName := range sortedTools {
240-
version := defaultVersions[toolName]
241-
sb.WriteString(fmt.Sprintf(" - %s@%s\n", toolName, version))
239+
var sortedRuntimes []string
240+
for runtime := range neededRuntimes {
241+
sortedRuntimes = append(sortedRuntimes, runtime)
242+
}
243+
sort.Strings(sortedRuntimes)
244+
for _, runtime := range sortedRuntimes {
245+
sb.WriteString(fmt.Sprintf(" - %s@%s\n", runtime, runtimeVersions[runtime]))
242246
}
243247
}
244248

245249
sb.WriteString("tools:\n")
246250

247-
// If we have tools from the API (enabled tools), use only those
248251
if len(tools) > 0 {
249252
// Create a sorted slice of tool names
250253
var sortedTools []string
@@ -267,22 +270,19 @@ func configFileTemplate(tools []domain.Tool) string {
267270
}
268271
}
269272
} else {
270-
// If no tools were specified (local mode), include all tools in sorted order
273+
// Write tools only once in local mode
271274
var sortedTools []string
272-
for _, meta := range domain.SupportedToolsMetadata {
273-
if version, ok := defaultVersions[meta.Name]; ok {
274-
if version != "" {
275-
sortedTools = append(sortedTools, meta.Name)
276-
}
275+
seen := make(map[string]bool)
276+
for toolName := range defaultVersions {
277+
if defaultVersions[toolName] != "" && !seen[toolName] {
278+
sortedTools = append(sortedTools, toolName)
279+
seen[toolName] = true
277280
}
278281
}
279282
sort.Strings(sortedTools)
280-
281-
// Write sorted tools
282283
for _, toolName := range sortedTools {
283-
if version, ok := defaultVersions[toolName]; ok {
284-
sb.WriteString(fmt.Sprintf(" - %s@%s\n", toolName, version))
285-
}
284+
version := defaultVersions[toolName]
285+
sb.WriteString(fmt.Sprintf(" - %s@%s\n", toolName, version))
286286
}
287287
}
288288

integration-tests/init-without-token/expected/codacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runtimes:
55
66
tools:
77
8-
- eslint@9.3.0
8+
- eslint@8.57.0
99
1010
1111

plugins/tools/eslint/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: eslint
22
description: ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.
3-
default_version: 9.3.0
3+
default_version: 8.57.0
44
runtime: node
55
runtime_binaries:
66
package_manager: npm

0 commit comments

Comments
 (0)