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

@keeex/eslint-config

v2.1.4

Published

Common eslint configuration

Downloads

534

Readme

Common eslint configuration for KeeeX

Description

Manage the eslint and prettier configuration used through all KeeeX projects.

tl;dr

  • install the package
  • run npx kxeslint-setup to run some check
  • configure eslint in eslint.config.js
  • run npx kxeslint-setup auto to install all required dependencies
  • enable eslint and prettier in whatever you use

Installation

The package is available on npmjs and can be installed with any package manager that supports it.

npm install -D @keeex/eslint-config

Usage

To prepare the configuration file, you can run npx kxeslint-setup to create a blank config file. Alternatively, you can create the file yourself. In both cases, it will be named eslint.config.js.

Here is all the available options with their default values:

import eslintConfig from "@keeex/eslint-config";

export default await eslintConfig({
  full: false,
  globals: [
    {globals: {builtin: true, es2025: true}},
    {
      files: ["**/*.cjs"],
      globals: {commonjs: true},
    },
    {
      files: ["src/webapp/**/*"],
      globals: {browser: true, serviceworker: true},
    },
    {
      files: ["src/bin/**/*", "src/server/**/*"],
      globals: {node: true},
    },
    {
      files: ["*.cjs"],
      globals: {nodeCjs: true},
    },
    {
      files: ["src/tests/**/*", "src/**/*.test.*"],
      globals: {mocha: true},
    },
  ],
  ignores: ["lib", "web", "gen", "src/gen"],
  import: 3,
  mocha: true,
  noBase: false,
  react: false,
  typescript: true,
});

If any of the top-level property is not defined, it will be set to its default value. If you want to customize the output, instead of directly exporting the return value of the function you can edit it by hand. Good luck with that.

Configuration

full

Enable some deeper, more costly checks. This is enabled automatically if the environment variable "KXESLINT" is set to "full", or if "GIT_HOOK_NAME" is set to "pre-push". You can enable it manually by passing full: true to the eslint config function.

globals

The globals property is an array of object to define which globals are available in the code. Each of these objects can have two properties: files, which is an array of globs to match the files to be considered, and globals, which is an object that can have the following properties:

  • "builtin": generic JS built-in globals
  • "browser": globals available in the browser
  • "commonjs": globals available in CommonJS scripts
  • "es2025": globals available in ES2025 scripts
  • "mocha": globals available in Mocha tests
  • "node": globals available in Node.js
  • "nodeCjs": globals for Node.js in commonjs
  • "serviceworker": globals available in Service Workers
  • "worker": globals available in Workers
  • "custom": an object of custom identifiers to be made available, whose keys are the identifiers and the values are boolean indicating if these identifiers are read-only (false) or not (true)

ignores

Array of globs to globally ignore for eslint.

import

Some extra rules for formatting and ordering imports can be used by setting import to true (enabled by default with a depth of 3). It is possible to pass a number instead of a boolean to limit the depth of circular imports check. This greatly improves performances, at the risk of missing a dependency cycle.

mocha

To enable mocha-specific rules, as well as loosen some regular rules for testing, set mocha to true.

noBase

The base configuration imports all eslint recommendeds rules and promises handling rules. Setting noBase to true removes that. There is absolutely no reason to do so.

react

To improve handling of React/JSX, set react to true. You can also pass an object with the following boolean properties:

  • reactHooks: enable/disable React hooks rules

You can't enable the hooks rules without enabling React, so if an object is provided React support is automatically enabled.

typescript

Set to true (the default value) to enable all TypeScript rules. This includes tsdoc rules.

Dependencies

This configuration depends on various packages to be available depending on the user settings for each individual projects. You can list the required dependencies for the current configuration by running npx kxeslint-setup. You can also automatically install missing dependencies by adding the "auto" flag to the command.

All dependencies are set as peer dependencies, as they are almost all optional depending on local settings.

The tool will also uninstall older dependencies that we used to have but are not used anymore.

Migration from .eslintrc.cjs

When running npx kxeslint-setup, the tool will automatically detect an existing .eslintrc.cjs file and provides instructions for the migration. The migration process is manual; you have to update the new eslint.config.js file by hand.

Debugging config issues

Running npx eslint --inspect-config will launch a debugger interface that allows checking all the rules and individual file rules.