FlowType errors reporter similiar to ESLint's codeframe one
npm install flow-reporter-codeframe> @FlowType errors reporter similiar to ESLint's codeframe one
[![Code style][codestyle-img]][codestyle-url]
[![CircleCI linux build][linuxbuild-img]][linuxbuild-url]
[![CodeCov coverage status][codecoverage-img]][codecoverage-url]
[![DavidDM dependency status][dependencies-img]][dependencies-url]
[![Renovate App Status][renovateapp-img]][renovateapp-url]
[![Make A Pull Request][prs-welcome-img]][prs-welcome-url]
[![Semantically Released][new-release-img]][new-release-url]
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][open-issue-url] or ping @tunnckoCore at Twitter.
[![Conventional Commits][ccommits-img]][ccommits-url]
[![Become a Patron][patreon-img]][patreon-url]
[![Share Love Tweet][shareb]][shareu]
[![NPM Downloads Weekly][downloads-weekly-img]][npmv-url]
[![NPM Downloads Monthly][downloads-monthly-img]][npmv-url]
[![NPM Downloads Total][downloads-total-img]][npmv-url]
Project is semantically & automatically released on [CircleCI][codecoverage-url] with [new-release][] and its New Release GitHub App.
``bash`
$ yarn add flow-reporter-codeframe
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._$3
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 highlightCodeReturns
-
Promise resolves to a string if there is errors, undefined if no errorsExamples
`javascript
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();
`$3
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
`javascript
import { getDefaultOptions } from 'flow-reporter-codeframe';console.log(getDefaultOptions());
// => { color: true, highlightCode: false }
``[Become a Partner or Sponsor?][patreon-url] :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][npmv-url] and
yarnpkg.com sites too! :rocket:
Not financial support? Okey! Pull requests, stars
and all kind of contributions are always
welcome. :sparkles:
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.
|
Charlike Mike Reagent
💻 📖 💬 👀 🔍 |
| :---: |
Consider showing your support to them. :sparkling_heart:
---
_This file was generated by verb-generate-readme, v0.8.0, on August 11, 2018._
[npmv-url]: https://www.npmjs.com/package/flow-reporter-codeframe
[npmv-img]: https://badgen.net/npm/v/flow-reporter-codeframe?icon=npm
[ghrelease-url]: https://github.com/tunnckoCore/flow-reporter-codeframe/releases/latest
[ghrelease-img]: https://badgen.net/github/release/olstenlarck/flow-reporter-codeframe?icon=github
[license-url]: https://github.com/tunnckoCore/flow-reporter-codeframe/blob/master/LICENSE
[license-img]: https://badgen.net/npm/license/flow-reporter-codeframe
[codestyle-url]: https://github.com/tunnckoCore/eslint-config-esmc
[codestyle-img]: https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb
[linuxbuild-url]: https://circleci.com/gh/tunnckoCore/flow-reporter-codeframe/tree/master
[linuxbuild-img]: https://badgen.net/circleci/github/tunnckoCore/flow-reporter-codeframe/master?label=build&icon=circleci
[codecoverage-url]: https://codecov.io/gh/tunnckoCore/flow-reporter-codeframe
[codecoverage-img]: https://badgen.net/codecov/c/github/tunnckoCore/flow-reporter-codeframe?icon=codecov
[dependencies-url]: https://david-dm.org/tunnckoCore/flow-reporter-codeframe
[dependencies-img]: https://badgen.net/david/dep/tunnckoCore/flow-reporter-codeframe?label=deps
[ccommits-url]: https://conventionalcommits.org/
[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/dfb317
[new-release-url]: https://github.com/tunnckoCore/new-release
[new-release-img]: https://badgen.net/badge/semantically/released/05c5ff
[downloads-weekly-img]: https://badgen.net/npm/dw/flow-reporter-codeframe
[downloads-monthly-img]: https://badgen.net/npm/dm/flow-reporter-codeframe
[downloads-total-img]: https://badgen.net/npm/dt/flow-reporter-codeframe
[renovateapp-url]: https://renovatebot.com
[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green
[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green
[prs-welcome-url]: http://makeapullrequest.com
[paypal-donate-url]: https://paypal.me/tunnckoCore/10
[paypal-donate-img]: https://badgen.net/badge/$/support/purple
[patreon-url]: https://www.patreon.com/bePatron?u=5579781
[patreon-img]: https://badgen.net/badge/patreon/tunnckoCore/F96854?icon=patreon
[patreon-sponsor-img]: https://badgen.net/badge/become/a%20sponsor/F96854?icon=patreon
[shareu]: https://twitter.com/intent/tweet?text=https://github.com/olstenlarck/flow-reporter-codeframe&via=tunnckoCore
[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter
[open-issue-url]: https://github.com/olstenlarck/flow-reporter-codeframe/issues/new
[author-link]: https://tunnckocore.com
[new-release]: https://github.com/tunnckoCore/new-release