eslint-plugin-ckeditor5-rules

raw JSON →
15.0.0 verified Sat Apr 25 auth: no javascript

Official ESLint plugin used by the CKEditor 5 team for enforcing project-specific code style and linting rules. Current stable version is 15.0.0 (released as part of CKEditor 5 linters config). The plugin follows CKEditor 5's major/minor versioning policy, with breaking changes occurring in major releases. It provides rules for import validation, license headers, no-enum, module tag validation, changelog formatting, and more. Typically used via the eslint-config-ckeditor5 preset, but can be used standalone. Requires Node.js >=24.11.0. Differentiators: tightly coupled with CKEditor 5 development workflow; includes rules like `cross-package-imports`, `no-relative-imports`, and `allow-imports-only-from-main-package-entry-point` that enforce strict module boundaries.

error Error: Cannot find module 'eslint-plugin-ckeditor5-rules'
cause Package not installed or incorrect import path
fix
Run 'npm install --save-dev eslint-plugin-ckeditor5-rules' and verify the import is correct (ESM only)
error ESLint configuration error: ["ckeditor5-rules/no-relative-imports"] is not a valid rule
cause Rule name not prefixed correctly in flat config
fix
Use 'ckeditor5-rules/no-relative-imports': 'error' (include the prefix)
error TypeError: ckeditor5Rules is not a function or object
cause Using CommonJS require() on an ESM-only package
fix
Change to 'import ckeditor5Rules from 'eslint-plugin-ckeditor5-rules'' and ensure your project uses ESM
error Unsupported rule: ckeditor5-rules/ckeditor-imports
cause Rule was removed in v14.0.0
fix
Use 'ckeditor5-rules/allow-imports-only-from-main-package-entry-point' instead
breaking Removed 'ckeditor-imports' rule in v14.0.0
fix Use 'allow-imports-only-from-main-package-entry-point' rule instead
breaking Removed 'no-legacy-imports' rule in v14.0.0
fix Remove the rule from your config; it is no longer needed
deprecated The 'ckeditor5-rules/no-enum' rule is enabled by default in eslint-config-ckeditor5 since v15.0.0, disallowing enums unconditionally
fix Use TypeScript union types instead of enums, or disable the rule if you must use enums
gotcha Requires Node.js >=24.11.0; older Node versions will cause runtime errors
fix Upgrade Node.js to 24.11.0 or later
gotcha ESM-only package; cannot be used with CommonJS require or older ESLint (legacy .eslintrc) formats
fix Use import syntax and ESLint flat config
breaking Enabled 'enforce-node-protocol' rule for all JS/TS files in v13.0.0
fix Ensure all 'node:' imports use the full URL (e.g., 'node:fs') or disable the rule
npm install eslint-plugin-ckeditor5-rules
yarn add eslint-plugin-ckeditor5-rules
pnpm add eslint-plugin-ckeditor5-rules

Minimal ESLint flat config using the plugin with two CKEditor 5 rules

import { defineConfig } from 'eslint/config';
import ckeditor5Rules from 'eslint-plugin-ckeditor5-rules';

export default defineConfig([
  {
    plugins: {
      'ckeditor5-rules': ckeditor5Rules
    },
    rules: {
      'ckeditor5-rules/no-relative-imports': 'error',
      'ckeditor5-rules/license-header': ['error', {
        headerLines: [
          '/**',
          ' * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.',
          ' * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license',
          ' */'
        ]
      }],
      'ckeditor5-rules/no-enum': 'error'
    }
  }
]);