0

I'm using 02_jshint.js to code lint my Ionic project, everything goes well until I receive this error:

35:4 -> Missing semicolon. ->  })

and it's pointing to the last constant's bracket of my code:

angular.module('myApp.constants',['ionic'])

    .constant('A','2.1.4')
    .constant('B','1.1.3')

    .constant("c", {
          "d": "cost1",
          "e": "cost2",
          "f": "cost3"
     })

I would like to know if there is a way to avoid this warning or to correct the error, it's clear that the code is correct but I would like to build my project (it doesn't allow to do that if there are any errors). Any advice?

2
  • 1
    why you can't put semicolon there? Commented May 7, 2015 at 7:40
  • 1
    lint it anywhere else and you'll get the same error because it is missing Commented May 7, 2015 at 7:46

3 Answers 3

1

Check jshint documentation jshint.com/docs.

In case you know why you don't want to put a semicolon there (which would be a good practice) try to put some ignore directives around it:

A directive for telling JSHint to ignore a block of code.

// Code here will be linted with JSHint.
/* jshint ignore:start */
// Code here will be ignored by JSHint.
/* jshint ignore:end */

Additionally, you can ignore a single line with a trailing comment:

ignoreThis(); // jshint ignore:line
Sign up to request clarification or add additional context in comments.

1 Comment

and if I want to ignore completely in all the files? the docs are very very unclear
1

angular.module('myApp.constants',['ionic']).whatevergoeshere() is a chained statement. In JavaScript you always should terminate statements using a semicolon. I advice you not to switch this rule off but just add the semicolon.

The semicolon (;) character is used to separate statements in JavaScript code.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling

Comments

0

you missed semicolon in the last.

angular.module('myApp.constants',['ionic'])
   .constant('A','2.1.4')
   .constant('B','1.1.3')
   .constant("c", {
         "d": "cost1",
         "e": "cost2",
         "f": "cost3"
      });

1 Comment

this comment is correct, the semicolon error message refers to the ";" missing at end of statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.