I'm using Visual Studio 2012 and the JsLint plugin.
Is there a better way to use JsLint for inline javascript in CSHTML files?
If I try to select the javascript text and run the tools just on the selection I get a bunch of errors related to spacing (e.g. "var should be on column 13, not 9"). This happens because the IDE indents the javascript code inside the <script>tags.
I get errors on variables that are rendered from razor code like this: result = #Html.Raw(JsonConvert.SerializeObject(Model));
I currently just copy the code onto an empty .js file and run the tool from there, but it's kinda of nuisance to be switching.
What would be the best configuration (or alternate plugin) to work easier with jsLint validation on this scenario?
Resharper is the best tool I've used for javascript coding. It works very well and highlights the majority of the issues that you'd be looking for with JsLint, though it's not nearly as comprehensive of course.
On the other hand, I'd be concerned about the amount of javascript you're writing in a view. If you have that much, perhaps you should consider moving it out of your views into standalone files.
I think you just need to open up the options pane. I'm using the VS.2010 version, but my Tools >>> JSLint Options menu option opens up the following settings pane:
You're running into JSLint without the white option set to true.
You might want to steal some of the other settings I've got above to remove some of the more draconian rules. The above works very well for me. ;^)
Related
Using Eclipse's 2020-06 built in JavaScript editor, I need to disable the JavaScript informational notes on syntax and warnings as displayed with an (i) icon to the left of the line number and with markers to the right of the scroll bar. See links to the two images showing what these look like.
An example of the informational icon
An example of the markers
There are two warnings repeating numerous times:
'aVariableName' is declared but its value is never read.
This constructor function may be converted to a class declaration.
I would rather turn off these two individual messages since they do not apply to the project, but such control does not appear to exist, but they are overly spamming the editor and are interfering with other notifications and informational notes. FYI: I'm needing to follow specific coding conventions for the project and therefore the warnings don't even apply to the project and are just spam.
So I'll just settle for shutting off javascript validation, but the validation will not turn off.
I've tried to disable the project level settings for the javascript validation through the menu option Window, Preferences, Web, HTML Files, Client-side Javascript, Validator, Errors/Warnings: and unchecked both options of Strict Validation of Javascript keywords usage, and Enable JavaScript semantic validation. But making those changes accomplishes nothing since the warnings are still there even after running validation on the project, cleaning the project, and even restarting eclipse.
The specific version of Eclipse is:
Eclipse IDE for Enterprise Java Developers Version 2020-06 (4.16.0)
To try to better explain the need to install Node.js, this is the dialog requested Node.js be installed. The text of the dialog reads: "Missing node.js" "Could not find node.js. This will result in editors missing key features. Please make sure node.js is installed and that your PATH environment variable contains the location to the 'node' executable."
Eclipse's Missing Node.js dialog
Are there any other ways to shut off individual warnings/messages, or the javascript validations? Any help, or constructive suggestions would be very much appreciated. Thanks!
Sorry, the stackoverflow editor won't allow in-lining simple images.
Update: So I have not been able to figure out how to disable the informational notices that are showing up in the JavaScript editor along both the left and right margins. I would still love to find out how to do that. I'm wondering if the issues I'm seeing may have been resolved in the current release of Eclipse? I cannot put my development environments at risk if downgrading is not possible. But some hopeful and important details that I have learned is that the latest release of Eclipse "can" support java 1.8 although it says the minimal version supported is Java 11. And also the latest release is better integrated with Node.js so an external install is no longer required. At this time I cannot risk testing the latest Eclipse release due to possible lockout of the workspaces if eclipse cannot be downgraded. I will make plans to rebuild some of the workspaces on another workstation so it will not impact vital projects if something should go wrong.
I was able to disable these javascript validation notes by changing the following setting.
Eclipse -> Window -> Preferences -> General -> Editors ->Text Editors -> Annotations
find "Infos" in the "Annotation types" and click it
uncheck both the "Vertical Ruler" and "Overview Ruler"
optional - uncheck "Text as "Squiggly Line"
Click Apply and Close
Voila enjoy the less cluttered javascript files
When going through a code review, my technical lead picked up a few missing semicolons in my JavaScript when he went into debug. Visual Studio actually threw these exceptions up, and I was wondering where the option to turn that on was.
I've searched 'JavaScript Debugging in Visual Studio 20(15|13)', but it seems like there aren't any simple settings to enable.
Wondering the most efficient way to turn on JavaScript debugging in visual studio for all projects without having to add something each time.
Make sure you have Just My Code Enabled by going into Tools-->Options-->Debugger-->General--> Enable Just My Code. This will change your Debug--> Windows --> Exceptions Settings Dialog Box to show a CheckBox for JavaScript RunTime Exceptions.
Javascript RunTime Exceptions:
See this answer for previous versions of Visual Studio
Sounds like you want JSLint
You can also look into using TypeScript which is a superset of javascript and allows you to strongly type your javascript.
I am looking for way (preferably and online site) to a reverse Uglify of some javascript. The Website: http://jsbeautifier.org/ is great for minifed code, but it is does not do a great job for ugly stuff.
There is this awesome online tool, JSNice, that makes a great job of finding names to obfuscated variables.
We make even obfuscated JavaScript code readable.
We will rename variables and parameters to names that we learn from thousands of open source projects.
Furthermore, often we are also able to guess or infer type annotations.
Chrome dev tools ability to Pretty Print
All you need to do is to click the { } icon on the bottom toolbar to activate this feature. Of course, the names will still be obfuscated (depending on what program minfied the JavaScript in the first place), but you will at least be able to set break points and debug the code.
Source: Tip #2 in this archived article.
Depends on what options you used when you uglify your code. If you just remove the line breaks, then Chrome dev tools will be able to do a great work as sirinivas explained. But if you mangle the code, then there is no way you can get the exact previous code. (in uglifying var logngvariable = a + b; becomes var c=a+b;. there is no way a tool can figure out the previous name logngvariable )
On the otherhand if you want an un-uglified code you may not uglify it at the first place... :)
After having written large amounts of code in Intellij Idea Ultimate edition, I often want to test a method, or big pieces.
I often resort to having to paste the code in firebug in firefox, a small annoying cramping space, with no editor features. If the code needs adjusting I need to do it there, test again, copy and insert into Intellij Idea.
Is it possible to run firebug like console code, right in Intellij ? Similar to in Java debug mode with the Inspect tool ? It would have been really useful, even more useful just to highlight some code and press run.
Browser support is not important, any browser will do.
Is this possible already? Is there an Intellij plugin for this? Why not? :(
Thanks!
If the browser is not important, you could use the node.js plugin as a javascript repl / debugger. Keep in mind that it will not provide an HTML DOM so if your code makes jQuery calls, it will not run out of the box. Otherwise, if it's just plain javascript, it will run just fine.
Just stumbled over this. A bit late but anyway:
Debugging Javascript, editing values, etc. works fine using intelliJ with its Chrome Plugin.
See https://www.jetbrains.com/idea/webhelp/configuring-javascript-debugger.html or
http://blog.jetbrains.com/idea/2011/03/intellij-idea-debugging-javascript-in-google-chrome/
You can set breakpoints to stop where you want and can from there evaluate expressions and all the other stuff you would like to do.
Hope this is what you wanted to know.
Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing javascript applications using firebug?
Something like a mini IDE would be awesome: It just has to let me insert some code, examine the current page and then let me execute it. Any suggestions?
I use a simple text editor (vim) to write Javascript and HTML, and I check the result every now and then in Firefox. I have always two windows open: one for my text editor, and one with the current page open in Firefox. After saving a change in the Javascript, I switch to the browser and refresh the page to observe results. That was my workflow until recently.
A couple of weeks ago, I discovered the Combiner tool by Nicholas C. Zakas. To release my Javascript code, I am now using a complete build process based on Apache Ant, similar to what I was using while doing Java development previously.
The first step is to check the Javascript code with the JSLint tool by Douglas Crockford. I used to painfully copy and paste my Javascript code in the online version of the tool, once in a while; being able to run it on all my Javascript files at once with this Ant script is a huge convenience.
The second step is to combine all my Javascript files into a single file using the Combiner tool. The third step is to minify the Javascript code using YUI Compressor by Yahoo!. These last two steps allow to optimize the delivery of Javascript code to reduce page loading.
You can find an example Ant build file that you may adapt to your own needs. I am currently using this file to build my own Javascript library, bezen.org.
The other answers so far have been correct: I've never heard of anyone actually developing inside Firefox/Firebug, because it's a tool designed for debugging, not coding. To do your coding, you should use a tool designed for it (either a text editor or a full-fledged IDE).
But that being said, you might want to check out FireEclipse (Link). It will allow you to integrate Firebug with the Eclipse IDE (which itself has at least three different JS plug-ins to choose from). Alternatively I think the main (aka Web Standard Toolkit, aka WST) JS editor for Eclipse has some functionality which is similar to Firebug, but I've never used it so I don't know the details.
Hope that helps.
Write your HTML in an editor/IDE
Save your changes
Preview it in your browser
Debug using Firebug
Make your code edits in your SOURCE CODE
Repeat
Firebug is for debugging and allows you to do some "what if" fiddling while the page is live. This is not a replacement for an IDE.