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

node-elm-lint

v1.0.0-beta.1

Published

Run elm-lint from Node.js

Downloads

7

Readme

node-elm-lint

Run elm-lint from Node.js.

Installation

npm install -g elm-lint

Usage

elm-lint --help  # Print the help
elm-lint init    # Creates a `LintConfig.elm` file in which you can declare how you want to configure elm-lint
elm-lint         # Lint your project

Configuration

To run elm-lint for the first time, you need to run

elm-lint init

This will create a LintConfig.elm file at the root of your project, which looks like the following:

module LintConfig exposing (config)

import Lint.Types exposing (LintRule, Severity(..))
import Lint.Rules.DefaultPatternPosition
import Lint.Rules.NoDebug
import Lint.Rules.NoUnusedVariables


config : List ( Severity, LintRule )
config =
    [ ( Critical, Lint.Rules.DefaultPatternPosition.rule { position = Lint.Rules.DefaultPatternPosition.Last } )
    , ( Warning, Lint.Rules.NoDebug.rule )
    , ( Critical, Lint.Rules.NoUnusedVariables.rule )
    ]

The configuration consists of a list of linting rules. Rules are Import the rules you wish to use and pair them with a severity level (Critical / Warning). A reported Critical error will make elm-lint return a failure exit code, while a Warning error will not. You can see the full list of rules here. Do note that some rules will need additional configuration, but don't worry, if you misconfigure elm-lint, the Elm compiler will tell you.

Once you're done configuring, run elm-lint and you should be good to go.

FAQ

  • I get the error (Critical) Parsing error: expected end of input for some of my files, what is happening?

This means that your file could not be parsed. You should try and copy-paste that file's source code into the elm-ast online demo to see if you can reproduce the error. If you are able to, then try to make a minimal reproducible example and open an issue on elm-ast.

In most cases, this is due to comments made using -- (e.g. -- a comment) that are not well handled by the parser. elm-lint tries to remove them before parsing, but does a bad job at it at the moment (help wanted).

  • Thanks for pointing out the error, but I would like to know where in my code the error is.

At the moment, elm-ast is missing positional information on the generated AST, that elm-lint uses. You can follow this issue if you want to know more or to contribute.

  • I have an idea for a rule, how can I get it integrated into elm-lint?

Please open an issue on elm-lint so we can talk about it. Try to make your proposal look like this.

elm-lint would like to be able to provide support for a plugin system so that you can work on it without my approval. Maybe that already works, but if it doesn't, please open an issue about that.

  • The code looks bad and can be improved upon, also the documentation is lacking.

You're absolutely right. Please open an issue if you have suggestions or open a pull request!