[Phpmyadmin-devel] jshint errors
Marc Delisle
marc at infomarc.info
Tue Apr 16 12:33:52 CEST 2013
Le 2013-04-16 03:06, Michal Čihař a écrit :
> Hi
>
> Dne Mon, 15 Apr 2013 12:39:16 -0400
> Marc Delisle <marc at infomarc.info> napsal(a):
>
>> Michal Čihař a écrit :
>>> Hi all
>>>
>>> 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/
>>>
>>>
>>> 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.
>>
>> Another question: which coding style do we prefer, the one with the dot
>> notation or with the square brackets?
>
> I think PMA_messages.strSave is shorter and looks nicer than
> PMA_messages['strSave'], though I don't have strong opinion on that.
> Also with messages (the most frequent of this warning in our case) we
> can be pretty sure we don't use reserved words, so the dot syntax is
> always safe here.
I also think the dot notation is better, and here is another reason.
When seeing the string in quotes, I always wonder whether the string
'strSave' will be shown to the user.
--
Marc Delisle
http://infomarc.info
More information about the Developers
mailing list