Can't click on jslint errors in NetBeans - javascript

I'm trying to configure a NetBeans build to call jslint and produce errors that I can click on to take me to the source.
Using the Maven build script from Maven plugins to analyze javascript code quality, jslint is running and producing errors but I can't click on them. The text in the NetBeans output window looks like this:
[jslint] C:\Documents and Settings\arx\My Documents\Progs\jsweb\src\main\wwwroot\jsweb.js:125:48: 'keydown' is not defined.
I'm running NetBeans 6.9.1 on Windows. The spaces in the path aren't an issue. I tried it with a spaceless path and it still didn't work.
Ultimately I want to edit a simple javascript+html project in NetBeans and have clickable errors from jslint. I'm not wedded to Maven. Any suggestions gratefully received.
Update: A solution
If I put jslint4java directly into an Ant project (rather than an Ant project wrapped in a Maven plugin) the output doesn't include the [jslint] prefix and I can click on the errors.
This is a bit of a chore because it seems to be necessary to explicitly list the locations of all the jar file dependencies, but it works.
Another Update
I'm having another go at making this work in Maven because its java dependency management is nice. The problem is definitely the [jslint] prefix in the output, which is produced by Ant.
There doesn't seems to be any way of making NetBeans ignore the prefix, which is odd because Ant is NetBeans's default build tool.
The prefix can be suppressed by setting the emacsmode property on Ant's DefaultLogger. NetBeans does this when it lauches Ant iself (if "build.compiler.emacs=true" is set in Options), but maven-antrun-plugin doesn't (and looking at the source, there's not currently any way of persuading it to).
Possible fixes are:
Make NetBeans better at decoding Ant output.
Add an emacsmode option to maven-antrun-plugin.
Find a native Maven jslint plugin (so Ant isn't used at all).
Option 3 looked like potentially the simplest so I used TortoiseSVN to download the source for http://mojo.codehaus.org/jslint-plugin/ from https://svn.codehaus.org/mojo/trunk/sandbox/jslint-plugin and got it working. But it produces NetBeans-unfriendly output like:
[ERROR]jssvg.js:2690:48:'keydown' is not defined.

The easiest way is to add this plug-in. Supports the Netbeans 7.3.

Related

What is the formatter/syntax highlighter to work with ejs (embedded javascript) templates?

For the project I use EJS (http://ejs.co/) as express templating engine. It is good and easy to use, but editing files is a bit of a problem - text highlight is worse than average and I could not find any tools to auto format files.
My main IDE is VS Code and I have tried Atom.
For VS code I used QassimFarid.ejs-language-support, which has way more installs than all others and I found it lacking. Tried DigitalBrainstem.javascript-ejs-support, but it is getting confused with my code pretty soon too.
For Atom I go with language-ejs (atom.io/packages/language-ejs) which is very good.
Sadly, both VS Code and Atom do not have any autoformat capabilities (read packages), and pure JS formatters are confused with ejs markup.
What do you use to format your ejs templates?
P.S.
I do not mind trying some other IDEs/editors or even some standalone formatters.
Your question is quite subjective, so I can't really offer a definitive answer. But I get the feeling you're just using the base text editor rather than installing packages.
Both VS Code and Atom come with package systems. In VS Code you can click on the "Extensions" icon on the left hand panel (under the debug item). This will let you search for extensions that offer things such as auto-complete and syntax highlighting. Just by typing in "ejs" there are 4 different syntax highlighting and evaluators.
Atom also has a similar system to search for and install packages. From here you should be able to find one which suits your needs for EJS.

Use vim as an ide for javascript development?

I'm looking on trying out VIM for an IDE of some sort, I've installed vimrc for the most part it looks pretty decent.
What I'm missing is linting configuration for syntax errors and what not, some sort of intellisense (which I think vim-javascript does).
From what I've read, vim-pathogen is the way to install vim specific plugins.
I've followed the documentation in vim-javascript on how to install using pathogen. I notice after installing that I see text colors differently but I still don't get autocomplete of any sort.
I tried adding the configurations to my .vimrc file but I don't think I'm doing it right.
Here's what it looks like:
set runtimepath+=~/.vim_runtime
execute pathogen#infect()
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
let g:javascript_plugin_flow = 1
set foldmethod=syntax
try
source ~/.vim_runtime/my_configs.vim
catch
endtry
First mistake: considering Vim as an IDE.
Second mistake: using someone else's setup.
Third mistake: thinking you can get away without learning Vim.
Anyway…
There's no such thing as ~/.vim_runtime. Your user-level runtime directory is ~/.vim.
Pathogen is not a way to "install" plugins. It's a way to "enable" plugins. There are many plugins for installing plugins (which doesn't really make any sense), and you can simply install them manually, which is a lot easier than random bloggers would like you to think.
"Syntax errors and what not" is done via :help make. Read it (and the related sections) instead of installing pointess plugins.
"some sort of intellisense" is already built-in; it's called "omni-completion" and you can read about it in :help ins-completion. That plugin only provides an alternative syntax script (for syntax highlighting, mostly), an alternative indent script, and an alternative omni-completion script.
Vim doesn't do autocompletion. It's totally unnecessary but if you really want it you can get it via some third-party plugins. You can find them in the "script" section of http://www.vim.org.
That crappy over-engineered setup will get you nowhere. Remove it from your system and start again from scratch instead of abandoning control to random semi-ignorant gittards. The only thing you can achieve with distributions like these is never learning your tools properly.

Eclipse JSDT autocomplete not working

I've done research and see this is a recognized issue. I guess my question will be: Is there a solution in Eclipse Mars or in Neon? Another plugin for JavaScript Content Assist?
I'm running Eclipse Mars and have a project with Java and JavaScript (uses ScriptEngineManager). JavaDoc/AutoComplete is working in Java but not in JS files. It Was working but then just stopped. I've restarted, rebooted, refreshed, rebuilt. No joy. The error reported is :
An exception occurred while getting the JSDoc. See log for details.
(in the log: ) file.js [in [in ...Workspace\.metadata\.plugins\org.eclipse.wst.jsdt.core\libraries\system.js]] does not exist
I deleted and re-defined the workspace. No joy. Mouseover the keyword Array and it does show system.jsArray with ECMA info. But mouseover String and it shows src/docs/jsString. "src/docs" is a path in my project.
I'm thinking it's just looking in the wrong place for the docs but I don't know where to set that. I've read that there is a bug where auto complete only works within a file. This seems to be consistent where it's still looking within the current file for the definition of everything.
I can get String to refer back to system.jsString if I add an invalid function. But if I fix the function it goes back to looking in my src/docs. Go figure.
Maybe the project structure is wrong (this is FOSS I got from Github). In the root of the project there are src/foo folders with packages and .java source, a reference to the JRE System Library, a couple .jars, and another src folder with src/docs/java with .java files and src/docs/js with .js files. Do I need to change the folder type of src or do something else to it so that it's recognized as a code folder? Right now it's in the project explorer with a common "folder" icon, not like one of the package source folders.
Do I need Neon? Do I need another IDE?
This suggestion to update the .project didn't help.
I'm going to try the package "Eclipse IDE for JavaScript and Web Developers" but I dont know if that will help with this Java/JS hybrid project. I'm also going to try Atom.
Thanks.

Atom JavaScript Autocomplete

I'm new to Atom and JavaScript, Atom seems to be pretty good for web developing.
But to my best knowledge, it seems that there is no Atom package for enabling JavaScript autocomplete.
Does anyone know a package doing this or does Atom have a plan to support JavaScript autocomplete?
Since JavaScript is loosely coupled, providing a working autocomplete solution is not as easy as for statically typed languages like Java. Your best bets with Atom are the following packages:
autocomplete-plus - this is now bundled with Atom as the default autocomplete provider
ternjs - this looks pretty good, but requires some configuration.
I suggest you give these a try.
I think you should go for atom-ternjs
This is java script intelligence for atom
You need to change(Enable) setting for atom-ternjs
Use autocomplete-snippets
Display both autocomplete-snippets and function name
and many more depends on your requirements ...
If you are using modern JavaScript or TypeScript or Node then atom-typescript is good. It uses tsserver (like vscode) which gives autocomplete, go to definition, syntax checking and other ide goodies. By default it's not enabled for JavaScript. Follow the docs to enable for .js files - https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md#i-want-to-use-atom-typescript-with-javascript-too. Configuration for tsserver is done by .jsconfig file - https://code.visualstudio.com/docs/languages/jsconfig.
install "autocomplete-plus"
install "atom-ternjs"
create or open any js file in your project
click on Packages -> Atom Ternjs -> Configure Project
below libs enable the item "browser"
scroll down and click on “Save and Restart Server”
Recommended Atom Packages
atom-ternjs:
Adds code intelligence to Atom.
https://atom.io/packages/atom-ternjs
autoclose-html-plus:
Will help you automatically close HTML tags.
https://atom.io/packages/autoclose-html-plus
emmet:
Adds code expansion to Atom.
https://atom.io/packages/emmet
csslint:
Adds CSS error checking abilities to Atom.
https://atom.io/packages/csslint
pigments:
Adds the ability to display colour in Atom code files.
https://atom.io/packages/pigments
language-ejs:
Adds EJS language support to Atom.
https://atom.io/packages/language-ejs
atom-beautify:
Helps to automatically format your code in Atom.

If the code with Debugger statement Javascript gets deployed on Production how much of security concern does it pose?

Sometimes to debug Javascript code the debugger; statement is written in code.
What are Security Concerns in javascript?
Is it possible to Encrypt
script code?
It's generally a good idea to remove commands like this and console from production data. I don't think it's particularly a security concern however.
You could use something like a precommit git hook or a grunt task to check for the keywords you don't want appearing before deployment.
If you want to minify/obfuscate your code you can use something like uglifyJS for which there is also a grunt plugin for that too.

Categories