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

@feature-sliced/eslint-config

v0.1.1

Published

🍰 Lint feature-sliced concepts by existing eslint plugins

Downloads

45,767

Readme

@feature-sliced/eslint-config

WIP: At the moment at beta-testing - use carefully

npm npm npm bundle size GitHub Workflow Status

Linting of FeatureSliced concepts by existing eslint-plugins

Rules

Each rule has its own test cases and customization aspects

Get Started

  1. You'll first need to install ESLint:

    $ npm install -D eslint
    # or by yarn
    $ yarn add -D eslint
  2. Next, install @feature-sliced/eslint-config and dependencies:

    $ npm install -D @feature-sliced/eslint-config eslint-plugin-import eslint-plugin-boundaries
    # or by yarn
    $ yarn add -D @feature-sliced/eslint-config eslint-plugin-import eslint-plugin-boundaries
  3. Add config to the extends section of your .eslintrc configuration file (for recommended rules). You can omit the eslint-config postfix:

    {
        "extends": ["@feature-sliced"]
    }
  4. TYPESCRIPT-ONLY: Also setup TS-parser and TS-plugin (why?)

    Install dependencies:

    $ npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-import-resolver-typescript
    # or by yarn
    $ yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-import-resolver-typescript

    Configure @typescript-eslint/parser as parser and setup the eslint-import-resolver-typescript resolver in the .eslintrc config file:

    {
      "parser": "@typescript-eslint/parser",
      "settings": {
        "import/resolver": {
          "typescript": {
            "alwaysTryTypes": true
          }
        }
      }
    }

Usage

  • Support general aliases

    import { Input } from "~/shared/ui/input";
    import { Input } from "@/shared/ui/input";
    import { Input } from "@shared/ui/input";
    import { Input } from "$shared/ui/input";
    // But not - import { Input } from "$UIKit/input";
  • Support relative and absolute imports (but look at recommendations)

    import { ... } from "entities/foo";    // absolute imports
    import { ... } from "@/entities/foo";  // aliased imports
    import { ... } from "../entities/foo"; // relative imports
  • Case-agnostic

    import { ... } from "entities/user-post";  // Support kebab-case (recommended)
    import { ... } from "entities/UserPost";   // Support PascalCase
    import { ... } from "entities/userPost";   // Support camelCase
    import { ... } from "entities/user_post";  // Support snake_case
  • For exceptional cases, support ⚠️DANGEROUS-mode⚠️ (see more for specific rule)

Customization

  1. You can partially use the rules

    WARN: Don't use main config ("@feature-sliced") in customization to avoid rules conflicts.

    "extends": [
      "@feature-sliced/eslint-config/rules/import-order",
      "@feature-sliced/eslint-config/rules/public-api",
      "@feature-sliced/eslint-config/rules/layers-slices",
    ]
  2. You can use alternative experimental rules

    • Use import-order/experimental for formatting with spaces between groups and reversed order of layers (why?)

      "extends": [
        // ... Other rules or config
        "@feature-sliced/eslint-config/rules/import-order/experimental",
      ]
    • Use public-api/lite for less strict PublicAPI boundaries (why?)

      "extends": [
        // ... Other rules or config
        "@feature-sliced/eslint-config/rules/public-api/lite",
      ]
  3. You can use warnings instead of errors for specific rules

    "rules": {
       // feature-sliced/import-order
       "import/order": "warn" // ~ 1,
       // feature-sliced/public-api
       "import/no-internal-modules": "warn" // ~ 1,
       // feature-sliced/layers-slices
       "boundaries/element-types": "warn" // ~ 1,
    }
  4. You can use advanced FSD-specific messages processing

    # (feature-sliced/public-api)
    - 'Reaching to "features/search/ui" is not allowed.'
    + 'Violated usage of modules Public API | https://git.io/Jymjf'

See also