[gnome-builder] eslint: check for eslint in build environment



commit 773d1a3c785705ed1939a4850a5c3c49ec5c343f
Author: Sonny Piers <sonny fastmail net>
Date:   Sat Jan 1 16:58:02 2022 +0000

    eslint: check for eslint in build environment
    
    Only use the build environment if eslint is found within $PATH of the
    build environment. Otherwise fallback to a standard subprocess launcher
    within the Builder runtime environment.

 src/plugins/eslint/eslint_plugin.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/eslint/eslint_plugin.py b/src/plugins/eslint/eslint_plugin.py
index e31e38103..c11221145 100644
--- a/src/plugins/eslint/eslint_plugin.py
+++ b/src/plugins/eslint/eslint_plugin.py
@@ -56,10 +56,11 @@ class ESLintDiagnosticProvider(Ide.Object, Ide.DiagnosticProvider):
         if context.has_project():
             build_manager = Ide.BuildManager.from_context(context)
             pipeline = build_manager.get_pipeline()
-            if pipeline is not None:
+            # Check for eslint using pipeline so that it can possibly come from
+            # the SDK or SDK extensions in addition to the build environment.
+            if pipeline is not None and pipeline.contains_program_in_path('eslint'):
+                launcher = pipeline.create_launcher()
                 srcdir = pipeline.get_srcdir()
-            runtime = pipeline.get_config().get_runtime()
-            launcher = runtime.create_launcher()
 
         if launcher is None:
             launcher = Ide.SubprocessLauncher.new(0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]