Grunt module for running Buddy.js
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-buddyjs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-buddyjs');
This task is a wrapper around buddy.js, a magic number detector.
In your project's Gruntfile, add a section named buddyjs
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
buddyjs: {
src: ['file1.js', 'file2.js'],
options: {
// ...
}
},
});
Type: Array
Default value: [0, 1]
Numbers that will be ignored in the processing.
Type: Boolean
Default value: false
Disables the ignore list.
Type: Boolean
Default value: false
Enforce literals to be declared with the const
keyword.
Type: Boolean
Default value: false
Type: String
Default value: simple
Reporter to use. Options available are simple
, json
and detailed
.
The following configuration would disable ignoring 0
and 1
as magic numbers
and report as JSON.
grunt.initConfig({
buddyjs: {
src: ["lib/*.js"],
options: {
disableIgnore: true,
reporter: "json"
}
},
});
- v0.1.0 - Initial release.