Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim plugin #31

Closed
mightyiam opened this issue Feb 6, 2015 · 15 comments

Comments

@mightyiam
Copy link
Contributor

commented Feb 6, 2015

My VIM doesn't recognize that a project is Standard.

Is the presence of standard in package.json's devDependencies enough to flag that the package is Standard?

Perhaps both ESLint and JSCS should be patched to recognize the presence of Standard and then automatically look for the RC files in the right place?

Then, when used from within the editor, it just happens automagically—well, at least with some editors, who rely on external tools like that.

@mikesherov

This comment has been minimized.

Copy link

commented Feb 6, 2015

JSCS will not be patching itself to recognize standard. The correct way to do this would be to make standard a jscs plugin and an eslint plugin, rather than something that uses both of those tools.

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2015

@mikesherov and @nzakas,

Thank you for commenting.

Perhaps JSCS and ESLint can be patched to recognize to look for something other than an rcfile in the current directory? Are you open for that?

I'm thinking perhaps a property in package.json, which provides paths to rcfiles:

{
  "name": "my-package",
  "rcfiles": ["node_modules/standard/rc"]
}

In Standard, I'm looking for the least amount of actions for setting it up.

Editing package.json (to prefix the test script with standard &&) is probably already part of the workflow of setting Standard up, so adding the rcfiles property/value is just another step in the same file.

Perhaps addition of rcfiles can be made automagical, using standard's npm postinstall script?

@mikesherov

This comment has been minimized.

Copy link

commented Feb 6, 2015

You can already run jscs with an file using the config option.

@nzakas

This comment has been minimized.

Copy link

commented Feb 6, 2015

Ditto ESLint using the -c option.

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2015

I'm looking for a way that will not require anyway to alter the way that ESLint & JSCS are called.

For example, ESLint is called automatically from my VIM plugin.

The current existing way of providing rules is the presence of rcfiles.

But that is not flexible enough for my purpose because that requires Standard to put such files in place in the repo where it is used and that is not such a great possibility, as you can imagine.

The little addition of a property to package.json is an acceptable, pleasant, non–destructive alteration.

If only ESLint and JSCS will follow such a property, it will be one possible solution. Are you open to anything like this?

@nzakas

This comment has been minimized.

Copy link

commented Feb 6, 2015

ESLint already allows you to have configuration in package.json: http://eslint.org/docs/configuring/

@Flet

This comment has been minimized.

Copy link
Member

commented Feb 6, 2015

A better approach might be to create a vim plugin specifically for standard. It may be worth getting this added to syntastic.

It looks like someone opened an issue for it already: vim-syntastic/syntastic/issues/1314

@feross

This comment has been minimized.

Copy link
Member

commented Feb 6, 2015

The correct approach is to create a vim plugin for standard.

@Flet already wrote a Sublime Text plugin. It's quite easy to do, since the output is easily parseable. You can see the regex to use here.

Ideally, a dedicated vim user would step up and write this plugin! I use vim as my secondary editor (only when I'm ssh'd into a server, and usually without syntax highlighting).

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2015

I'll use VIM so I'll benefit. But what about all the other editors?

@nzakas it allows configuration in package.json but it doesn't allow a directive/rule that allows us to provide a path to an rcfile, right? An include rule would be perfect. Would you be open to an include rule?

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2015

If we do this at the lower, ESLint&JSCS level, we don't need any editors to recognize Standard.

@feross

This comment has been minimized.

Copy link
Member

commented Feb 9, 2015

@mightyiam Please take your feature request directly to the jscs or eslint issue trackers.

Let's use this issue to track progress on a vim plugin. If someone writes this, let me know and we can link it from the README.

@feross feross changed the title A way for editors to work with Standard Vim plugin Feb 9, 2015

@lcd047

This comment has been minimized.

Copy link

commented Feb 11, 2015

@feross Syntastic maintainer here. Writing a syntastic checker for standard would be mostly trivial, provided that you fix this. :) As it is now, running

:echo system('standard file.js')

from Vim yields nothing, since stdin as seen by standard is not a TTY.

feross added a commit that referenced this issue Feb 11, 2015

Fix TTY detection issue
For vim plugin (#31)
@feross

This comment has been minimized.

Copy link
Member

commented Feb 11, 2015

@lcd047 Hey, fixed the issue in 2.6.1. Care to give it a try?

@lcd047

This comment has been minimized.

Copy link

commented Feb 11, 2015

@feross Excellent! It works now, and I added a syntastic checker for it in c1a2098.

Unrelated however, error highlighting in syntastic seem to imply column numbers for eslint, except the ones referring to semicolons, are off by one.

@feross feross closed this Feb 11, 2015

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2015

Thank you very much, @feross and @lcd047.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
6 participants
You can’t perform that action at this time.