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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-angular-class-ordering

v0.5.1

Published

ESLint plugin: Angular class member ordering, prefer-inject-function, forbid-nested-super-injections

Readme

eslint-plugin-angular-class-ordering

ESLint plugin focused on member-ordering: it keeps Angular class members (fields and methods) in a consistent order inside @Component, @Directive, @Injectable, and @Pipe classes. It understands modern Angular APIs (inject, signal-based input / output / model, signal, computed, queries, and common decorators) and includes auto-fix for layout.

Two optional rules ship with the same package — prefer-inject-function (constructor DI → inject(), with fix) and forbid-nested-super-injections (subclass super() / field-init ordering; warn-only). They are not part of the default preset so installing the plugin only turns on member ordering unless you enable the others yourself.

Requirements

  • Node.js ^18.18.0 || ^20.9.0 || >=21.1.0
  • ESLint ^8.57.0 || ^9.0.0
  • TypeScript sources linted with @typescript-eslint/parser (Angular projects already use this).

Install

npm install --save-dev eslint @typescript-eslint/parser eslint-plugin-angular-class-ordering

ESLint flat config (eslint.config.js)

const angularClassOrdering = require('eslint-plugin-angular-class-ordering');
const tsParser = require('@typescript-eslint/parser');

module.exports = [
    {
        files: ['**/*.ts'],
        languageOptions: {
            parser: tsParser,
            parserOptions: {
                ecmaVersion: 'latest',
                sourceType: 'module',
            },
        },
        plugins: {
            'angular-class-ordering': angularClassOrdering,
        },
        rules: {
            ...angularClassOrdering.configs.recommended.rules,
        },
    },
];

The bundled recommended config enables only member-ordering at error. It does not enable prefer-inject-function or forbid-nested-super-injections, so you do not get unexpected constructor refactors from --fix until you opt in.

To opt in to the inject-related rules (typical pairing: prefer-inject-function as error, forbid-nested-super-injections as warn), add them next to recommended:

rules: {
  ...angularClassOrdering.configs.recommended.rules,
  'angular-class-ordering/prefer-inject-function': 'error',
  'angular-class-ordering/forbid-nested-super-injections': 'warn',
},

For prefer-inject-function, set autofix: false when you want diagnostics without --fix rewrites (for example at warn severity). ESLint does not pass severity into rule implementations, so this must be configured explicitly. See prefer-inject-function for options and examples.

Override rule options:

rules: {
  "angular-class-ordering/member-ordering": [
    "error",
    {
      decorators: ["Component", "Injectable"],
      unknownPlacement: "last",
    },
  ],
},

Legacy config (.eslintrc.cjs)

module.exports = {
    overrides: [
        {
            files: ['*.ts'],
            parser: '@typescript-eslint/parser',
            plugins: ['angular-class-ordering'],
            rules: {
                'angular-class-ordering/member-ordering': 'error',
            },
        },
    ],
};

Rule documentation

Scripts (development)

npm test
npm run test:watch
npm run lint
npm run lint:fix
npm run format:check

Repository

Source and issue tracker: github.com/Leritas/eslint-plugin-angular-class-ordering.

GitHub Actions runs npm test, npm run lint, and npm run format:check on pushes and pull requests to main / master (Node 18, 20, 22).