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

@aidenlx/eslint-config

v2.0.5

Published

<p align="left"> <a aria-label="Build" href="https://github.com/belgattitude/nextjs-monorepo-example/actions?query=workflow%3ACI"> <img alt="build" src="https://img.shields.io/github/workflow/status/belgattitude/nextjs-monorepo-example/CI-web-app/ma

Downloads

22

Readme

@your-org/eslint-config-bases

About

Example of composable eslint config bases that can be easily shared and fine-tuned by apps and packages that lives in a monorepo.

Features

Features

  • Monorepo friendly: Each workspace can have its own config.
  • Composable: Compose your workspace eslint config from pre-defined bases.
  • Peace of mind: Plugins does not need to be installed per workspaces, thx to @rushstack/eslint-patch.
  • Extensible: Easily add additional plugins per workspaces (ie: nextjs, remix...)
  • Performance: Plugins enabled on file conventions patterns to increase perf.

Install

Add the following devDependencies to workspace (apps/packages in monorepo) or main project package.json.

$ yarn add --dev eslint
$ yarn add --dev @your-org/eslint-config-bases:"workspace:^"

Tip the workspace:^ is supported by yarn and pnpm.

Usage

In your app or package, create an ./apps/my-app/.eslintrc.js file that extends any of the existing base configs. For example:

// Workaround for https://github.com/eslint/eslint/issues/3458 (re-export of @rushstack/eslint-patch)
require("@your-org/eslint-config-bases/patch/modern-module-resolution");

module.exports = {
  // Be sure to set root to true in monorepo.
  root: true,
  // Will help typescript extended rules.
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: "tsconfig.json",
  },
  ignorePatterns: ["**/node_modules", "**/.cache", "build", ".next"],
  extends: [
    "@your-org/eslint-config-bases/typescript",
    "@your-org/eslint-config-bases/sonar",
    "@your-org/eslint-config-bases/regexp",
    "@your-org/eslint-config-bases/react",
    "@your-org/eslint-config-bases/jest",
    "@your-org/eslint-config-bases/rtl",
    "@your-org/eslint-config-bases/graphql-schema",
    "@your-org/eslint-config-bases/storybook",
    "@your-org/eslint-config-bases/playwright",

    // Add specific rules for your framework if needed.
    // ie:
    // - nextjs: 'plugin:@next/next/core-web-vitals',
    // - remix:  '@remix-run/eslint-config',
    // ...

    // Post configure the prettier base so there won't be
    // any conficts between eslint / prettier
    "@your-org/eslint-config-bases/prettier",
  ],
  rules: {
    // Specific global rules for your app or package
  },
  overrides: [
    // Specific file rules for your app or package
  ],
};

Tip: "@your-org/eslint-config-bases/prettier" must be set at the end to disable any conflicting rules.

Bases

You can find the bases in ./src/bases.

| Base | Match convention | Scope | | :---------------------------------------------- | :-------------------------------- | :-------------------------------------------------------------- | | typescript | all | Naming conventions, consistent imports, import sorting... | | sonar | *.{js,jsx,ts,tsx} | Keep levels of code complexity sane. (excl test and stories) | | regexp | *.{js,jsx,jsx,tsx} | Keep regexp consistent and safer. | | react | *.{jsx,tsx} | Recommendations for react, react-hooks and jsx projects. | | jest | **/?(*.)+(test).{js,jsx,ts,tsx} | Catch inconsistencies or error in jest tests. | | rtl | **/?(*.)+(test).{js,jsx,ts,tsx} | Potential errors / deprecations in react-testing-library tests. | | graphql-schema | *.graphql | Ensure validity of graphql schema files. | | storybook | *.stories.{ts,tsx,mdx} | Potential errors / deprecations in stories. | | playwright | **/e2e/**/*.test.{js,ts} | Post configure eslint for prettier compatibility. | | prettier | all | Post configure eslint for prettier compatibility. |

Notes:

  • The order is important. Some bases will disable or tune previously defined rules. For example the react base will tune the naming conventions for function components and increase recommended cognitive complexity. The typescript base will also relax conventions for javascript files.

  • Based on filename conventions some rules are relaxed or disabled to avoid false positives and keep a good level of performance. For example the sonar base won't run on test and storybook files. If you work on different conventions the patterns must be updated.

Prettier integration

To prevent conflicts between prettier and eslint, you must re-export the prettier base from @your-org/eslint-config-bases.

const { getPrettierConfig } = require("@your-org/eslint-config-bases/helpers");
module.exports = {
  ...prettierConfig,
  overrides: [
    // whatever you need
  ],
};

Tip: You can tune the provided prettier.base.config for your own needs.

Notes

Typescript

Generic typescript project, mostly based on

| Type/Plugin | Comment | | :----------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | | eslint:recommended | The basics for code linting. | | @typescript-eslint/recommended | The basics for typescript. | | @typescript-eslint/consistent-type | Use TS 3.8+ imports/exports, helps with esbuild | | @typescript-eslint/naming-convention | | | eslint-plugin-import | Order imports |

Sonarjs

| Type/Plugin | Comment | | :---------------------------------------------------------------------------------------- | :--------------------------- | | eslint-plugin-sonarjs/recommended | Help to keep complexity sane |

React

| Type/Plugin | Comment | | :---------------------------------------------------------------------------------------------------------------------- | :--------------------------------------- | | eslint-plugin-react/recommended | | | eslint-plugin-react-hooks/recommended | | | eslint-plugin-jsx-a11y/recommended | Helps to produce accessibility-ready jsx |

Jest

| Type/Plugin | Comment | | :------------------------------------------------------------------------------------- | :-------------------------- | | eslint-plugin-jest/recommended | Jest recommended practices. |

React Testing Library

| Type/Plugin | Comment | | :------------------------------------------------------------------------------------------------------------ | :------------------------------------ | | eslint-plugin-testing-library/recommended | Ease when using react-testing-library |

Regexp

| Type/Plugin | Comment | | :------------------------------------------------------------------------------------ | :------ | | eslint-plugin-regexp/recommended | |

Etc

...