no-reserved-default-properties-in-model - ESLint plugin rules

This rule disallows redefining the reserved default properties created_at, updated_at, and deleted_at in model.define.

Severity#

error. This rule is enabled in the recommended preset.

What it Targets#

This rule targets data model files in your project's src/modules directory. It reports a created_at, updated_at, or deleted_at property in a model.define schema, since Medusa adds these automatically.

The following code is reported by the rule:

src/modules/blog/models/post.ts
1import { model } from "@medusajs/framework/utils"2
3export const Post = model.define("post", {4  id: model.id().primaryKey(),5  created_at: model.dateTime(),6})

Instead, remove the reserved property:

src/modules/blog/models/post.ts
1import { model } from "@medusajs/framework/utils"2
3export const Post = model.define("post", {4  id: model.id().primaryKey(),5})

Why it's Important#

Medusa automatically adds created_at, updated_at, and deleted_at to every data model. Redefining them in your schema is redundant and can conflict with the auto-added columns.

Learn more in the Data Models documentation.

Fixable#

This rule is auto-fixable. Run the linter with the --fix option to apply the fix automatically.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