npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flow-phabricator-parser

v0.1.1

Published

A flow output parser to be use with phabricator `arc lint`

Downloads

13,126

Readme

flow-phabricator-parser

A flow output parser to be use with phabricator arc lint

This is a simple wrapper - parser for node that will transform the output from flow to something that phabricator can inspect in the linting stage.

How to use it.

Install the package with

npm install flow-phabricator-parser --save-dev
#or
yarn add flow-phabricator-parser --dev

or copy the source file to your project.

To configure the script with arc lint create a .arclint file and add

{
  "linters": {
    ....
  "flow-regex-based": {
    "type": "script-and-regex",
    "include": "(\\.js?$)",
    "exclude": [ ],
    "script-and-regex.script": "sh -c '(node ./PATH_FROM_REPO_ROOT_TO_PROJECT/node_modules/flow-phabricator-parser/flowparser.js ./PATH_FROM_REPO_ROOT_TO_FLOWCONFIG \"$0\")'",
    "script-and-regex.regex": "/^(?P<file>.*): line (?P<line>[0-9]*), col (?P<char>[0-9]*), (?P<severity>error|warning) - (?P<message>.*) \\((?P<code>[a-z-]+)\\)$/m"
    }
  }
}

Replace PATH_FROM_REPO_ROOT_TO_FLOWCONFIG in the above with the path to directory containing your project's project.json file. If it's at the root, remove /PATH_FROM_REPO_ROOT_TO_FLOWCONFIG from the path above - including the / prefix, so just . is left. An optional parameter check can be pass at the end to the script so the line will look like

"script-and-regex.script": "sh -c '(node ./PATH_FROM_REPO_ROOT_TO_PROJECT/node_modules/flow-phabricator-parser/flowparser.js ./PATH_FROM_REPO_ROOT_TO_FLOWCONFIG \"$0\" check)'",

That will force to run flow in mode "check" (independent process) instead of status (server). Flow #6025 and Flow #1428 are issues that can be work around with this. Flow modes

Next we need to ensure the appropriate version of flow-bin is installed.

  • Open up .flowconfig file at the root of your React Native project, and scroll to the bottom.

You should see a version, e.g.:

[version]
^0.42.0

Install that version of flow-bin with:

npm install [email protected] --save-dev
# or
yarn add [email protected] --dev

Notes

We point to "(\\.js?$)", to get all the js files changed since last version. Also the parser will discard errors that doesn't belong to changed files. If you think some error reported is cryptic you may want to run flow in your project folder.

On

"script-and-regex.script": "sh -c '(node ./ProjectDir/node_modules/flow-phabricator-parser/flowparser.js ./ProjectDir \"$0\")'"

we need to pass ./ProjectDir as the folder where flow will be run (AKA the folder of your .flowconfig file) relative to the root of the git repository.

Current Limitations

  • Flow is invoked for each file and the output processed for each different file.
  • Right now, in very big projects with many dependencies in node_modules; errors in the parsing are not impossible although really unlikely. To solve this we may need to move from execFile to a more robust mechanism.