Skip to content

Commit 162ecf8

Browse files
INT-3361: Update dependencies (#432)
* INT-3361: Update dependencies * Replace .eslint.json with eslint.config.mjs * Fix lint errors * Fix eslint config per coderabbit comment * Fix failing tests due to race conditions * Use mcagar Assertions * Revert returning editor instance on init
1 parent 8dc94ba commit 162ecf8

File tree

13 files changed

+3340
-2605
lines changed

13 files changed

+3340
-2605
lines changed

.eslintrc.json

Lines changed: 0 additions & 68 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// eslint.config.js
2+
import { defineConfig } from 'eslint/config';
3+
import tinymceEslintPlugin from '@tinymce/eslint-plugin';
4+
import js from '@eslint/js';
5+
6+
import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
7+
8+
export default defineConfig([
9+
{
10+
plugins: {
11+
'@tinymce': tinymceEslintPlugin
12+
},
13+
extends: [ '@tinymce/standard' ],
14+
files: [
15+
'tinymce-angular-component/src/**/*.ts',
16+
'stories/**/*.ts'
17+
],
18+
ignores: [
19+
'src/demo/demo.ts'
20+
],
21+
languageOptions: {
22+
parserOptions: {
23+
sourceType: 'module',
24+
project: [
25+
'./tsconfig.json'
26+
]
27+
},
28+
},
29+
rules: {
30+
'@tinymce/prefer-fun': 'off',
31+
'no-underscore-dangle': 'off',
32+
'@typescript-eslint/member-ordering': 'off',
33+
}
34+
},
35+
{
36+
files: [
37+
'**/*.js'
38+
],
39+
env: {
40+
es6: true,
41+
node: true,
42+
browser: true
43+
},
44+
plugins: { js },
45+
extends: [ 'js/recommended' ],
46+
parser: 'espree',
47+
languageOptions: {
48+
parserOptions: {
49+
ecmaVersion: 2020,
50+
sourceType: 'module'
51+
},
52+
},
53+
rules: {
54+
'indent': [ 'error', 2, { 'SwitchCase': 1 } ],
55+
'no-shadow': 'error',
56+
'no-unused-vars': [ 'error', { 'argsIgnorePattern': '^_' } ],
57+
'object-curly-spacing': [ 'error', 'always', { 'arraysInObjects': false, 'objectsInObjects': false } ],
58+
'quotes': [ 'error', 'single' ],
59+
'semi': 'error'
60+
}
61+
},
62+
{
63+
files: [
64+
'**/*Test.ts',
65+
'**/test/**/*.ts'
66+
],
67+
plugins: {
68+
'chai-friendly': pluginChaiFriendly
69+
},
70+
rules: {
71+
'no-unused-expressions': 'off',
72+
'no-console': 'off',
73+
'max-classes-per-file': 'off',
74+
'@typescript-eslint/no-non-null-assertion': 'off'
75+
}
76+
}
77+
]);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@storybook/blocks": "^8.2.5",
4242
"@storybook/test": "^8.2.5",
4343
"@tinymce/beehive-flow": "^0.19.0",
44-
"@tinymce/eslint-plugin": "^2.3.1",
44+
"@tinymce/eslint-plugin": "^3.0.0",
4545
"@tinymce/miniature": "^6.0.0",
4646
"@types/chai": "^4.3.16",
4747
"@types/node": "^20.14.12",

stories/form-control/FormControl.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { Component } from '@angular/core';
32
import { FormBuilder, FormControl } from '@angular/forms';
43
import { apiKey } from 'stories/Settings';
@@ -11,9 +10,10 @@ export class FormControlComponent {
1110
public apiKey = apiKey;
1211
public formControl: FormControl<string | null>;
1312

14-
// eslint-disable-next-line @typescript-eslint/no-parameter-properties
13+
// eslint-disable-next-line @typescript-eslint/parameter-properties
1514
public constructor(private readonly formBuilder: FormBuilder) {
1615
this.formControl = this.formBuilder.control<string | null>(null);
16+
// eslint-disable-next-line no-console
1717
this.formControl.valueChanges.subscribe(console.log);
1818
this.formControl.setValue('<p>Initial value</p>');
1919
// Console log should be triggered just once

stories/form-with-on-push/form-with-on-push.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable @typescript-eslint/unbound-method */
2-
/* eslint-disable @typescript-eslint/no-parameter-properties */
32
import {
43
Component,
54
ChangeDetectionStrategy,

stories/pipes/Safe.pipe.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
55
name: 'safe'
66
})
77
export class SafePipe implements PipeTransform {
8-
// eslint-disable-next-line @typescript-eslint/no-parameter-properties
8+
9+
// eslint-disable-next-line @typescript-eslint/parameter-properties
910
public constructor(protected sanitizer: DomSanitizer) {}
1011

1112
public transform(value: string, type: string): SafeHtml {

tinymce-angular-component/src/main/ts/editor/editor.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-parameter-properties */
1+
/* eslint-disable @typescript-eslint/parameter-properties */
22
import { isPlatformBrowser, CommonModule } from '@angular/common';
33
import {
44
AfterViewInit,
@@ -114,7 +114,7 @@ export class EditorComponent extends Events implements AfterViewInit, ControlVal
114114
elementRef: ElementRef,
115115
ngZone: NgZone,
116116
private cdRef: ChangeDetectorRef,
117-
@Inject(PLATFORM_ID) private platformId: Object,
117+
@Inject(PLATFORM_ID) private platformId: object,
118118
@Optional() @Inject(TINYMCE_SCRIPT_SRC) private tinymceScriptSrc?: string
119119
) {
120120
super();

tinymce-angular-component/src/main/ts/utils/Utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ const normalizePluginArray = (plugins?: string | string[]): string[] => {
8282
const mergePlugins = (initPlugins: string | string[], inputPlugins?: string | string[]) =>
8383
normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
8484

85-
// eslint-disable-next-line @typescript-eslint/no-empty-function
8685
const noop: (...args: any[]) => void = () => { };
8786

8887
const isNullOrUndefined = (value: any): value is null | undefined => value === null || value === undefined;

tinymce-angular-component/src/test/ts/alien/TestHooks.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export interface EditorFixture<T> extends ComponentFixture<T> {
3535

3636
export type CreateEditorFixture<T> = (
3737
props?: Partial<
38-
Omit<
39-
EditorComponent,
40-
`${'on' | 'ng' | 'register' | 'set' | 'write'}${string}` | 'createElement' | 'initialise' | 'editor'
41-
>
38+
Omit<
39+
EditorComponent,
40+
`${'on' | 'ng' | 'register' | 'set' | 'write'}${string}` | 'createElement' | 'initialise' | 'editor'
41+
>
4242
>
4343
) => Promise<EditorFixture<T>>;
4444

@@ -77,7 +77,7 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
7777
if (editor.initialized) {
7878
resolve(editor);
7979
}
80-
editor.once('SkinLoaded', () => resolve(editor));
80+
editor.once( 'SkinLoaded', () => resolve(editor));
8181
})
8282
),
8383
map(

tinymce-angular-component/src/test/ts/browser/LoadTinyTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { EditorComponent, TINYMCE_SCRIPT_SRC } from '../../../main/ts/public_api
88
import { Version } from '../../../main/ts/editor/editor.component';
99
import { editorHook, tinymceVersionHook } from '../alien/TestHooks';
1010
import type { Editor } from 'tinymce';
11-
import { deleteTinymce } from '../alien/TestHelpers';
11+
import { apiKey, deleteTinymce } from '../alien/TestHelpers';
1212

1313
describe('LoadTinyTest', () => {
14+
const key = apiKey();
1415
const assertTinymceVersion = (version: Version, editor: Editor) => {
1516
Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, editor.editorManager.majorVersion);
1617
Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, Global.tinymce.majorVersion);
@@ -53,12 +54,11 @@ describe('LoadTinyTest', () => {
5354
before(deleteTinymce);
5455

5556
it(`Should be able to load TinyMCE ${version} from Cloud`, async () => {
56-
const apiKey = 'fake-api-key';
57-
const { editor } = await createFixture({ cloudChannel: version, apiKey });
57+
const { editor } = await createFixture({ cloudChannel: version, apiKey: key });
5858
assertTinymceVersion(version, editor);
5959
Assertions.assertEq(
6060
'TinyMCE should have been loaded from Cloud',
61-
`https://cdn.tiny.cloud/1/${apiKey}/tinymce/${version}`,
61+
`https://cdn.tiny.cloud/1/${key}/tinymce/${version}`,
6262
Global.tinymce.baseURI.source
6363
);
6464
});

0 commit comments

Comments
 (0)