peril-settings-linter
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

peril-settings-linter

A node module for linting the settings json for Peril.

Mainly one function:

export default function lint(
  settingsReference: string,
  api: octokit,
  currentSettings?: FileRelatedPartOfJSON
): Promise<ErrorReport>

You pass in the dangerfile reference URL for the settings repo, an already set-up OctoKit api object (so you handle auth basically) and you can optionally pass in the currentSettings - if you don't this lib will grab the version in the settingsReference.

Usage:

import lint from "peril-settings-linter"

const runLinter = async () => {
  const results = await lint("artsy/peril-settings@settings.json", api)
  if (results.networkErrors.length) {
    console.error(`Could not find files at: ${results.networkErrors.join(",")}`)
  }

  if (results.schemaErrors.length) {
    console.error(`Settings file did not pass schema validation: ${results.schemaHumanReadableErrors}`)
    console.error(`Settings file did not pass schema validation: ${results.schemaErrors}`)
  }
}

How do I work on this?

git clone https://github.com/orta/peril-settings-linter.git
cd peril-settings-linter
yarn install

# Open VS Code with `code .`

# Run tests
yarn jest

How do I deploy this?

yarn release

Readme

Keywords

none

Package Sidebar

Install

npm i peril-settings-linter

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

209 kB

Total Files

14

Last publish

Collaborators

  • orta