shamila
shamila

Reputation: 1330

Grunt installation

I am building a application with angularjs with a server, when building the backend, it is told to install grunt-contrib-jshint. I have installed grunt to my project but I have no idea why do I have to install grunt-contrib-jshint.

Upvotes: 0

Views: 91

Answers (2)

Clarice Bouwer
Clarice Bouwer

Reputation: 3811

grunt-contrib-jshint will validate (aka lint) your JavaScript files with JSHint.

Linting will analyse your code for any potential errors.

Make sure when you install it that you save it to the package.json file by either installing it with the npm install grunt-contrib-jshint --save-dev command or adding the package name and version directly to the file. If you don't do this, other developers will not have a reference to this dependency when they checkout the project. See more about Grunt.

devDependencies": {
  "grunt-contrib-jshint": "~1.0.0"
}

You will also have to set it up in your Gruntfile.js to lint your JavaScript files.

// Project configuration.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.initConfig({
  jshint: {
    beforeconcat: ['src/foo.js', 'src/bar.js'],
    afterconcat: ['dist/output.js']
  }
});

Upvotes: 0

atinder
atinder

Reputation: 2090

grunt-contrib-jshint is used for linting your JavaScript files. Since you are using angularJs so most probably you need it.

Upvotes: 1

Related Questions