First, install the package:
npm install grunt-jssemicoloned
Gruntfile.js file to have the following line somewhere:
If it has been installed correctly, running
grunt --help should
jssemicoloned in the list of available tasks.
Set the files to be validated, as part of Grunt configuration via the
jssemicoloned key. As an example,
initConfig in your
might look like the following fragment:
gruntinitConfigpkg: '<json:package.json>'jssemicoloned:files: '*.js' 'lib/**/*.js' 'test/**/*.js'test:files: 'test/**/*.js'
You can specify the files to be validated using the usual file pattern.
In the above examples, it will validate every
*.js files in the main
lib directory, and the
test directory. It will also alter
all files with missing semicolons.
Whenever you want the semicolon insertion task to run, just invoke it using:
It is not recommended to include the validation task in your default.