JSPM

  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q70286F
  • License Apache-2.0

webhint parser to analyze the package.json file

Package Exports

  • @hint/parser-package-json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hint/parser-package-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

package.json config (@hint/parser-package-json)

The package-json parser allows the user to analyze the package-json configuration in their projects.

To use it you will have to install it via npm:

npm install @hint/parser-package-json

Note: You can make npm install it as a devDependency using the --save-dev parameter, or to install it globally, you can use the -g parameter. For other options see the npm documentation.

And then activate it via the .hintrc configuration file:

{
    "connector": {...},
    "formatters": [...],
    "hints": {
        ...
    },
    "parsers": ["package-json"],
    ...
}

This parser detects if a package.json file is present in the project and validates its configuration against the package.json schema.

Events emitted

This parser emits the following events:

  • parse::start::package-json, of type PackageJsonParseStart which contains the following information:

    • resource: the resource we are going to parse.
  • parse:🔚:package-json, of type PackageJsonParsed which contains the following information:

    • resource: the parsed resource.
    • config: an object with a valid configuration.
    • getLocation: method yeilding the resource's problem location.
  • parse::error::package-json::json, of type PackageJsonInvalidJSON which contains the following information:

    • resource: the parsed resource.
    • error: the error emited parsing the package.json.
  • parse::error::package-json::schema, of type PackageJsonInvalidSchema which contains the following information:

    • resource: the parsed resource.
    • error: the error message.
    • errors: all the errors that the schama validator returns.
    • prettifiedErrors: the errors formatted in a way that is easy to understand.

Types

If you need to import any type or enum defined in this parser, you need to import them as follows:

import { TypeOrEnumYouWantToUse } from '@hint/parser-package-json';