Development on Va...
Follow
Find tag "jslint"
11.4K views | +5 today
Development on Various Platforms
Your new post is loading...
Your new post is loading...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Explorations In Automatically Fixing JavaScript Linting-errors

Explorations In Automatically Fixing JavaScript Linting-errors | Development on Various Platforms | Scoop.it

FixMyJS (by Josh Perez) was created to try solving this problem. It aims to automatically fix linting errors in a non-destructive way. To an extent, it achieves this goal.

Under the hood the module uses Esprima for source parsing and Escodegen (from the Mozilla Parser API AST) to generate it back. While any form of automation code transformation should be approached with a healthy dose of skepticism, FixMyJS is able to handle fixing basic JSHint errors fairly well. Some of what it supports includes:

Adding missing semicolonsEnforcing camelCase and snake_case conventionsAdding curly braces to statementsRemoving debugger statementsEnforcing single and double quite stylesAdding the radix parameter to parseIntDot notation conversionHandling extra trailing commas

and a few other common linting issues.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Better JavaScript with Strict Mode and JSHint

With great flexibility comes great responsibility… and JavaScript is very flexible.  Too flexible, some might argue.  There are many “features” of JavaScript that result in code that is hard to read, dangerous or buggy to execute, and in some cases creates performance issues.  In 2008, Douglas Crockford wrote a fantastic book called “JavaScript: The Good Parts” that described the features he found problematic: global variables, the assignment of ‘this’ to the global object, misuse of eval, etc.  If you write JavaScript, it’s a must read.

Several of the “bad” features Crockford identified have been mitigated with “Strict Mode.”  This was added to version 5 of ECMAScript (the JavaScript standard; supported by most popular web browsers).  Strict mode throws exceptions or prevent behavior when “bad” features or common coding errors are evaluated.  A couple of examples…


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Testable & Tested Client-side Code

Testable & Tested Client-side Code | Development on Various Platforms | Scoop.it

Testing (i.e. linting, unit tests, integration testing etc..) client-side code is not done as commonly as it should be. The reason it is so commonly not done, besides lack of know-how, is that it is presupposed that it will take time away from other more productive development tasks.

This fallacious notion is, of course, wrong. The repeatable successes in software engineering based on testable (i.e. modular, loosely coupled, small, simple units of code) and tested code has proven again and again to be a time-saver and part of creating maintainable and understandable code. At a minimum, if code is not unit tested it is only a matter of time before it is burnt down and re-written, or abandoned altogether because it becomes unmaintainable and incomprehensible.

In this article, I am going to defend and talk about testing client-side code. It is my intention that the information in this article will give those among us who do not test, the desire and some initial testing knowledge to test, along with the ability to defend its necessity from any agent that might deter testing.


Via Jan Hesse
more...
No comment yet.