Skip to content

Commit

Permalink
Merge branch 'master' into ck/epic/1944-bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
godai78 committed Oct 16, 2024
2 parents 695a23e + 5a593d2 commit 8a56943
Show file tree
Hide file tree
Showing 541 changed files with 4,154 additions and 63 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ version: 2.1

setup: true

# List of parameters must be synchronized between configuration files.
parameters:
isNightly:
type: boolean
Expand All @@ -38,7 +39,7 @@ commands:
jobs:
generate_configuration:
machine: true
resource_class: xlarge
resource_class: large
parameters:
isNightly:
type: boolean
Expand Down
11 changes: 6 additions & 5 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# To modify commands to execute on CI review this file, and the script that generates it.
version: 2.1

# List of parameters must be synchronized between configuration files.
parameters:
isNightly:
type: boolean
Expand Down Expand Up @@ -110,7 +111,7 @@ jobs:

cke5_validators:
machine: true
resource_class: xlarge
resource_class: large
steps:
- checkout_command
- bootstrap_repository_command
Expand Down Expand Up @@ -150,7 +151,7 @@ jobs:

cke5_coverage:
machine: true
resource_class: xlarge
resource_class: medium
steps:
- community_verification_command
- checkout_command
Expand All @@ -174,7 +175,7 @@ jobs:

cke5_trigger_release_process:
machine: true
resource_class: xlarge
resource_class: medium
steps:
- community_verification_command
- checkout_command
Expand Down Expand Up @@ -202,7 +203,7 @@ jobs:

cke5_trigger_uber_ci:
machine: true
resource_class: xlarge
resource_class: medium
steps:
- community_verification_command
- checkout_command
Expand Down Expand Up @@ -253,7 +254,7 @@ jobs:

