Lint
Lint your document with custom rules.
This package is experimental. Expect breaking changes in future releases.
Installation
npm install @udecode/plate-lint
Usage
import { resolveLintConfigs } from '@udecode/plate-lint/react';
import { emojiLintPlugin } from '@udecode/plate-lint/plugins';
const lintConfigs = resolveLintConfigs([
emojiLintPlugin.configs.all,
// ...otherConfigs
]);
Configuration
To configure the linting rules, you can use the resolveLintConfigs
function to merge multiple configurations:
const configs = [
emojiLintPlugin.configs.all,
{
languageOptions: {
parserOptions: {
minLength: 4,
},
},
settings: {
emojiMap: wordToEmojisMap,
maxSuggestions: 5,
},
},
];
Plugins
EmojiLintPlugin
A plugin that provides linting rules for replacing text with emojis.
Options
Collapse all
Map of words to their corresponding emoji suggestions.
Maximum number of emoji suggestions to provide. Default: 8
API
resolveLintConfigs
Merges multiple lint configurations into a single set of resolved rules.
Parameters
Collapse all
Array of lint configurations to merge.
Returns
Collapse all
Object containing the resolved lint rules.