- Upgrades eslint from v8 to v9 - Upgrades all other eslint packages. We will have to do a new full-project lint, as new rules have been added - Upgrades husky from v8 to v9 - Upgrades lint-staged from v14 to v15 - Moves the old .eslintrc.cjs file format to the new eslint.config.js flat file format. Previously, we were very specific regarding which rules are applied to which files. Now that `extends` is no longer a thing, I have to use deepMerge & imports instead. This is rather uncommon and is not a documented pattern - e.g. typescript-eslint docs want us to add the default typescript-eslint rules to the top-level & then disable it in files using the disable-typechecked config. However, I hate this opt-out approach. The way I did it here adds a lot of clarity as to which rules are applied to which files, and is pretty easy to read. Much less black magic ## .eslintignore These files are no longer supported (see https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files). I moved the entries to the ignores property in the eslint config. => one less file in each package folder!
Payload Relationship ObjectID Plugin
This plugin automatically enables all Payload relationship and upload field types to be stored as ObjectIDs in MongoDB.
Minimum required version of Payload: 1.9.5
What it does
It injects a beforeChange field hook into each relationship and upload field, which converts string-based IDs to ObjectIDs immediately prior to storage.
Usage
Simply import and install the plugin to make it work:
import { relationshipsAsObjectID } from '@payloadcms/plugin-relationship-object-ids'
import { buildConfig } from 'payload'
export default buildConfig({
// your config here
plugins: [
// Call the plugin within your `plugins` array
relationshipsAsObjectID(),
],
})
Migration
Note - this plugin will only store newly created or resaved documents' relations as ObjectIDs. It will not modify any of your existing data. If you'd like to convert existing data into an ObjectID format, you should write a migration script to loop over all documents in your database and then simply resave each one.
Support
If you need help with this plugin, join our Discord and we'd be happy to give you a hand.