eslint-plugin-ckeditor5-rules

5.3.2 • Public • Published

CKEditor 5 ESLint plugins

npm version Dependency Status

A set of plugins used by the CKEditor 5 team for Eslint

By default this plugin is added to our eslint-config-ckeditor5 preset.

Usage

npm i --save-dev eslint-plugin-ckeditor5-rules

Configure ESLint with a .eslintrc file using the following contents:

{
	// ...
	plugins: [
		// ...
		'ckeditor5-rules' // Add the plugin to the linter.
	],
	rules: {
		'ckeditor5-rules/no-relative-imports': 'error',
		'ckeditor5-rules/license-header': [ 'error', {
			headerLines: [
				'/**',
				' * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.',
				' * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license',
				' */'
			]
		} ]
		// ...
	}
	// ...
}

Rules

no-relative-imports

A rule that inspects for relative imports to other CKEditor 5's packages:

// Incorrect import:
import Position from '../../ckeditor5-engine/src/model/position';

// Will be fixed to:
import Position from '@ckeditor/ckeditor5-engine/src/model/position';

license-header

This rule checks if each file starts with proper @license block comment. It requires configuration:

rules: {
	'ckeditor5-rules/license-header': [ 'error', {
		headerLines: [
			'/**',
			' * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.',
			' * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license',
			' */'
		]
	} ]
}

Package Sidebar

Install

npm i eslint-plugin-ckeditor5-rules

Weekly Downloads

6,217

Version

5.3.2

License

MIT

Unpacked Size

53 kB

Total Files

20

Last publish

Collaborators

  • ckeditor