Sublime Forum

ESLINT doesn't work in a git worktree

#1

My project primarily uses Javascript.
I’m using the git worktree feature to isolate work on distinct features.

I have ESLINT installed and working on Sublime Text (ST) via the SublimeLinter and SublimeLinter-eslint packages.

ESLINT is working in ST in my main dev area but not in worktrees.
ESLINT works correctly from the terminal in both source areas.

Has anyone experienced this issue ?

Thanks
-jg-

0 Likes

#2

Enable debug mode in SublimeLinter and look at Sublime’s console what SublimeLinter is executing in both cases. Look at the working dir it chooses and the command. Does it find the packages.json in both cases?

0 Likes

#3

Thanks for your suggestions.

The only SublimeLinter related messages I see in the ST console are:

reloading plugin SublimeLinter-eslint.linter
reloading plugin SublimeLinter.allo
reloading plugin SublimeLinter._init
reloading plugin SublimeLinter.active_linters_view
reloading plugin SublimeLinter.busy_indicator_view
reloading plugin SublimeLinter.goto_commands
reloading plugin SublimeLinter.highlight_view
reloading plugin SublimeLinter.log_handler
reloading plugin SublimeLinter.panel_view
reloading plugin SublimeLinter.quick_actions
reloading plugin SublimeLinter.status_bar_view
reloading plugin SublimeLinter.sublime_linter

After enabling debug mode for SublimeLinter, I also have this:

Unable to open /Users/jag/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/SublimeLinter.sublime-settings
reloading settings Packages/User/SublimeLinter.sublime-settings

I assume this reload should have picked up the addition of
“debug”: true
in SublimeLinter.sublime-settings

0 Likes

#4

I don’t know if you need to reload after editing the SublimeLinter settings, plenty of way to do this. You should, however, see detailed logging when editing javascript files after that.

0 Likes

#5

Hi again:
Thanks for your help with this.
I have not been able to get the increased level of logging to happen with
“debug”: true,
in SublimeLinter settings.

Things I have tried:

  • remove SublimeLinter.eslint package
  • re-add SublimeLinter.eslint package
  • [attempted to remove] SublimeLinter _ the PackageControl Remove package operation for SublimeLinter silently did nothing.

My guess is that this message about SublimeLinter having problems reloading settings contains a clue, but I’m not sure how to proceed to fix it.

Unable to open /Users/jag/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/SublimeLinter.sublime-settings

The problem is that the directory its looking for the settings file in, is not present. This one:

/Users/jag/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/

On my setup, I have this one:

/Users/jag/Library/Application Support/Sublime Text 3/Packages/User

which contains the settings file:

SublimeLinter.sublime-settings

and others.

-jg-

0 Likes

#6

Ultimately, you’re writing to the one in the User directory. That is expected and fine.

You could write nonsense to that settings file and see if errors pop up. If I remember correctly, even misspelling debug and then saving should open up an error panel, as generally the settings are validated. Need to check that.

Are you really on Sublime Text 3 as the folder names suggest? Please keep also in mind that for the logging you also need to open and probably edit js files. There is likely no additional logging without user interaction.

0 Likes

#7

I’ve tried editing .js files. Nothing appears in the console.

I’m on Sublime Text 4.
Should the settings folder be named to reflect that ?
Maybe something like:

/Users/jag/Library/Application Support/Sublime Text 4/Packages/User

Thanks
-jg-

0 Likes

#8

Hm. That’s a bit confusing because the question looked and sounded like you’re a new user. But apparently you used ST3 before and ST4 “inherits” or uses these settings.

However, you said eslint is working on some projects, or for some directories. You just need to figure out which settings/folders Sublime Text picks up. And Sublime Text will print that to the console on startup. It prints all the relevant paths it uses.

I just checked that SublimeLinter actually watches/observes its settings, so for me it is enough to set "debug": true,, then save, and in the console I see:

reloading settings Packages/User/SublimeLinter.sublime-settings
SublimeLinter: log_handler.py:77      Logging installed; log level INFO

If you save some settings and don’t see at least “reloading settings…” you’re likely editing the wrong file.

If I misspell “debug” as “debugs”, I get indeed an error message. E.g.

Invalid settings in 'Packages/User/SublimeLinter.sublime-settings':
Additional properties are not allowed ('debugs' was unexpected)
0 Likes

#9

I decided to remove SublimeLinter and SublimeLinter-eslint packages to get a reset.
Since Package Control Remove Package failed on SublimeLinter, I did the removal manually by deleting package files.

After restarting ST (a couple of times ?), debug mode started working for SublimeLinter-eslint .

I can now see that SublimeLinter-eslint says:
'File ignored because of a matching ignore pattern. ’
‘Use “–no-ignore” to override.’

Is there a way to determine where (.eslintrc, .eslintignore) these directives are coming from so I can modify the correct dot file ?

-jg-

0 Likes