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

eslint-config-un

v0.2.4

Published

A universal-ish ESLint config aiming to be reasonably strict and easily configurable.

Downloads

485

Readme

eslint-config-un

npm

Grown out of the personal collection of rules, an ESLint config aspiring to cover as many rules as possible, be reasonably strict and easily configurable. Only supports ESLint 9 and the flat config format.

Installation

npm i -D eslint-config-un
pnpm i -D eslint-config-un
yarn add -D eslint-config-un

List of configs

Includes the rules from the following configs & plugins:

Features

  • Automatically detects the presence of typescript, vue, nuxt and pinia packages and enables corresponding configurations (which can also be enabled or disabled explicitly).
  • Every block of rules supports overrides for rules.
  • Designed to be used separately from Prettier: almost all the rules potentially conflicting with Prettier are disabled by default.
  • Written in TypeScript so all the options are typed.

Usage

In your eslint.config.[cm]?js:

// @ts-check
import {eslintConfig} from 'eslint-config-un';

export default eslintConfig({
  // your configuration (optional)
});

Notes

  • You don't need to install any of the mentioned configs/plugins as they are all the dependencies of this package.
  • This package has a peer dependency of eslint>=9. Please ensure you have installed the correct version. Some package managers are installing non-optional peer dependencies automatically.
  • Packages lookup (such as typescript or vue) is performed using local-pkg.
  • Type-checked, or type-aware TypeScript rules are enabled by default which are known to be performance-demanding. It's just a little heads-up and you should make your own decision whether to keep them enabled. More about type-aware linting.
  • By default, TypeScript rules will be enabled in .vue files if enforceTypescriptInScriptSection is set to true in vue's config options which in turn is automatically set to true if typescript package found installed. If you have .vue files authored in both TypeScript and JavaScript, use enforceTypescriptInScriptSection.{files,ignores} to manually specify TS & JS Vue components respectively. It is not currently possible to apply different ESLint rules depending on the value of lang attribute of <script> SFC section.
  • All plugins listed above are enabled by default or enabled automatically under certain conditions, but there is some that are disabled by default:
    • prefer-arrow-functions
    • security
    • json
    • yaml
    • toml
    • package-json
  • Some rules are set to warn by default. You can change some or even all such rule's reporting level using errorsInsteadOfWarnings option. You can find all such rules by inspecting the source code of this package.

Certain rules are disabled for code blocks inside *.md files

If markdown config is enabled (which is the default), the same rules provided by other configs will be applied to code blocks (```lang ... ```) inside Markdown files. This works because under the hood the plugin @eslint/markdown that provides that functionality will create virtual files for each code block with the same extension as specified after ```.

But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports). You can find the full list of disabled rules in src/configs/markdown.ts file.

Troubleshooting

TypeError: Key rules: Key disable-autofix/<rule name>: Could not find <rule name> in plugin disable-autofix

We disable autofix for some rules in this package via eslint-plugin-disable-autofix. However, it requires all the configs/plugins packages to be hoisted (installed to the top level of node_modules). You might need to reinstall this package, re-create node_modules directory (do not delete your lock file!) or set shamefully-hoist=true in your .npmrc if you're using pnpm. Sometimes you'll need to manually install some packages refused to be hoisted (happens with @typescript-eslint/eslint-plugin: npm i @typescript-eslint/eslint-plugin -D --legacy-peer-deps).

This error could also happen if a dependency of this package is installed in your project separately.

TypeError: Key languageOptions: Key globals: Global AudioWorkletGlobalScope has leading or trailing whitespace.

Install globals package as a dev dependency.