Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/

import { readdirSync } from 'fs';
import globals from 'globals';
import { defineConfig } from 'eslint/config';
import ckeditor5Rules from 'eslint-plugin-ckeditor5-rules';
import ckeditor5Config from 'eslint-config-ckeditor5';
import ts from 'typescript-eslint';
import eslintPluginImport from 'eslint-plugin-import';

import rootPkgJson from './package.json' with { type: 'json' };
import { CKEDITOR5_PACKAGES_PATH } from './scripts/constants.mjs';

const disallowedImports = Object.keys( rootPkgJson.devDependencies ).filter( pkgName => {
return pkgName.match( /^(@ckeditor\/)?ckeditor5-(?!dev-)/ );
} );

Comment thread
filipsobol marked this conversation as resolved.
const projectPackages = readdirSync( CKEDITOR5_PACKAGES_PATH, { withFileTypes: true } )
.filter( dirent => dirent.isDirectory() )
.map( dirent => dirent.name );

export default defineConfig( [
{
ignores: [
'.*/',
'!.changelog/',
'build/**',
'coverage/**',
'dist/**',
Expand Down Expand Up @@ -179,5 +185,21 @@ export default defineConfig( [
rules: {
'ckeditor5-rules/ckeditor-imports': 'off'
}
},
{
extends: ckeditor5Config,

files: [ '.changelog/**/*.md' ],

plugins: {
'ckeditor5-rules': ckeditor5Rules
},

rules: {
'ckeditor5-rules/validate-changelog-entry': [ 'error', {
allowedScopes: projectPackages,
repositoryType: 'mono'
} ]
}
}
] );
4 changes: 3 additions & 1 deletion scripts/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const __filename = fileURLToPath( import.meta.url );
const __dirname = upath.dirname( __filename );

export const CKEDITOR5_ROOT_PATH = upath.join( __dirname, '..' );
export const CKEDITOR5_PACKAGES_PATH = upath.join( CKEDITOR5_ROOT_PATH, PACKAGES_DIRECTORY );
Comment thread
pomek marked this conversation as resolved.
export const CKEDITOR5_COMMERCIAL_PATH = upath.join( CKEDITOR5_ROOT_PATH, 'external', 'ckeditor5-commercial' );
export const CKEDITOR5_PREMIUM_FEATURES_PATH = upath.join( CKEDITOR5_COMMERCIAL_PATH, PACKAGES_DIRECTORY, 'ckeditor5-premium-features' );
export const CKEDITOR5_COMMERCIAL_PACKAGES_PATH = upath.join( CKEDITOR5_ROOT_PATH, PACKAGES_DIRECTORY );
Comment thread
filipsobol marked this conversation as resolved.
Outdated
export const CKEDITOR5_PREMIUM_FEATURES_PATH = upath.join( CKEDITOR5_COMMERCIAL_PACKAGES_PATH, 'ckeditor5-premium-features' );

export const CKEDITOR5_INDEX = upath.join( CKEDITOR5_ROOT_PATH, 'src', 'index.ts' );
export const CKEDITOR5_PREMIUM_FEATURES_INDEX = upath.join( CKEDITOR5_PREMIUM_FEATURES_PATH, 'src', 'index.ts' );