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

@cyrilolanolan/eslint-config-ts

v0.2.2

Published

ESLint configuration for TypeScript projects. This configuration encourages best practices by using a set of rules for consistent and high-quality coding across all projects.

Downloads

139

Readme

@cyrilolanolan/eslint-config-ts

ESLint configuration for TypeScript projects

This configuration encourages best practices by using a set of rules for consistent and high-quality coding across all projects.

Installation

  1. Install the package with its peer dependencies:

    npm i -D @cyrilolanolan/eslint-config-ts typescript eslint prettier
  2. Extend the configuration.

    In your ESLint Configuration (preferred):

    module.exports = {
      extends: ['@cyrilolanolan/ts'],
      // other configurations here
    };

    or add eslintConfig key in your package.json:

    {
      "eslintConfig": {
        "extends": "@cyrilolanolan/ts"
      }
    }

Configurations

This package uses the following recommended configurations:

Base

  • no-console - disallow the use of console
  • linebreak-style - enforce consistent linebreak style
  • id-length - enforce minimum and maximum identifier lengths
  • no-restricted-imports - relative imports are not allowed
  • unused-imports/no-unused-imports - disallow unused imports
  • import/no-cycle - ensures that there is no resolvable path back to this module via its dependencies
  • import/no-extraneous-dependencies - forbid the import of external modules that are not declared in package.json
  • import/no-duplicates - reports if a resolved path is imported more than once
  • import/no-self-import - forbid a module from importing itself
  • simple-import-sort/imports - sorts the import statements

TypeScript

  • @typescript-eslint/consistent-type-imports - enforce consistent usage of type imports
  • @typescript-eslint/no-unnecessary-condition - disallow conditionals where the type is always truthy or falsy
  • typescript-sort-keys/interface - sorts interface keys in ascending order
  • typescript-sort-keys/string-enum - typescript-sort-keys/string-enum

React

  • react/self-closing-comp - enforce self-closing component when there's no children

⚠️ Gotchas

Non standard tsconfig.json paths

If you use a TypeScript configuration file other than the default (tsconfig.json under the project's root), you need to specify its path:

{
  "eslintConfig": {
    "parserOptions": {
      "project": "./apps/ts-app/tsconfig.dev.json"
    }
  }
}

New ESLint configuration system (eslint.config.js)

ESLint announced a new configuration system, and from version 8.21.0, the old .eslintrc* is no longer used. It would still supported in v8, however in v9, the legacy configuration system would not be supported.

This configuration uses the legacy format (.eslintrc*) as of the moment and will be migrating to the new format once major frameworks ship out with the new one by default.

Good thing, ESLint has provided a package to continue using eslintrc-style shared configs and settings within a flat config file. In the meantime, here's how you can use this configuration if you're using the new format: @eslint/eslintrc.

Errors when using @typescript-eslint

Sometimes, errors with using @typescript-eslint are caused by version mismatch with other configuration files installed.

There is a known issue with eslint-config-next causing the linting to fail. This is because the package is using the v5 version of @typescript-eslint. Since this package is in v6, there are a lot breaking changes.

As a temporary fix, you can add an overrides key in your package.json and use the v6 version of the plugin.

{
  "overrides": {
    "eslint-config-next": {
      "@typescript-eslint/eslint-plugin": "6.1.0",
      "@typescript-eslint/parser": "6.1.0"
    }
  }
}