-
Notifications
You must be signed in to change notification settings - Fork 90
Closed
Description
eslint provides a really nice --fix
option, which is perfectly usable for fixing smaller things, like indentation, styling issues, etc.
Please make a command which runs --fix
on the actual code, so a quick eslint style fixing would be possible in Sublime.
Akurganow, kjanoudi, juni-vogt, Volox, insin and 36 more
Activity
roadhump commentedon Nov 22, 2015
SublimeLinter does not support anything except linting and there is no easy way to add this formatting command separately to this plugin. I guess we should wait when such possiblity will land in SublimeLinter, probably create an issue, or create separate plugin, like https://github.com/TheSavior/SublimeJSCSFormatter/blob/master/JSCS-Formatter.py for jscs.
hyperknot commentedon Nov 24, 2015
I'll open an issue in linter, to let them know about the need for the feature.
Probably a separate plugin would be the most reliable way of implementing it, but it'd be a pity to not use all the config management which is already implemented in linter and in this plugin.
darkred commentedon Dec 5, 2015
For reference: what the
--fix
option currently (v1.10.3) offers (1, 2) is that:and
i.e. running it like this:
eslint --fix myscript.js
it will replace the file with one having as many issues as possible fixed (i.e. it wont create a 2nd file),
and it doesn't report in its output which errors it just fixed
but only which unfixed issues remain, like this:
Also, Atom's `linter-eslint` plugin since [version 5.2.0](https://github.com/AtomLinter/linter-eslint/releases) offers "`linter-eslint: Fix file`" command _(via Command Palette)_. It works on the currently opened file, provided that you have just saved it (i.e. it has no unsaved changes).
softwarespot commentedon Jan 5, 2016
I am going to create a small sublime text plugin (first one by the way). So watch this space! =)
joerideg commentedon Jan 12, 2016
I'll be watching you @softwarespot :D
mummybot commentedon Jan 22, 2016
How is the plugin going? :)
TBH I am surprised at this as the Sublime Linter documentation, at least in plain english, implies that it passes the argument to the binary:
Yet I haven't been able to get --fix or --globals to work. What is the point of the args in SublimeLinter if not to allow arguments to passed to the run time?
The example provided in the SublimeLinter documentation even implies cmd syntax:
The following does not lint on my Sublime 3.0, removing the "--fix" and it does.
And yet the following works fine
Does not compute!
bdefore commentedon Jan 26, 2016
Would also love to see
--fix
support! 👍joerideg commentedon Jan 28, 2016
Somebody who knows pyton (not me :( ) could fork https://github.com/TheSavior/SublimeJSCSFormatter/ and probably make an eslint version. The api of jscs and eslint are pretty much the same. @softwarespot
roadhump commentedon Jan 30, 2016
@mummybot Plugin uses stdin as input (
--stdin
option ofeslint
). It does not work with--fix
, as I know.karolyi commentedon Feb 18, 2016
+1
jorgenbs commentedon Mar 8, 2016
+1
gblazex commentedon Mar 17, 2016
+1
glenjamin commentedon Apr 23, 2016
If it is possible in SumblimeLinter to tell the difference between an as-you-type lint and a has-hit-save lint, a good approach might be to use the real file instead of
--stdin
when the file has been saved. And then--fix
could be passed in that scenario.softwarespot commentedon Apr 23, 2016
This was released 6 days ago >> https://github.com/TheSavior/ESLint-Formatter. It's JSCS Formatter renamed
20 remaining items