stale_bot:
machine: true
resource_class: xlarge
resource_class: large
steps:
- checkout_command
- bootstrap_repository_command
Expand Down
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ module.exports = {
]
},
overrides: [
{
files: [ './packages/*/src/**/*.ts' ],
rules: {
'ckeditor5-rules/ckeditor-plugin-flags': [
'error',
{
requiredFlags: [
{
name: 'isOfficialPlugin',
returnValue: true
}
],
disallowedFlags: [ 'isPremiumPlugin' ]
}
]
}
},
{
files: [ '**/tests/**/*.@(js|ts)' ],
rules: {
Expand Down
69 changes: 64 additions & 5 deletions docs/framework/contributing/code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ However, some packages cannot import modules from CKEditor 5 as it could le

Currently, it applies to the `@ckeditor/ckeditor5-watchdog` package.

👎  Examples of an incorrect code for this rule:
👎  Examples of incorrect code for this rule:

```js
// Assume we edit a file located in the `packages/ckeditor5-watchdog/` directory.
Expand Down Expand Up @@ -1049,7 +1049,7 @@ import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

Importing anything from the `src` directory to extend a CKEditor 5 build is not allowed. Other directories from a predefined build are not published on npm, so such imports will not work.

👎  Examples of an incorrect code for this rule:
👎  Examples of incorrect code for this rule:

```js
// Assume we edit a file located in the path: `packages/ckeditor5-alignment/docs/_snippets/features/text-alignment.js`.
Expand Down Expand Up @@ -1079,7 +1079,7 @@ This rule forces all `declare module '@ckeditor/ckeditor5-core'` to be defined i

This rule ensures that all imports from the `@ckeditor/*` packages are done through the main package entry points. This is required for the editor types to work properly and to ease migration to the installation methods introduced in CKEditor 5 v42.0.0.

👎  Example of an incorrect code for this rule:
👎  Example of incorrect code for this rule:

```ts
// Importing from the `/src/` folder is not allowed.
Expand All @@ -1106,7 +1106,7 @@ In TypeScript, the types inferred from some values are simplified. For example,

The `require-as-const-returns-in-methods` rule requires some methods that depend on the exact type of returned data (for example, `'delete'` literal string instead of the generic `string` in the `pluginName` method, or `readonly [typeof Table]` instead of `[]` in the `requires` method) to have all return statements with `as const`.

👎  Examples of an incorrect code for this rule:
👎  Examples of incorrect code for this rule:

```ts
export default class Delete extends Plugin {
Expand Down Expand Up @@ -1169,11 +1169,70 @@ The second case is common for the documentation files, because its pieces are lo

In such cases, you must add the file extension manually. Imports with file extensions are not validated.

### Require or disallow certain plugin flags: `ckeditor5-rules/ckeditor-plugin-flags`

<info-box warning>
This rule should only be used on `.ts` files.
</info-box>

This rule ensures that plugin flags are either correctly set or not set at all. It checks whether the flags have the correct type and value, preventing common mistakes and ensuring compliance with the CKEditor&nbsp;5 plugin API.

Options:

* `requiredFlags` &ndash; (optional) An array of flags that must be set in the plugin.
* `disallowedFlags` &ndash; (optional) An array of flags that must not be set in the plugin.

The example configuration below requires the `isFooPlugin` flag to be set to `true` and disallows the `isBarPlugin` flag:

```json
{
"requiredFlags": [
{
"name": "isFooPlugin",
"returnValue": true
}
],
"disallowedFlags": [ "isBarPlugin" ]
}
```

👎&nbsp; Examples of incorrect code for this rule:

```ts
export default class MyPlugin extends Plugin {
static get pluginName() {
return 'MyPlugin';
}

public static override get isBarPlugin(): false {
return false;
}
}
```

The `isBarPlugin` flag is disallowed, and the plugin has it set to `false`. Additionally, the `isFooPlugin` flag is required but not defined.

👍&nbsp; Examples of correct code for this rule:

```ts
export default class MyPlugin extends Plugin {
static get pluginName() {
return 'MyPlugin';
}

public static override get isFooPlugin(): true {
return true;
}
}
```

The `isFooPlugin` flag is required and set to `true`, and the `isBarPlugin` flag is not defined.

### No legacy imports

This rule ensures that imports are done using the {@link updating/nim-migration/migration-to-new-installation-methods new installation methods}. All imports should be done using either the `ckeditor5` package to get the editor core and all open-source plugins, or `ckeditor5-premium-features` to get the premium features.

👎&nbsp; Examples of an incorrect code for this rule:
👎&nbsp; Examples of incorrect code for this rule:

```js
// Import from `ckeditor5/src/*`.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"coveralls": "^3.1.0",
"date-fns": "^4.0.0",
"eslint": "^8.21.0",
"eslint-config-ckeditor5": "^7.0.0",
"eslint-config-ckeditor5": "^8.0.0",
"eslint-formatter-stylish": "^8.40.0",
"estree-walker": "^3.0.3",
"fs-extra": "^11.0.0",
Expand Down Expand Up @@ -208,7 +208,7 @@
"release:publish-packages": "node ./scripts/release/publishpackages.mjs",
"release:deploy-cdn": "node ./scripts/release/deploycdn.mjs",
"release:lint-packages": "node ./scripts/release/validatepackages.mjs",
"release:switch-latest": "node ./scripts/release/switchlatest.mjs",
"release:switch-latest-npm": "node ./scripts/release/switchlatestnpm.mjs",
"release:clean": "node ./scripts/release/clean.mjs",
"clean-up-svg-icons": "node ./scripts/clean-up-svg-icons.mjs",
"collect-svg-icons": "node scripts/collect-svg-icons.mjs",
Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-adapter-ckfinder/src/uploadadapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export default class CKFinderUploadAdapter extends Plugin {
return 'CKFinderUploadAdapter' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-adapter-ckfinder/tests/uploadadapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ describe( 'CKFinderUploadAdapter', () => {
}
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( CKFinderUploadAdapter.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( CKFinderUploadAdapter.isPremiumPlugin ).to.be.false;
} );

it( 'should be loaded', () => {
expect( editor.plugins.get( CKFinderUploadAdapter ) ).to.be.instanceOf( CKFinderUploadAdapter );
} );
Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-alignment/src/alignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ export default class Alignment extends Plugin {
public static get pluginName() {
return 'Alignment' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}
}
7 changes: 7 additions & 0 deletions packages/ckeditor5-alignment/src/alignmentediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export default class AlignmentEditing extends Plugin {
return 'AlignmentEditing' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-alignment/src/alignmentui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export default class AlignmentUI extends Plugin {
return 'AlignmentUI' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-alignment/tests/alignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ describe( 'Alignment', () => {
it( 'requires AlignmentEditing and AlignmentUI', () => {
expect( Alignment.requires ).to.deep.equal( [ AlignmentEditing, AlignmentUI ] );
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( Alignment.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( Alignment.isPremiumPlugin ).to.be.false;
} );
} );
8 changes: 8 additions & 0 deletions packages/ckeditor5-alignment/tests/alignmentediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ describe( 'AlignmentEditing', () => {
await editor.destroy();
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( AlignmentEditing.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( AlignmentEditing.isPremiumPlugin ).to.be.false;
} );

it( 'should have pluginName', () => {
expect( AlignmentEditing.pluginName ).to.equal( 'AlignmentEditing' );
} );
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-alignment/tests/alignmentui.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ describe( 'Alignment UI', () => {
return editor.destroy();
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( AlignmentUI.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( AlignmentUI.isPremiumPlugin ).to.be.false;
} );

describe( 'localizedOptionTitles()', () => {
it( 'should return localized titles of options', () => {
const editorMock = { t: str => str };
Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-autoformat/src/autoformat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export default class Autoformat extends Plugin {
return 'Autoformat' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-autoformat/tests/autoformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ describe( 'Autoformat', () => {
expect( Autoformat.pluginName ).to.equal( 'Autoformat' );
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( Autoformat.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( Autoformat.isPremiumPlugin ).to.be.false;
} );

it( 'should add keystroke accessibility info', () => {
expect( editor.accessibility.keystrokeInfos.get( 'contentEditing' ).groups.get( 'common' ).keystrokes ).to.deep.include( {
label: 'Revert autoformatting action',
Expand Down
7 changes: 7 additions & 0 deletions packages/ckeditor5-autosave/src/autosave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ export default class Autosave extends Plugin {
return 'Autosave' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
Expand Down
8 changes: 8 additions & 0 deletions packages/ckeditor5-autosave/tests/autosave.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ describe( 'Autosave', () => {
sinon.restore();
} );

it( 'should have `isOfficialPlugin` static flag set to `true`', () => {
expect( Autosave.isOfficialPlugin ).to.be.true;
} );

it( 'should have `isPremiumPlugin` static flag set to `false`', () => {
expect( Autosave.isPremiumPlugin ).to.be.false;
} );

it( 'should have static pluginName property', () => {
expect( Autosave.pluginName ).to.equal( 'Autosave' );
} );
Expand Down
Loading

0 comments on commit 8a56943

Please sign in to comment.