Registry / testing / slate-schema-violations

slate-schema-violations

JSON →
library0.1.39jsnpmunverified

Provides a set of named constants for the built-in validation violations in Slate's schema. This package is part of the Slate editor framework ecosystem and is used internally by `slate-schema` to represent rule-breaking reasons with human-readable identifiers. Version 0.1.39 is the latest stable release. It has no regular release cadence and is a lightweight utility with no dependencies. Key differentiator: it avoids magic strings for violation types.

npm install slate-schema-violations
INSTALL
IMPORT
SIG · SLATE-SCHEMA-VIOLA
S
slate-schema-violations
testingjavascriptv0.1.39
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CHILD_TYPE_INVALID
import { CHILD_TYPE_INVALID } from 'slate-schema-violations'
const { CHILD_TYPE_INVALID } = require('slate-schema-violations')
CommonJS require is supported but ESM import is preferred.
CHILD_REQUIRED
import { CHILD_REQUIRED } from 'slate-schema-violations'
import CHILD_REQUIRED from 'slate-schema-violations'
This package is also available as a default object containing all violations, but named imports are recommended.
Violations (all constants)
import * as Violations from 'slate-schema-violations'
const Violations = require('slate-schema-violations')
You can import all constants as a namespace.

Demonstrates importing and using a few violation constants from the package.

import { CHILD_TYPE_INVALID, CHILD_REQUIRED, PARENT_TYPE_INVALID, PARENT_REQUIRED, TEXT_NODE } from 'slate-schema-violations'; console.log(CHILD_TYPE_INVALID); // 'child_type_invalid' console.log(CHILD_REQUIRED); // 'child_required'
Debug
Known issues
breakingPackage is deprecated in favor of using custom rules with Slate's new plugin system (Slate >= 0.50).
fix
Migrate to Slate's new architecture; this package is no longer maintained.
affects: >=0.1.0
deprecatedAll constants are simply string values; no actual validation logic.
fix
Use these constants as keys in schema rules for clarity.
affects: >=0.1.0
gotchaThe package does not export a default object in ESM; named exports only.
fix
Import specific constants by name or use import * as Violations.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'slate-schema-violations'
Package not installed or path resolution issue.
fix
Run npm install slate-schema-violations --save
TypeError: Cannot read properties of undefined (reading 'CHILD_TYPE_INVALID')
Importing a default export that does not exist.
fix
Use named import: import { CHILD_TYPE_INVALID } from 'slate-schema-violations'
Upgrade
Version history
0.1.39latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
slate-schema-violations — npm install slate-schema-violations · libregistry