[Phpmyadmin-devel] jshint errors
adam
adamgsoc2013 at gmail.com
Tue Apr 16 04:51:30 CEST 2013
Hi,
>I've took some time to look at jshint checks found on our code:
>
>http://ci.phpmyadmin.net/job/phpMyAdmin-continuous/3132/violations/?#jslint
>
>I've fixed some obvious ones (like missing ;, typecast safe comparing,
>missing radix for parseInt), but there are still many of them. Most of
>them fit into following case:
>
>
>- ['strSave'] is better written in dot notation.
>
>This error is raised to highlight an unnecessarily verbose and
>potentially confusing piece of code. More detailed explanation is at:
>
>http://jslinterrors.com/a-is-better-written-in-dot-notation/
>
>
>- 'type' is already defined. / 'type' used out of scope.
>
>Most of these come from following constructs:
>
>if (foo) {
> var bar = 1;
>} else {
> var bar = 1;
>}
>alert(bar);
>
>This is not an issue for javascript (it has no block scope for
>variables), it can be confusing, more details at:
>
>http://www.jshint.com/docs/#funcscope
>
>
>So both are more just matter of coding style rather than real bug and
>can be disabled in jshint. The question is whether we would prefer to
>hide these warnings or fix them.
About the JSHint (or JSLint), there are some opintions which can be customed by users to decide whether the warning should be evoked.
Like JSHint: http://www.jshint.com/
Warn
About debugging code
About unsafe for..in
About == null
About arguments.caller and .callee
About empty blocks
About unsafe comparisons
About assignments inside if/for/...
About functions inside loops
About eval
About unsafe line breaks
When bitwise operators are used
When code is not in strict mode
When variable is undefined
When variable is defined but not used
When blocks omit {}
When new is used for side effects
If we want to fix the JSHint warning, we should firstly decide which warnings should be fixed. thanks
BTW, I would like to join and fix some warnings.
Adam
More information about the Developers
mailing list