1.0.0-dev.20180628T105138Z.ff411c7 • Published 7 years ago

gpii-grunt-lint-all v1.0.0-dev.20180628T105138Z.ff411c7

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
7 years ago

gpii-grunt-lint-all

This grunt plugin provides a combined rollup command that runs all GPII lint checks. To add it to your package, use a command like:

npm install gpii-grunt-lint-all --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks("gpii-grunt-lint-all");

Please note, as this package provides default configuration options for many commands, if you wish to override options safely, your Gruntfile.js should load this package's tasks first, and then merge your own options, as shown in the following example:

"use strict";
grunt.loadNpmTasks("gpii-grunt-lint-all");
grunt.config.merge({
    lintAll: {
        sources: {
            js:    ["./src/js/**/*.js", "tests/js/**/*.js", "./*.js"],
            json:  ["./tests/data/**/*.json", "./*.json"],
            json5: ["./tests/data/**/*.json5"],
            md:    ["./docs/**/*.md", "./*.md"]
        }
    }
});

By default, this plugin takes care of letting all of the sub-tasks know where to look for Javascript, JSON, JSON5, and Markdown files, so you only need to configure the lintAll block as shown above. If you need to exclude content, add a negated pattern at the end of the relevant source block, as show here.

"use strict";
grunt.loadNpmTasks("gpii-grunt-lint-all");
grunt.config.merge({
    lintAll: {
        sources: {
            js:    ["./src/js/**/*.js", "tests/js/**/*.js", "./*.js", "!./src/lib/**/*.js"]
        }
    }
});

Running the Checks

Once you have installed the plugin and updated your Gruntfile.js, you should be able to run the lint-all command from the root of your repository, as in grunt lint-all.

Configuring Individual Checks

This plugin is a rollup that calls a range of individual checks. All checks support the standard src array that defines which material should be linted. For more information about the individual checks and links to their documentation, see below:

TaskDescriptionDocumentation
eslintRun both the eslint:js and eslint:md tasks (see below).See below.
eslint:jsCheck the validity and formatting of Javascript files.fluid-grunt-eslint
eslint:mdCheck the validity and formatting of Javascript code blocks in Markdown files.eslint-plugin-markdown
json5lintCheck the validity of JSON5 files.fluid-grunt-json5lint
jsonlintCheck the validity and formatting of JSON files.grunt-jsonlint
markdownlintCheck the formatting of Markdown files.grunt-markdownlint
mdjsonlintCheck the validity and formatting of JSON code blocks within Markdown files.gpii-grunt-mdjson-lint

Please note that many of the above checks use our standard ESLint configuration, which is available in the eslint-config-fluid. You will need to follow the installation instructions in that package before you run many of the above checks.