1.1.18 • Published 5 years ago

flow-reporter-codeframe v1.1.18

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
5 years ago

flow-reporter-codeframe npm version github release License

@FlowType errors reporter similiar to ESLint's codeframe one

Code style CircleCI linux build CodeCov coverage status DavidDM dependency status Renovate App Status Make A Pull Request Semantically Released

If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Conventional Commits Become a Patron Share Love Tweet NPM Downloads Weekly NPM Downloads Monthly NPM Downloads Total

Project is semantically & automatically released on CircleCI with new-release and its New Release GitHub App.

Table of Contents

Install

This project requires Node.js >=6.0.0. Install it using yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.

$ yarn add flow-reporter-codeframe

CLI

Use flow check or flow focus-check filename.js and the json formatter.

# general use
flow check --json --json-version 2 | flow-reporter-codeframe
# or
cat report-file.txt | flow-reporter-codeframe
# or generate report file
flow check --json --json-version 2 > flow-report.json
# and pass that file to the reporter
flow-reporter-codeframe flow-report.json

Optionally pass --no-color to disable colors - make note that we detect if it is run on CI, so they are disabled there. Optionally, we can highlight the code, pass --highlight-code if you want to be more fancy. :) If --no-color is passed, that's disabled automagically too.

API

Generated using docks.

flowReporter

Formatting the val to look like ESLint's cool codeframe reporter. It may be a bit more verbose and to have a bit more lines of code than the Flow's default one, but that's not a bad thing.

You should provide valid report, which means that for now you are forced to use --json --json-version 2 flags if you want to use that reporter.

Params

  • val {string|object} the Flow's JSON version 2 thingy, --json + --json-version 2
  • opts {object} optional options color and highlightCode

Returns

  • Promise resolves to a string if there is errors, undefined if no errors

Examples

import execa from 'execa';
import reporter from 'flow-reporter-codeframe';

async function main() {
  try {
    await execa('flow', ['check', '--json', '--json-version', '2']);
  } catch (err) {
    const output = await reporter(err.stdout);
    console.log(output);
  }
}

main();

.getDefaultOptions

Get default options for the reporter. By default, we have colors turned on, and highlighting code turned off.

Returns

  • object containing { color: boolean, highlightCode: boolean }

Examples

import { getDefaultOptions } from 'flow-reporter-codeframe';

console.log(getDefaultOptions());
// => { color: true, highlightCode: false }

back to top

Contributing

Follow the Guidelines

Please read the Contributing Guide and Code of Conduct documents for advices.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Support the project

Become a Partner or Sponsor? :dollar: Check the Partner, Sponsor or Omega-level tiers! :tada: You can get your company logo, link & name on this file. It's also rendered on package's page in npmjs.com and yarnpkg.com sites too! :rocket:

Not financial support? Okey! Pull requests, stars and all kind of contributions are always welcome. :sparkles:

OPEN Open Source

This project is following OPEN Open Source model

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is built on collective efforts and it's not strongly guarded by its founders.

There are a few basic ground-rules for its contributors

  1. Any significant modifications must be subject to a pull request to get feedback from other contributors.
  2. Pull requests to get feedback are encouraged for any other trivial contributions, but are not required.
  3. Contributors should attempt to adhere to the prevailing code-style and development workflow.

Wonderful Contributors

Thanks to the hard work of these wonderful people this project is alive! It follows the all-contributors specification.
Don't hesitate to add yourself to that list if you have made any contribution! ;) See how, here.

Charlike Mike Reagent💻 📖 💬 👀 🔍

Consider showing your support to them. :sparkling_heart:

License

Copyright (c) 2018-present, contributors. Released under the Apache-2.0 License.


This file was generated by verb-generate-readme, v0.8.0, on August 11, 2018.

1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago