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

@ewerk/eslint-config

v2.0.0

Published

All-in-one solution for linting and code formatting in frontend projects

Readme

@ewerk/eslint-config – The all-in-one solution for linting and code formatting in frontend projects

NPM Version

This project contains rules for a consistent clean code style for frontend projects. That includes rules for HTML, JavaScript, Typescript and (s)css. It is compatible for all kind of javascript based frontend projects.

Following tools are used:

The project is currently optimized and tested for Angular projects (>= 19). The linting and formatting rules are very strict – maybe too strict for someone, but it is very helpful on working with large teams. The toolset and ruleset is completely modular. Take what you need.

The eslint rules are based on eslint-config-alloy.

Getting started

Install eslint, prettier, stylelint and this package:

$ npm i -D eslint prettier stylelint @ewerk/eslint-config

Configuration

ESLint

Note: This package now uses ESLint's new flat config format (ESLint 9+). Create an eslint.config.js file in your project root:

Create an eslint config file, e.g. .eslintrc.js:

// eslint.config.js

const baseConfig = require('@ewerk/eslint-config');
const typescriptConfig = require('@ewerk/eslint-config/typescript');
const angularConfig = require('@ewerk/eslint-config/angular');

module.exports = [
  ...baseConfig,       // basic rules for JS/TS/HTML
  ...typescriptConfig, // typescript specific rules
  ...angularConfig,    // angular specific rules
];

Modular usage – pick only what you need:

// eslint.config.js

// Only base rules (no TypeScript)
module.exports = require('@ewerk/eslint-config');

// Base + TypeScript
module.exports = [
  ...require('@ewerk/eslint-config'),
  ...require('@ewerk/eslint-config/typescript'),
];

// Full stack (base + TypeScript + Angular)
module.exports = [
  ...require('@ewerk/eslint-config'),
  ...require('@ewerk/eslint-config/typescript'),
  ...require('@ewerk/eslint-config/angular'),
];

Feel free to add your own rules or override pre-defined rules.

// eslint.config.js

module.exports = [
  ...require('@ewerk/eslint-config'),
  ...require('@ewerk/eslint-config/typescript'),
  {
    rules: {
      // your custom rules
      'no-console': 'off',
    },
  },
];

prettier

Create a prettier config file, e.g. .prettierrc.js:

// .prettierrc.js

module.exports = {
  ...require('@ewerk/eslint-config/prettierrc'),        // basic rules
  ...require('@ewerk/eslint-config/prettierrc.angular') // angular specific
};

Feel free to add your own rules or override pre-defined rules.

Create .prettierignore file with the following content to restrict prettier to only take care of HTML files.

# exclude all files
*.*

# include only html files
!*.html

###
# the following part is optional
# 
# to exclude e.g. the coverage files:
###

# exclude all sub directories
/*

# include e.g. only the real code 
!src/

stylelint

Create a stylelint config file, e.g. stylelint.config.js:

// stylelint.config.js

module.exports = {
  extends: [
    '@ewerk/eslint-config/stylelintrc',      // .css
    // or
    '@ewerk/eslint-config/stylelintrc.scss', // .scss
  ],
};

Feel free to add your own rules or override pre-defined rules.

Usage

Add a few commands to the package.json. It depends highly on your project. Here are a few suggestions:

// package.json

{
  ...
  "scripts": {
    ...
    "lint": "eslint src --fix",
    "stylelint": "stylelint --fix \"src/**/*.scss\"",
    "format:check": "prettier --check .",
    "format:write": "prettier --write .",
    "fix-code-style": "npm run lint && npm run stylelint && npm run format:write"
  },
  ...
}

To fix the format of the whole code (js/ts/html/css) just run:

$ npm run fix-code-style

Automate it

It is recommended to lint and format your code always before committing. To automate it just use a commit hook. E.g. use husky.

# .husky/pre-commit

npm run fix-code-style

But that's a bit overkill especially for a large codebase. You could use lint-staged to lint and format only files you changed:

// lint-staged.config.js

module.exports = {
  'src/**/*.{html,ts,js}': (filesArray) => {
    const files = filesArray.join(' ');
    return [
      `eslint --fix ${ files }`,
    ];
  },
  'src/**/*.scss': (filesArray) => {
    const files = filesArray.join(',');
    const filesPattern = filesArray.length > 1 ? `{${ files }}` : files;
    return [
      `stylelint --fix "{${ filesPattern }}"`,
    ];
  },
};

For formatting with prettier we sadly need another tool: pretty-quick Just add another command to scripts in the package.json:

    "format-staged:write": "pretty-quick --staged",

Now finally integrate all of it into the pre-commit hook:

# .husky/pre-commit

# run prettier for staged files
npm run format-staged:write

# run eslint fix for staged files
npx lint-staged --relative

Troubleshooting

For nx projects: See Using ESLint in Nx Workspaces

'describe' or 'jest' is not defined no-undef error

If you're getting no-undef linting errors in test files and you're using jasmine try to add the following to the .eslintrc.js:

module.exports = {
  ...,
  env: {
    jasmine: true, // 'describe' is not defined
    jest: true,    // 'jest' is not defined
  },
}

Things ToDo

  • [ ] Update Dependencies
  • [ ] Improve support for non-angular projects
  • [ ] Use prettier for formatting json files