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

@wesp-up/eslint-config

v2.1.0

Published

This project maintains base ESLint configuration for TypeScript projects. Each file may be extended and custom configuration may be added. We use the recommended rules as much as possible to gain great default support.

Downloads

3,054

Readme

@wesp-up/eslint-config

This project maintains base ESLint configuration for TypeScript projects. Each file may be extended and custom configuration may be added. We use the recommended rules as much as possible to gain great default support.

For ultimate productivity, configure your IDE to auto-lint when saving changes.

Installation

npm install --save-dev @wesp-up/eslint-config eslint

Usage

  1. In your eslint.config.js (or alternative config entry), extend the config files that suit your project. For example:

    import config from '@wesp-up/eslint-config';
    
    export default [...config];
  2. In your tsconfig.json, include all TypeScript and JavaScript files via the following, including dot files.

    {
      "include": ["**/*", ".*"]
    }
    • Be sure to also exclude any files from your tsconfig now that it is being used for both linting and transpiling.

    • To get the full capabilities of linting with TypeScript, the parser must use the transpiler. If you would like to use a different tsconfig for linting, you can specify a new one via tsconfig.eslint.json then add the following to your eslint.config.js file.

      {
        "extends": "./tsconfig.json",
        "include": ["**/*", ".*"]
      }
      // eslint.config.js
      import config from '@wesp-up/eslint-config';
      
      export default [
        ...config,
        {
          languageOptions: {
            parserOptions: {
              project: './tsconfig.eslint.json',
            },
          },
        },
      ];
  3. In your package.json add the following scripts.

    {
      "scripts": {
        "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
        "lint:fix": "npm run lint -- --fix"
      }
    }
  4. Now test out linting via npm run lint and fixable issues with npm run lint:fix.

API

Below are each of the configuration files available and their explanations. Each config is composable and can be included with the other configs. Extend any configs that fit your project.

  • index.js: Base config for all TypeScript projects.
  • lib.js: Config for a shared library meant to be installed in other projects.

FAQ

  • Why do I get the error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.?

The full error will look like the following:

  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: <insert-file-name>.
The file must be included in at least one of the projects provided

This happens when a file should be included in linting when the TypeScript tsconfig.json is not including it. ESLint requires it to be included for TypeScript projects. This is why we recommend including all files in your tsconfig.json. For example, { "include": ["**/*", ".*"] }. This allows the entire project to adhere to the same linting and formatting rules.

  • I'm using supertest, why do I get the ESLint error vitest/expect-expect?

This is because there are no assertions in the Vitest format. The way supertest performs its assertions is not always readable. Rather than doing this:

import request from 'supertest';

await request(app).get('/route').expect(200);

Prefer to explicitly pull out the fields and use regular assertions:

import request from 'supertest';

const { status, body } = await request(app).get('/route');

expect(status).toBe(200);
expect(body).toEqual('some plain text');