Unexpected: "lint warning: missing...

  • Anonymous - 2012-11-11

    Thanks for making your online lint utility available!

    I am having difficulty understand an error detected by the online lint checker though.
    I recieve a "lint warning: missing semicolon" message pointing at line 13 and don't see the need for a semicolon in the place lint suggests it should be.

    <!DOCTYPE html>
    <meta charset="UTF-8">
    <title>Login Example 2</title>
    function validate()
    alert("Please enter User Name")
    return false
    /* =^
    lint warning: missing semicolon */
    alert("Please enter Password");
    return false
    <form name="login" onSubmit="return validate()">
    <input type="text" size="20" name="userName">
    <input type="text" size="20" name="password">
    <input type="submit" name="submit" value="submit">

    I'm probably missing something simple here. Any suggestions?

  • Christophe Ross

    Christophe Ross - 2012-11-18


    …don't see the need for a semicolon in the place lint suggests it should be.

    Any suggestions?

    Yes!  - always write well-formatted strict, clean code.
    Why do you want to save semi-colons? - they don't cost anything (nor do spaces, which can make your code more readable for others).

    All statements should always be terminated and separated with the appropriate separator when one is available for the language. Don't try to see what lax, lazy coding you can get away with!

    So try writing this instead:

    function validate()
        if ( document.login.userName.value == "" )
            alert( "Please enter User Name" );
            return false;
        if ( document.login.password.value == "" )
            alert( "Please enter Password" );
            return false;
        return true;

    (Computer engineer, programmer in 'C', HTML, CSS and JavaScript


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks