0

I have been using jslint for a while in javascript projects edited with VS2013. But I am now experimenting with the 'Tools for Apache Cordova' plugin for VS2013 and jslint won't run with any of the .js files in the project. I get the error message "The directory name [project path]\mymap.jsproj is invalid". But 'mymap.jsproj' isn't a directory, it's the VS2013 project definition file.

However if I load a .js file that's not part of the project into the same IDE, jslint runs on that OK. It also runs OK on a javascript project that isn't based on Cordova.

Just upgraded to VS2015 and have the same problem. Any suggestions?

quilkin
  • 874
  • 11
  • 31
  • Please, if downvoting a question, explain why, so that I can improve it... – quilkin May 18 '15 at 14:42
  • I don't know much about jslint right now. But is this a problem because it assumes anything .js* is a javascript file? Obviously, not everything .js* is a javascript file, for instance in your case, the .jsproj file. Is there a way to exclude files from jslint function/feature? – Steve Kennedy May 18 '15 at 18:41
  • I don't think this is the problem because JSLint works OK on a javascript file that is not part of the project. In fact I can load a different project, then open a .js file from the original project, and JSLint now works on that same file. – quilkin May 19 '15 at 15:44

2 Answers2

1

Quilkin,

You want to use NPM and Gulp or Grunt when linting. I realize this changes your workflow, but it's a better solution. VS2015 has NPM, Gulp and Grunt built in and I believe you need web essentials for 2013.

Here's the github link on how to use gulp-jslint: https://github.com/karimsa/gulp-jslint

Many use jsHint instead of jsLint. Here's the github link: https://www.npmjs.com/package/gulp-jshint

More Information from abouit jslint vs jshint from stackoverflow: Should I use JSLint or JSHint JavaScript validation?

Basart answered a similar question about TypeScript JSlint on TypeScript code - can it still teach me to write better code?

For typescript there is a (recommended) ts-lint : https://www.npmjs.org/package/tslint Also has a grunt plugin : https://www.npmjs.org/package/grunt-tslint

Community
  • 1
  • 1
DeanB_Develop
  • 2,107
  • 3
  • 23
  • 37
  • Thanks for the potentially useful links but I'm puzzled why I 'want to' learn to use these alternative tools. The JSLint plugin for VS generally works very well (and has 4 or 5 star reviews), it's just that it won't work with Cordova projects which by definition are going to be using JavaScript. So either I'm doing something wrong or there's a bug in VS which MS needs to know about. btw, Web Essentials for VS2015 has more bad reviews than good. – quilkin May 21 '15 at 10:27
  • Quilkin, Here are a few links that do a good job at explaining the usefulness of these alternative tools. http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx http://www.davepaquette.com/archive/2014/10/08/how-to-use-gulp-in-visual-studio.aspx http://joeriks.com/2013/08/06/can-i-benefit-from-grunt-for-my-visual-studio-based-web-development/ http://stevescodingblog.co.uk/grunt-npm-and-bower-in-visual-studio-its-awesome-right/ – DeanB_Develop May 21 '15 at 15:17
  • Thanks for that, I can now see that these tools will be very useful in a production environment. But I'm still in a learning environment (with JS that is, I have many years experience of C# and dotnet). If someone can show me the steps to install Grunt (or Gulp) into VS2015, and use it with JSLint./JSHint (can't see that in any or your links) then that would be a good start. I do want to see the results of the lint inside the VS ide. – quilkin May 21 '15 at 17:58
  • Quilkin, Information about VS2015 and NPM, Bower, Grunt, Gulp is available, but it can be hard to find. Here are two excellent videos that explain the basics: http://channel9.msdn.com/Events/Build/2015/2-675 and http://jj09.net/building-large-scale-web-applications-with-typescript/ Also, twitter is a huge help. The VS Apache Cordova and TypeScript team use it a lot. Here are some names to follow: mkristensen ryanjsalva basarat typescriptlang Chuxel DanWahlin kirupa JMatthiesen I hope this helps – DeanB_Develop May 21 '15 at 19:24
  • DeanB, I really appreciate your trying to help and would like to mark my question as answered. But I tried the steps in the first video you mentioned and it was a pretty bad experience. See [link](https://social.msdn.microsoft.com/Forums/en-US/80f181a0-61d3-4768-be19-367abbb13aa3/vs-2105-rc-integration-of-bower-and-grunt?forum=visualstudiogeneral) for details. BTW I don't suppose you could reverse the downvote for my question; I still don't know why it was downvoted. – quilkin May 22 '15 at 09:14
  • Chris, Sorry to hear you're having problems. I'm using VS2015Pre every day on Windows 8.1 and I've had occasional problems. I read the link you posted and I can see a few potential issue. 1st: Don't even try VS2015PRE on Windows 10. Two(2) unfinished programs (VS and Win 10) can only lead to problems. 2nd: Use the View > Output to view for build errors when VS isn't crashing. It generally has all the information on why it's crashing. 3rd: Make sure all VS2015 options were selected when installing. I set the vote back to 0. Also, if you're familiar with C#.NET, have you looked a Xamarin? – DeanB_Develop May 22 '15 at 12:44
  • DeanB, I only tried it on my Win10 testbed to see if the problems were caused by old stuff on my Win7 PC - which has had VS2005,8,10, 12 and 13 on it in the past! I did try Xamarin about 2 years ago but was disappointed to find that the user-interfaces still needed doing separately in ios and android. Then I discovered PhoneGap/Cordova so started learning JavaScript. – quilkin May 22 '15 at 17:26
0

Glad to say that I alerted the JSLintNet developers to the issue and it has now been fixed! latest beta

quilkin
  • 874
  • 11
  • 31