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-saltids

v1.0.2

Published

ESLint plugin for prisma-extension-saltids to enforce transparency principle

Readme

eslint-plugin-saltids

npm version License: MIT

ESLint plugin for prisma-extension-saltids to enforce the transparency principle.

Why This Plugin?

The prisma-extension-saltids plugin is designed to be completely transparent to application code. Application developers should never need to manually handle salt fields (*Salt).

However, it's easy to accidentally break this principle by:

  1. Manually setting salt fields when creating records
  2. Destructuring salt fields from query results
  3. Using salt fields in business logic

This ESLint plugin catches these mistakes at development time.

Installation

npm install --save-dev eslint-plugin-saltids
# or
pnpm add -D eslint-plugin-saltids
# or
yarn add -D eslint-plugin-saltids

Usage

Flat Config (ESLint 9+)

// eslint.config.js
const saltidsPlugin = require('eslint-plugin-saltids');

module.exports = [
  {
    plugins: {
      saltids: saltidsPlugin,
    },
    rules: {
      'saltids/no-manual-salt-assignment': 'error',
    },
  },
];

Legacy Config (.eslintrc)

{
  "plugins": ["saltids"],
  "rules": {
    "saltids/no-manual-salt-assignment": "error"
  }
}

Rules

no-manual-salt-assignment

Disallow manual assignment of salt fields.

❌ Incorrect

// Creating records with manual salt assignment
const newUser = await prisma.user.create({
  data: {
    name: 'John',
    tenantId: tenant.id,
    tenantIdSalt: tenant.idSalt, // ❌ Error!
  },
});

// Destructuring salt fields
const { id, idSalt } = await prisma.tenant.findFirst(); // ❌ Error!

// Assigning to salt fields
user.tenantIdSalt = tenant.idSalt; // ❌ Error!

✅ Correct

// Creating records - only pass virtual ID
const newUser = await prisma.user.create({
  data: {
    name: 'John',
    tenantId: tenant.id, // ✅ Plugin handles the rest
  },
});

// Destructuring without salt fields
const { id, name } = await prisma.tenant.findFirst(); // ✅ Correct

// Salt fields are managed by the plugin
// No manual assignment needed

Options

{
  "saltids/no-manual-salt-assignment": [
    "error",
    {
      // Additional field names to treat as salt fields
      "additionalSaltFields": ["customSaltField"],
      
      // Patterns to ignore (regex strings)
      "ignorePatterns": ["^test.*Salt$"]
    }
  ]
}

additionalSaltFields

Array of additional field names to treat as salt fields. By default, any field ending with Salt is considered a salt field.

ignorePatterns

Array of regex patterns. Field names matching these patterns will not be flagged.

Standalone CLI Tool

This package also includes a standalone CLI tool for scanning projects:

# Scan current directory
npx check-saltids-usage

# Scan specific directory
npx check-saltids-usage ./src

# Or run directly
node node_modules/eslint-plugin-saltids/check-saltids-usage.js ./src

How It Works

The plugin detects:

  1. Object literal properties: { tenantIdSalt: value }
  2. Member assignment: obj.tenantIdSalt = value
  3. Destructuring: const { idSalt } = obj

Any field name ending with Salt is considered a salt field.

Background

When using prisma-extension-saltids:

  1. Virtual IDs (saltids) are encoded from physical ID + salt
  2. The plugin automatically decodes virtual IDs when writing to the database
  3. The plugin automatically encodes physical IDs when reading from the database
  4. Application code should only use virtual IDs

Manually setting salt fields bypasses this mechanism and breaks data consistency.

Common Mistakes

Mistake 1: Manually Setting Salt Fields

// ❌ WRONG - This breaks data consistency
const newUser = await prisma.user.create({
  data: {
    name: 'John',
    tenantId: tenant.id,
    tenantIdSalt: tenant.idSalt, // ❌ Don't do this!
  },
});

Result: The database stores the virtual ID (98211) instead of the physical ID (1), breaking foreign key relationships.

Correct Approach

// ✅ CORRECT - Let the plugin handle it
const newUser = await prisma.user.create({
  data: {
    name: 'John',
    tenantId: tenant.id, // Only pass virtual ID
  },
});

Result: The plugin automatically decodes the virtual ID and sets both tenantId = 1 and tenantIdSalt = 9821 in the database.

Related

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Ogentx Team