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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-repo-structure

v0.1.1

Published

Validate folders and files structure and names given a config file

Readme

Repo Structure - Eslint Plugin

A plugin that allows you to define rules for the folder and file structure of your repository, as well as naming constraints that must be followed.

Installation

$ yarn add -D eslint-plugin-repo-structure

or

$ npm i --dev eslint-plugin-repo-structure

Getting started

  1. Define the log level that you want and the repo structure config path, Example:
{
  "plugins": ["repo-structure"],
  "rules": {
    "repo-structure/file-structure": "warn", // warn | error
  }
  "settings": {
    "repo-structure/config-path": ".repo-structurerc"
  }
}
  1. Create a JSON file with the folder and file structure that should be followed. For each module, you can also define rules for naming patterns, case and extensions that are allowed.

    To exclude files from validation, you can pass them to ignorePatterns attribute.

Example:

{
  "ignorePatterns": ["path/to/ignore-module/**.js", "**/.*Models.js"],
  "root": {
    "children": [
      {
        "name": "src",
        "children": [
          {
            "name": "controllers",
            "children": [
              {
                "case": "PascalCase",
                "name": "/^.*Controller$/",
                "extension": ".ts"
              }
            ]
          },
          // you can also reference rules ids created inside rules object
          { "id": "services-folder" }
          // ...
        ]
      },
      {
        "name": "tests",
        "children": [
          {
            "type": "file",
            "name": "/^.*\\.test$/",
            "extension": ".ts"
          }
        ]
      }
    ]
  },
  "rules": {
    "services-folder": {
      "name": "services",
      "children": [
        {
          "case": "PascalCase",
          "name": "/^.*Service$/",
          "extension": ".ts"
        }
      ]
    }
  }
}

You can also define it as a yaml file, example:

ignorePatterns:
  - path/to/ignore-module/**.js
  - "**/.*Models.js"

root:
  children:
    - name: src
      children:
        - name: controllers
          children:
            - case: PascalCase
              name: "/^.*Controller$/"
              extension: ".ts"
        - id: services-folder

    - name: tests
      children:
        - type: file
          name: "/^.*\\.test$/"
          extension: ".ts"

rules:
  services-folder:
    name: services
    children:
      - case: PascalCase
        name: "/^.*Service$/"
        extension: ".ts"
  1. Rules

    Here is the list of attributes that can be created inside of a rule object:

| rule | type | example | description | | --------- | ------------------ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | name | string | "components" or "/*.Controllers$/" | It's a fixed name or a regex pattern (must start and end with /) | | case | string | "PascalCase" or "camelCase" or "snake_case" or "kebab-case" or "dash-case" | | | type | string | "folder" or "file" | Indicates if the rule must apply only for files or folders (when empty will apply for both) | | extension | string or string[] | ".ts" or [".ts", ".js", ".tsx"] | Specify that a file must have one of the given extensions | | children | Rule[] or IdRule[] | | This attribute is used to define folders and the rules that their children nodes must follow |

When defining a list of rules for a folder children, an error or warning is raised if a given file or folder does not satisfy any of the listed rules.

Validating multiple file extensions.

Eslint uses JS parsers to interpret the written code, this means that its main purpose is not to run on other file extensions. However, if you want to validate the naming and casing for non js files, you can do this by using this hacky command:

$ npm eslint --parser ./node_modules/eslint-plugin-repo-structure/parser.js \
  --rule repo-structure/file-structure:warn \
  --ext .js,.ts,.tsx,.css,.svg,.yml,.png .

In this command, we override eslint parser so it can read files with other extensions, like .svg, .yml or even .png. We also have to specify it to run only the repo structure rule.