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-plugin-ezlint

v1.6.4

Published

The eslint config that goes perfectly with your prettier config.

Downloads

25

Readme

eslint-plugin-ezlint

This plugin provides a ✨PERFECT✨ match with the following prettier settings:


const config = {
  useTabs: false,
  tabWidth: 2,
  trailingComma: 'all',
  semi: true,
  singleQuote: true,
  jsxSingleQuote: true,
  bracketSpacing: true,
  arrowParens: 'always',
  endOfLine: 'auto',
  printWidth: 120,
  embeddedLanguageFormatting: 'off',
  quoteProps: 'as-needed',
  overrides: [
    {
      files: ['*.mts', '*.cts', '*.ts', '*.d.ts', '*.js', '*.jsx'],
      options: { parser: 'typescript' },
    },
    {
      files: ['*.json'],
      options: { parser: 'json' },
    },
  ],
};

export default config;

In fact, they go so well together, in a way that even hardcoded decisions made by prettier (which aren't configurable by you the developer at all) are caught and flagged by Eslint. I searched for every eslint rule I could possibly find which mimics prettier's code-of-conduct under the hood, so that if a file should be formatted by prettier? There's a 99% chance this eslint config will flag and warn you about it.

In prettier, some configurations are controlled by you. In the prettierrc config above I mentioned a specific set of prettier rules and what their VALUE MUST BE, in order for the two to work perfectly together.
As you probably know, eslint & prettier can collide, and have rule conflict. So this is just to avoid exactly these type of situations. If you find the above rules acceptable by you, you may go ahead and use this plugin with 100% certainty of 0 conflicts.

1. Installation

You'll first need to install ESLint:

With npm:

npm i -D eslint

With pnpm:

pnpm add -D eslint

With yarn:

yarn add -D eslint

Next, install eslint-plugin-ezlint:

With npm:

npm install -D eslint-plugin-ezlint

With pnpm:

pnpm add -D eslint-plugin-ezlint

With yarn:

yarn install -D eslint-plugin-ezlint

2. Usage

Add ezlint to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "extends": ["plugin:ezlint/recommended"]
}

3. Behind the scenes - ezlint

Parser

By default, eslint uses "espree" as its parser. It behaves "ok" for the most part, but it has trouble with:

  • importing files with extensions: .cts, .mts, .ts, .tsx, .d.cts, .d.mts, .d.ts.
  • using paths defined in tsconfig.json
  • resolving @types/* definitions over plain .js/.jsx
  • imports/exports fields support in package.json

That's why under the hood ezlint uses eslint-import-resolver-typescript, to mitigate all of the points mentioned above.

4. Rules

The rules inside the recommended config are divided into 6 groups:

  • base Rules
  • stylistic Rules
  • typescript Rules
  • export Rules
  • import Rules
  • jsdoc Rules

- A. Base Rules

  • arrow-body-style
  • dot-notation
  • no-debugger
  • no-bitwise
  • no-invalid-this
  • no-template-curly-in-string
  • no-useless-computed-key
  • no-useless-rename
  • no-useless-return
  • object-shorthand
  • prefer-arrow-callback
  • prefer-destructuring
  • prefer-const
  • prefer-template

- B. Stylistic Rules

  • @stylistic/array-bracket-spacing
  • @stylistic/arrow-spacing
  • @stylistic/comma-dangle
  • @stylistic/comma-spacing
  • @stylistic/comma-style
  • @stylistic/computed-property-spacing
  • @stylistic/dot-location
  • @stylistic/eol-last
  • @stylistic/func-call-spacing
  • @stylistic/function-call-argument-newline
  • @stylistic/jsx-quotes
  • @stylistic/key-spacing
  • @stylistic/keyword-spacing
  • @stylistic/max-len
  • @stylistic/new-parens
  • @stylistic/no-extra-parens
  • @stylistic/no-floating-decimal
  • @stylistic/no-multi-spaces
  • @stylistic/no-multiple-empty-lines
  • @stylistic/no-tabs
  • @stylistic/no-trailing-spaces
  • @stylistic/no-whitespace-before-property
  • @stylistic/object-curly-spacing
  • @stylistic/object-curly-newline
  • @stylistic/operator-linebreak
  • @stylistic/padded-blocks
  • @stylistic/quote-props
  • @stylistic/quotes
  • @stylistic/rest-spread-spacing
  • @stylistic/semi
  • @stylistic/semi-spacing
  • @stylistic/semi-style
  • @stylistic/space-before-blocks
  • @stylistic/space-before-function-paren
  • @stylistic/space-in-parens
  • @stylistic/space-infix-ops
  • @stylistic/space-unary-ops
  • @stylistic/spaced-comment
  • @stylistic/template-curly-spacing

- C. Typescript Rules

  • @typescript-eslint/no-unused-vars
  • all of typescript's eslint recommended rules, except:

@typescript-eslint/no-explicit-any
'@typescript-eslint/ban-ts-comment

- D. Export Rules

  • sort-exports/sort-exports

- E. Import Rules

  • import/no-duplicates
  • import/no-unresolved
  • import/newline-after-import
  • import/first
  • import/exports-last
  • import/extensions
  • import/order
  • sort-imports

- F. Jsdoc Rules

  • jsdoc/check-access
  • jsdoc/check-alignment
  • jsdoc/check-indentation
  • jsdoc/check-line-alignment
  • jsdoc/check-param-names
  • jsdoc/check-property-names
  • jsdoc/check-syntax
  • jsdoc/check-tag-names
  • jsdoc/check-types
  • jsdoc/check-values
  • jsdoc/empty-tags
  • jsdoc/implements-on-classes
  • jsdoc/informative-docs
  • jsdoc/match-description
  • jsdoc/multiline-blocks
  • jsdoc/no-bad-blocks
  • jsdoc/no-blank-block-descriptions
  • jsdoc/no-defaults
  • jsdoc/no-multi-asterisks
  • jsdoc/require-asterisk-prefix
  • jsdoc/require-hyphen-before-param-description
  • jsdoc/require-param
  • jsdoc/require-param-name
  • jsdoc/require-param-type
  • jsdoc/require-property
  • jsdoc/require-property-name
  • jsdoc/require-property-type
  • jsdoc/require-returns-check
  • jsdoc/require-returns-type
  • jsdoc/require-throws
  • jsdoc/require-yields
  • jsdoc/require-yields-check
  • jsdoc/sort-tags
  • jsdoc/tag-lines
  • jsdoc/valid-types