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

@dineroregnskab/eslint-plugin-custom-rules

v2.1.1

Published

ESLint plugin with custom rules for Dinero Regnskab

Downloads

874

Readme

Dinero Custom ESLint Rules

Custom extended rules for various Dinero specific standards & conventions.

Installation

Bundled with dinero.Frontend & dinero.Admin package.json, so a general npm install will include it as default.

Explicit install:

npm install @dineroregnskab/eslint-plugin-eslint-custom-rules@latest --save-dev

Development

Run npm i in root and in /example.

Adding rules

  • Add the rule here: dinero-web-2.0/Dinero.Packages/Dinero.EslintCustomRules/rules

  • Add the new js rule to this file eslint-plugin-custom-rules.js.

  • You can test the rule by adding some HTML code to test it on here dinero-web-2.0/Dinero.Packages/Dinero.EslintCustomRules/example

  • After adding the rule you can restart the ESLint server in vs code by pressing F1 -> ESLint: Restart ESLint Server.

Add html rules in test.html and run test with

npm run testhtml

Add ts rules in test.ts and run test with

npm run testts

Debugging what the eslint sees

Add a rule, and log it with console log, to see in terminal what is going on. Then run npm run testhtml npm script to see it in terminal.

module.exports = {
    meta: {
        type: "suggestion",
        docs: {
            description:
                "Enforce using `danishCurrency` pipe instead of `currency` pipe in Angular HTML templates.",
        },
        fixable: "code",
        schema: [],
    },

    create(context) {
        return {
            // Target the entire file and traverse each node
            Program(node) {
                console.log("Parsed Node Types:", node);
            },
        };
    },
};

Publish & install new rule locally

  1. Log in to npm using npm login
  2. run:
# {version_type}: The type of version increment (patch, minor, major)
npm version {version_type} && npm publish
  • In dinero.Frontend and/or dinero.Admin, update the root package.json file with the newly published version number.
  • Locate the eslintrc file and add the new rule in the rules property (under "files": ["*.html"], "files": ["*.ts"] etc. respectively).

Note: The reference here must be in the format of the package name without "eslint-plugin" + rule name

Example:

"@dineroregnskab/custom-rules/reducers-should-always-return": ["warn"]

  • Run
npm i

Note: You need to restart ESLint to apply new rules. Restart the ESLint server in vs code by pressing F1 -> ESLint: Restart ESLint Server or F1 -> reload window

See ESLint custom rule tutorial for more.

Useful tool for working with AST tree: AST Explorer

License

MIT