AI-coding hygiene

no-mock-data-in-prod

Flag `mockUsers`/`fakeData`/`seedData`/`dummyConfig` arrays and placeholder emails (`john.doe@example.com`).

The "AI wrote the boilerplate, then nobody removed the fake data" antipattern. Two arms: (1) variables whose name matches `mock*`/`fake*`/`dummy*`/`placeholder*`/`stub*`/`seed*`/`sample*` and whose initializer is a literal array or object, including `Object.freeze([...])` and `[...] as const` wrappers; (2) placeholder emails (`john.doe@example.com`, `jane.smith@test.com`, `user@example.com`, etc.) anywhere in production source. Test/fixture/story files are exempted by path.

Behavior

  • Fixable: No.
  • Suggestions: No.

Examples

Bad:

export const mockUsers = [{ id: 1, email: "john.doe@example.com" }];

Good:

export async function listUsers() { return db.users.findAll(); }

Related rules

Use it

Enable no-mock-data-in-prod in your eslint.config.js:

import deslint from '@deslint/eslint-plugin';

export default [
  {
    plugins: { deslint },
    rules: {
      'deslint/no-mock-data-in-prod': 'error',
    },
  },
];

Found a false positive? Report it on GitHub →

Back to all rules