{"id":15771843,"url":"https://github.com/jfmengels/node-elm-review","last_synced_at":"2025-04-04T01:08:42.937Z","repository":{"id":37550069,"uuid":"211501930","full_name":"jfmengels/node-elm-review","owner":"jfmengels","description":"CLI for elm-review","archived":false,"fork":false,"pushed_at":"2024-10-29T22:28:54.000Z","size":3942,"stargazers_count":48,"open_issues_count":28,"forks_count":25,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-29T22:51:51.912Z","etag":null,"topics":["cli","elm-review","hacktoberfest"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/jfmengels/elm-review/latest/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfmengels.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jfmengels"}},"created_at":"2019-09-28T13:07:52.000Z","updated_at":"2024-10-29T22:28:56.000Z","dependencies_parsed_at":"2023-10-17T01:25:03.360Z","dependency_job_id":"f3879ce2-a839-45bc-b45c-926330699020","html_url":"https://github.com/jfmengels/node-elm-review","commit_stats":{"total_commits":2106,"total_committers":24,"mean_commits":87.75,"dds":"0.10398860398860399","last_synced_commit":"80e222d3f7a8e09b69a0737e7d92b20149a7c973"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfmengels%2Fnode-elm-review","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfmengels%2Fnode-elm-review/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfmengels%2Fnode-elm-review/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfmengels%2Fnode-elm-review/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfmengels","download_url":"https://codeload.github.com/jfmengels/node-elm-review/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246892847,"owners_count":20850850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","elm-review","hacktoberfest"],"created_at":"2024-10-04T15:05:26.898Z","updated_at":"2025-04-04T01:08:42.918Z","avatar_url":"https://github.com/jfmengels.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jfmengels"],"categories":[],"sub_categories":[],"readme":"# elm-review CLI\n\nRun [`elm-review`] from Node.js.\n\n![elm-review reporter output](https://github.com/jfmengels/node-elm-review/blob/v2.10.3/documentation/images/elm-review-report.png?raw=true)\n\n## Installation\n\n```sh\n# Save it to your package.json, if you use npm in your project.\n# This is the recommended way.\nnpm install elm-review --save-dev\n\n# Install globally. This is not recommended.\nnpm install -g elm-review\n```\n\nSee [below](#try-it-out) if you want to try it out without installing it.\n\n## Usage\n\n```sh\n# Print the help\nelm-review --help\n\n# Review your project\nelm-review\n\n# Create an empty review configuration\nelm-review init\n\n# Create a new project containing elm-review rules\n# aimed at being published on the Elm package registry\nelm-review new-package\n\n# Create an empty new rule to get started.\n# Very helpful for projects created with new-package\nelm-review new-rule\n```\n\n## Try it out\n\nYou can try `elm-review` out without setting up anything!\n\nFirst of all, if you have `node` installed, it comes with `npx`, which lets you run `elm-review` without installing it by prepending the command by `npx`, like `npx elm-review`. It is a bit slower and requires Internet access, but it's useful to try it out.\n\nYou can also run a configuration you found on GitHub, using the `--template` flag. Even if you already have a configuration, you can use this to try out the rules from a new package before adding them to your configuration.\nFor instance, if you want to find and remove the dead code in your project, you can use the [example configuration](https://github.com/jfmengels/elm-review-unused/tree/main/example) from the [`jfmengels/elm-review-unused` package](https://package.elm-lang.org/packages/jfmengels/elm-review-unused/latest/).\n\n```sh\nnpx elm-review --template jfmengels/elm-review-unused/example\n\n# You can even use the configuration to fix all the errors that can be auto-fixed.\nnpx elm-review --template jfmengels/elm-review-unused/example --fix-all\n```\n\nIf you are happy with the configuration, you can base your own configuration off of it, and then edit it:\n\n```sh\nnpx elm-review init --template jfmengels/elm-review-unused/example\n```\n\nI **highly** recommend reading [this section on when to enable rules][when-to-write-or-enable-a-rule] in your configuration though.\n\nYou can use the same mechanics to try out a single rule before adding the dependency to your existing configuration and adding it to your configuration.\n\n```sh\nnpx elm-review --template jfmengels/elm-review-unused/example --rules NoUnused.Variables\n```\n\n## Configuration\n\n`elm-review` is configured through a `review/` folder in your project. It is a self-contained Elm project where you can\nspecify your dependencies, and write, import, and configure review rules.\n\nRules are configured in the `review/ReviewConfig.elm` file:\n\n```elm\nmodule ReviewConfig exposing (config)\n\nimport Review.Rule exposing (Rule)\nimport Third.Party.Rule\nimport My.Own.Custom.rule\nimport Another.Rule\n\n\nconfig : List Rule\nconfig =\n    [ Third.Party.Rule.rule\n    , My.Own.Custom.rule\n    , Another.Rule.rule { ruleOptions = [] }\n    ]\n```\n\n## Get started\n\nYou can get started with an empty configuration by running the `elm-review init` command with the command line tool installed,\nwhich will add a `review` folder to your project.\n\nYou can also use an existing configuration using `elm-review init --template \u003csome configuration\u003e`.\nI created [some configurations](https://github.com/jfmengels/elm-review-config) that I believe can be good **starting** points.\n\n```sh\n# Start with an empty configuration\nelm-review init\n\n# Starter configuration for an Elm application\nelm-review init --template jfmengels/elm-review-config/application\n\n# Starter configuration for an Elm package\nelm-review init --template jfmengels/elm-review-config/package\n```\n\nOnce you have set up an initial configuration, you can add new rules. As `elm-review` does not\n[come with built-in rules](https://github.com/jfmengels/elm-review/blob/main/documentation/design/no-built-in-rules.md),\nyou can look for packages with rules on the [Elm package registry](https://package.elm-lang.org/) by searching for packages named `elm-review-`.\n\nOnce you've found a package that you like, you can install it with the `elm install` command, just like any other Elm project dependency.\n\n```sh\ncd review/ # Go inside your review configuration directory\nelm install authorName/packageName\n# then update your `review/src/ReviewConfig.elm` to add the rule\n# as explained in the package's documentation\n```\n\nBefore you start adding rules or an unfamiliar existing configuration, I suggest reading the rest of this document, especially the section on [when to enable a rule][when-to-write-or-enable-a-rule].\n\n## Run a review\n\nOnce you're done configuring, run `elm-review` to analyze your project.\n\nYou can also run `elm-review --fix`. The CLI will present you fixes for the errors that offer an automatic fix, which you can then accept or not. When there are no more fixable errors left, `elm-review` will report the remaining errors as if it was called without `--fix`. Fixed errors will be reformatted using [`elm-format`].\n\nRun `elm-review --help` for more information on the available flags.\n\n```sh\nelm-review # Analyze your project\nelm-review --fix # Analyze your project and potentially proposes automatic fixes\nelm-review --help # for more information and the available flags\n```\n\n## Which parts of the project will be analyzed?\n\n`elm-review` targets a project, and therefore requires an `elm.json`. By default, it will review all the Elm files of the project and of the tests.\n\n- For packages: all the Elm files in `src/` and `tests/`\n- For applications: all the Elm files in `tests/` and in the project's `elm.json`'s `source-directories`\n\nIf you wish to, you can list the directories you wish to have reviewed, so as to review additional directories or to remove ignore some of directories, by adding them as arguments to the command line.\n\n```sh\n# Review `src/` if project is a package, or the \"source-directories\" otherwise, along with `tests/`\nelm-review\n# Review only the Elm files in the `src/Dashboard/`\nelm-review src/Dashboard/\n# Review all the Elm files in the src/, tests/ and review/ directories\nelm-review src/ tests/ review/\n# Review a specific file\nelm-review src/Dashboard.elm\n```\n\nThe recommended way to use `elm-review` is without arguments. It is best not to \"remove\" directories from the project, because some rules expect to have access to all the files in order to make the best analysis. If some data is missing, they may make incorrect reports. If you wish to ignore some files, it is best to handle that in the implementation and/or configuration of your rules.\n\nIf you add files that are not part of the project, you may run into different problems, such as conflicting module names (two `Main.elm` files), relying on different dependencies, etc. It is best to run `elm-review` once for each project, and depending on your needs, with different configurations (using the `--config` flag).\n\n## Exit status\n\nIf any rule from your configuration reports an error in one of the analyzed files, the process will exit with status 1. Otherwise, it will exit with status 0.\n\nIf the process fails for any other reason (crash, misconfiguration, ...), it will exit with status 1.\n\n## Why is there a need for a review/ directory?\n\nWhen the CLI looks at your configuration, it is in practice compiling an application using the configuration in your project, then running that application to analyze your project.\n\nThe CLI need at least two pieces of information from your configuration:\n\n- An `elm.json` file to know the external packages your configuration depends upon (like the ones that contain the rules you enabled), and the Elm version of your project\n- A `ReviewConfig.elm` file that sets the rules to enforce for your project\n\nYour custom rules, unless you want to share them in the Elm package registry, should be in the `review/` directory too, so as not to pollute your project's dependencies. If they are in here, we need to include these custom rules and their dependencies in the application files.\n\n## Tooling integration\n\nIf you are interested in using `elm-review` inside a different environment than a terminal (like editors, CI, other Elm tools, ...), check out the documentation for [tooling integration](./documentation/tooling-integration.md).\n\n## Thanks\n\nThanks to [**@MartinSStewart**][martinsstewart] for working on reducing the file cache size (and therefore speeding up the whole execution).\n\n[`elm-review`]: https://github.com/jfmengels/elm-review\n[`elm-format`]: https://github.com/avh4/elm-format\n[martinsstewart]: https://github.com/MartinSStewart\n[when-to-write-or-enable-a-rule]: https://package.elm-lang.org/packages/jfmengels/elm-review/latest/#when-to-write-or-enable-a-rule\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfmengels%2Fnode-elm-review","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfmengels%2Fnode-elm-review","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfmengels%2Fnode-elm-review/lists"}