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

@lostofthought/eslint-plugin-ban-types-in-stage

v1.0.1

Published

An ESLint plugin to prevent the usage of types and values from one programming "stage" in another.

Readme

@lostofthought/eslint-plugin-ban-types-in-stage

An ESLint plugin to prevent the usage of types and values from one programming "stage" in another.

This plugin is primarily intended for use with typed-factorio when developing a Factorio mod with multiple Factorio API stages (settings, prototype, runtime) in the same TypeScript project without seperate tsconfig.json files.

Installation and Setup

1. Install Dependencies

Install ESLint, TypeScript, the TypeScript parser, and the plugin in one command:

pnpm add -D eslint typescript @typescript-eslint/parser @lostofthought/eslint-plugin-ban-types-in-stage

2. Configure ESLint

To get everything working, you need to configure the TypeScript parser and then add the plugin. Here is a complete eslint.config.js example:

// eslint.config.js
import typescriptParser from '@typescript-eslint/parser';
import banTypesInStagePlugin from '@lostofthought/eslint-plugin-ban-types-in-stage';

export default [
  // This first part sets up the parser for typed linting.
  // It must come before any rules that require type information.
  {
    files: ['src/**/*.ts'], // Adjust this glob to match your source files
    languageOptions: {
      parser: typescriptParser,
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },

  // The plugin has pre-built configurations. For Factorio mods, it is recommended
  // to use the 'factorio' config, which assumes this structure:
  // - `src/control/` for runtime files
  // - `src/data/` for prototype files
  // - `src/settings/` for settings files
  //
  // To use it, uncomment this line:
  // ...banTypesInStagePlugin.configs.factorio,

  // For other project structures or for non-Factorio projects, configure the rule manually.
  // First, register the plugin:
  {
    plugins: {
      '@lostofthought/ban-types-in-stage': banTypesInStagePlugin,
    },
  },

  // Then, configure the rule for each "stage" of your project. For example,
  // to prevent backend code from being imported into the frontend:
  {
    // Ban backend code in frontend files
    files: ['src/frontend/**/*.ts'],
    rules: {
      '@lostofthought/ban-types-in-stage/ban': ['error', {
        bannedPaths: ['src/backend'],
        currentStage: 'frontend',
      }],
    },
  },
  {
    // Ban frontend code in backend files
    files: ['src/backend/**/*.ts'],
    rules: {
      '@lostofthought/ban-types-in-stage/ban': ['error', {
        bannedPaths: ['src/frontend'],
        currentStage: 'backend',
      }],
    },
  },
];

When using the factorio config ruleset, you must configure your tsconfig.json to include the types for all Factorio stages. By loading all types, TypeScript becomes aware of all stage-specific definitions, which allows this ESLint plugin to correctly identify and restrict their usage in the appropriate files.

{
  "compilerOptions": {
    "types": [
      "typed-factorio/settings",
      "typed-factorio/prototype",
      "typed-factorio/runtime"
    ]
  },

  "tstl": {
    "buildMode": "library",
    "extension": ".lua",
    "luaTarget": "5.2",
    "noImplicitGlobalVariables": true,
    "noImplicitSelf": true,
    "noHeader": true,
    "lua51AllowTryCatchInAsyncAwait": false,
    "luaLibImport": "require-minimal",
    "sourceMapTraceback": true,
    "luaPlugins": [],
    "tstlVerbose": true,
    "noResolvePaths": []
  },
  
  "include": [
    "./src/**/*.ts",
    "./src/**/*.tsx"
  ]
}

Rules

This plugin exports one rule:

Contributing

This project uses semantic-release for automated versioning and releases. Please follow the Conventional Commits specification for your commit messages.

License

MIT