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

@ngneat/eslint-plugin-reactive-forms

v4.0.0

Published

ESLint rules for use with @ngneat/reactive-forms

Downloads

11,808

Readme

@ngneat/eslint-plugin-reactive-forms

ESLint rules for use with @ngneat/reactive-forms

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install @ngneat/eslint-plugin-reactive-forms:

$ npm install @ngneat/eslint-plugin-reactive-forms --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install @ngneat/eslint-plugin-reactive-forms globally.

Usage

Add reactive-forms to the plugins section of your .eslintrc configuration file.

"plugins": ["@ngneat/reactive-forms"],

Note: If you haven't set eslint up for use with Typescript, this article helps a lot: https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb

Supported Rules

  • @ngneat/reactive-forms/no-angular-forms-imports

Add the rule to your .eslintrc

"rules": {
  "@ngneat/reactive-forms/no-angular-forms-imports": "error"
}

Setting up the ESLint Rule in an Angular Project

To begin with, to allow ESLint to appropriately parse Typescript we need to install a few dependencies. NOTE: It is worthwhile doing this as TSLint is no longer supported Roadmap: TSLint -> ESLint

Open up your favourite shell in your Angular directory and run:

npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin

Next install our ESLint Plugin

npm install --save-dev @ngneat/eslint-plugin-reactive-forms

We now need to set up our ESLint config files. So create a new file at the root of your workspace called .eslintrc. Place the following into it:

{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint", "@ngneat/reactive-forms"],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ],
  "rules": {
    "@ngneat/reactive-forms/no-angular-forms-imports": "error"
  }
}

We also want to set up a file to tell ESLint which files we should ignore. Create another file at the root of your workspace called .eslintignore:

node_modules
dist

Finally, we will want to set up a convenient script for linting our project. Add the following to the scripts in package.json:

"scripts": {
  ...,
  "eslint": "eslint ./src --ext .ts"
}

If you use a monorepo via Angular CLI, you can also set it up to run linting per project:

"scripts": {
  ...,
  "lint:my-library": "eslint ./projects/my-library/src --ext .ts"
}

Now you can run npm run eslint or npm run lint:my-library and the console will error everytime it encounters a disallowed import from @angular/forms.

We also provide a built in fixer, which will automatically fix any occurences it finds. To run it simply add -- --fix to the end of your npm command: npm run eslint -- --fix