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

allow for an individual file linting #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bounceme
Copy link

No description provided.

@angelozerr
Copy link
Owner

@bounceme I think you do this PR because you wish to validate the opened file in an editor and siplay error as you are typing. Is it that?

If it that it's not the well integration of tern-lint. The tern-lint command is a bad idea for "as you type" case. Indeed, it reparses each time the whole of JS files. The better idea is to use the "lint" query. This query is like standard "completion" query: when you do "compeltion" you don't reload the whole JS files of you project but just the given file, for the "lint" it's the same thing.

@bounceme
Copy link
Author

bounceme commented Jun 24, 2016

well, for the available vim linter plugins, checks are always done when saving the file or manually. I haven't looked into the possibility for using the lint command, is it a continuous server? most linters work with either a filename or stdin

@angelozerr
Copy link
Owner

most linters work in with either a filename or stdin

I think it's because those linter don't need a scope. JavaScript can have a global scope where you variables can be defined in several files.

Takes a sample:

If you have this a.js file:

var a = "";
console.log(a);
console.log(b);

If you validate a.js, here tern-lint will report "b" as "Undefined variable".

Now if you add a new `bjs file in your project like this:

var b = "";

In this case, tern-lint will report none errors if you load a.js and b.js (JavaScript scope).

So you need to load a.js and b.js. That's why for performance, you need to load a.js an db.js with node.js with tern server. After if you use "lint" query https://github.com/angelozerr/tern-lint/wiki/Editors#other-editors it will work.

I think the better integration of tern-lint should be done here ternjs/tern_for_vim#105

@bounceme
Copy link
Author

I see, and it is what i expected, though there aren't any scope issues with using tern-lint and my pr. It is actually quick enough for single files but obviously not when loading tons of node_modules recursively. maybe I could make a change to the config settings used so that required files don't load there own dependencies to see about performance.
I think the only way to make something for vim using that server is with the official plugin

@angelozerr
Copy link
Owner

I think the only way to make something for vim using that server is with the official plugin

Exactly, I suggest you to do a PR for ternjs/tern_for_vim#105

If you PR is accepted please tell me and I will add vim as editor like eclipse, codemirror, atom and emacs have done https://github.com/angelozerr/tern-lint#editors

@bounceme
Copy link
Author

i still would like this to be merged, this behavior is closer to what most people expect of a linter.also i don't want support for this to be removed from vim/syntastic , since the author just created the integration.i'm not however suggesting you should advertise vim as a fully supported editor. thanks

@bounceme
Copy link
Author

any thoughts? i found this to be a nice improvement over loading every file.

@davidosomething
Copy link
Contributor

davidosomething commented Oct 5, 2016

@bounceme this probably complements my #74 well, but would need to update the --format argv parsing

I'd also like this PR merged, it is an opt-in feature after all

A future revision would be to detect a running tern-server instance and use that for better performance (e.g. YCM's tern server, or https://github.com/ternjs/tern_for_vim 's, or https://github.com/carlitux/deoplete-ternjs 's)

@bounceme
Copy link
Author

bounceme commented Oct 5, 2016

The --format flag is already detected, so it should work anyway

@bounceme
Copy link
Author

bounceme commented Oct 5, 2016

Otherwise, this may be a waste of effort. The config is shared, linting is far slower than tern completion, and the nature of terns parsing means that there are generally always going to be false positives in the results. For type checking we have typescript and flow. Eslint/jshint meet most peoples needs otherwise.

Also the official tern vim plugin has type signatures in the completion menu already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants