From 6f2bbcbe193ad7c0b51ef478e4b3a21a1f34473d Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 13:57:48 +1030 Subject: [PATCH 01/14] INT-3401: Notify smoke test results --- Jenkinsfile-SmokeTest | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index b5677c09..1a5dcc33 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -114,6 +114,26 @@ def runSmokeTests(Map args = new LinkedHashMap()) { parallel processes } +def getMessage(boolean success, String name, String branch, String status, String url) { + return success ? "${name} [`${branch}`] is back in the <${url}|green>! :greendot:" : + ":warning: ${name} [`${branch}`] build regression to [${status}]: ${url}" +} + +def notify(Map slackArgs) { + // In shared libraries, the `call` method is not in the pipeline CPS context. We need to call the `steps` object to safely call jenkins steps + steps.retry(3) { + return steps.slackSend([ username: 'TinyMCE Angular Smoke Test', failOnError: true ] + slackArgs) + } +} + +def notifyOnFailure(String message) { + notify( + channel: '#tinymce-integration-dev', + color: 'danger', + message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" + ) +} + timestamps { tinyPods.node() { stage('deps') { @@ -125,7 +145,13 @@ timestamps { } stage('tests') { - runSmokeTests(npm_tag: params.NPM_TAG ?: 'latest') + try { + error("Please ensure that the NPM_TAG parameter is set to a valid npm tag (e.g. 'latest' or 'next') before running the pipeline.") + runSmokeTests(npm_tag: params.NPM_TAG ?: 'latest') + } catch (Exception e) { + echo "Error running smoke tests: ${e}" + notifyOnFailure("TinyMCE Angular - Smoke Tests failed with error: ${e}") + } } } } From 44f0f5261f4d4b2651aac76fd8d823630d4862d5 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 14:01:49 +1030 Subject: [PATCH 02/14] Correct the channel name --- Jenkinsfile-SmokeTest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 1a5dcc33..109ebf34 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -128,7 +128,7 @@ def notify(Map slackArgs) { def notifyOnFailure(String message) { notify( - channel: '#tinymce-integration-dev', + channel: '#tinymce-integrations-dev', color: 'danger', message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" ) From b4f495d47aa190d42166add372b6ea243eb99797 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 14:11:44 +1030 Subject: [PATCH 03/14] Still not correct --- Jenkinsfile-SmokeTest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 109ebf34..f408a145 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -128,7 +128,7 @@ def notify(Map slackArgs) { def notifyOnFailure(String message) { notify( - channel: '#tinymce-integrations-dev', + channel: '#tiny-integrations-dev', color: 'danger', message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" ) From 1f3c523b410e92a31fc8cd768cc906a00e3bd82a Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 15:42:15 +1030 Subject: [PATCH 04/14] Move changes --- Jenkinsfile-SmokeTest | 69 +++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index f408a145..0bba2a3d 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -16,40 +16,19 @@ properties([ // Generates a custom route file that contains the next version of Angular to test against def generateNPMVersionRouteFile(Map args = new LinkedHashMap()) { - // @angular/core's version is the one baked into the angular app - def nextVersion = sh(script: "npm view @angular/core@${args.npm_tag} version", returnStdout: true).trim() - - echo "Target framework version: ${nextVersion}" - - def routeFileContent = readJSON text: """ - [{ - "request": { - "method": "get", - "path": "/custom/integration/info" - }, - "response": { - "status": 200, - "json": { - "version": "${nextVersion}" - } - } - }] - """ - writeJSON file: "${args.filePath}", json: routeFileContent + writeJSON file: "${args.filePath}", json: args.routeFileContent } // Updates the Angular dependencies to the version specified by the npm tag def updateDependenciesWithTag(Map args = new LinkedHashMap()) { - String npm_tag = args.npm_tag - sh "yarn add @angular/core@${npm_tag} @angular/animations@${npm_tag} @angular/common@${npm_tag} @angular/compiler@${npm_tag} @angular/core@${npm_tag} @angular/forms@${npm_tag} @angular/platform-browser@${npm_tag} @angular-devkit/build-angular@${npm_tag} @angular/cli@${npm_tag} @angular/compiler-cli@${npm_tag}" + sh "yarn add @angular/core@${args.npmTag} @angular/animations@${args.npmTag} @angular/common@${args.npmTag} @angular/compiler@${args.npmTag} @angular/core@${args.npmTag} @angular/forms@${args.npmTag} @angular/platform-browser@${args.npmTag} @angular-devkit/build-angular@${args.npmTag} @angular/cli@${args.npmTag} @angular/compiler-cli@${args.npmTag}" } def runSmokeTests(Map args = new LinkedHashMap()) { def platforms = args.platforms ?: [ [ browser: "chrome", provider: "lambdatest" ] ] - String customRouteFilePath = "${WORKSPACE}/version.json" - String additionalArgs = "--chunk 20 --totalTimeout 1800000 --singleTimeout 90000 --retries 3 --customRoutes ${customRouteFilePath}" + String additionalArgs = "--chunk 20 --totalTimeout 1800000 --singleTimeout 90000 --retries 3 --customRoutes ${args.routeFilePath}" def processes = [:] @@ -77,8 +56,8 @@ def runSmokeTests(Map args = new LinkedHashMap()) { customArgs = customArgs + " --platformName \"${platform.os}\"" } - generateNPMVersionRouteFile(npm_tag: args.npm_tag, filePath: customRouteFilePath) - updateDependenciesWithTag(npm_tag: args.npm_tag) + generateNPMVersionRouteFile(content: args.routeContent, filePath: args.routeFilePath) + updateDependenciesWithTag(npmTag: args.npmTag) bedrockTests( name: name, browser: platform.browser, @@ -95,8 +74,8 @@ def runSmokeTests(Map args = new LinkedHashMap()) { def name = "headless-${platform.browser}${suffix}" processes[name] = { stage("${name}") { - generateNPMVersionRouteFile(npm_tag: args.npm_tag, filePath: customRouteFilePath) - updateDependenciesWithTag(npm_tag: args.npm_tag) + generateNPMVersionRouteFile(npmTag: args.npmTag, filePath: args.routeFile) + updateDependenciesWithTag(npmTag: args.npmTag) bedrockTests( name: name, browser: platform.browser, @@ -114,15 +93,10 @@ def runSmokeTests(Map args = new LinkedHashMap()) { parallel processes } -def getMessage(boolean success, String name, String branch, String status, String url) { - return success ? "${name} [`${branch}`] is back in the <${url}|green>! :greendot:" : - ":warning: ${name} [`${branch}`] build regression to [${status}]: ${url}" -} - def notify(Map slackArgs) { // In shared libraries, the `call` method is not in the pipeline CPS context. We need to call the `steps` object to safely call jenkins steps steps.retry(3) { - return steps.slackSend([ username: 'TinyMCE Angular Smoke Test', failOnError: true ] + slackArgs) + return steps.slackSend([ username: 'TinyMCE Integration Smoke Test', failOnError: true ] + slackArgs) } } @@ -145,12 +119,31 @@ timestamps { } stage('tests') { + String npmTag = params.NPM_TAG ?: 'latest' + // @angular/core's version is the one baked into the angular app + String nextVersion = sh(script: "npm view @angular/core@${npmTag} version", returnStdout: true).trim() + echo "The upcoming Angular version: ${nextVersion}" + + def customRouteContent = readJSON text: """ + [{ + "request": { + "method": "get", + "path": "/custom/integration/info" + }, + "response": { + "status": 200, + "json": { + "version": "${nextVersion}" + } + } + }] + """ + try { - error("Please ensure that the NPM_TAG parameter is set to a valid npm tag (e.g. 'latest' or 'next') before running the pipeline.") - runSmokeTests(npm_tag: params.NPM_TAG ?: 'latest') + runSmokeTests(npmTag: npmTag, routeContent: customRouteContent, routeFilePath: "${WORKSPACE}/version.json") } catch (Exception e) { - echo "Error running smoke tests: ${e}" - notifyOnFailure("TinyMCE Angular - Smoke Tests failed with error: ${e}") + notifyOnFailure("Failed with error: ${e}") + currentBuild.result = 'FAILURE' } } } From ca38cce1d9e67ffccf04b445dcf71de6d4de4c3d Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 15:46:35 +1030 Subject: [PATCH 05/14] Make test fail on purpose --- Jenkinsfile-SmokeTest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 0bba2a3d..878923b4 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -133,7 +133,7 @@ timestamps { "response": { "status": 200, "json": { - "version": "${nextVersion}" + "version": "${nextVersion} + smoke-test" } } }] From 42f4a9855b3a86d8979cdc239a9467f2862ee657 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 15:53:03 +1030 Subject: [PATCH 06/14] Fix missing content --- Jenkinsfile-SmokeTest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 878923b4..419acf58 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -16,7 +16,7 @@ properties([ // Generates a custom route file that contains the next version of Angular to test against def generateNPMVersionRouteFile(Map args = new LinkedHashMap()) { - writeJSON file: "${args.filePath}", json: args.routeFileContent + writeJSON file: "${args.filePath}", json: args.content } // Updates the Angular dependencies to the version specified by the npm tag @@ -74,7 +74,7 @@ def runSmokeTests(Map args = new LinkedHashMap()) { def name = "headless-${platform.browser}${suffix}" processes[name] = { stage("${name}") { - generateNPMVersionRouteFile(npmTag: args.npmTag, filePath: args.routeFile) + generateNPMVersionRouteFile(content: args.routeContent, filePath: args.routeFilePath) updateDependenciesWithTag(npmTag: args.npmTag) bedrockTests( name: name, From 4bdd160a74f9c8f4490bee2ea0d578ac65dff437 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Fri, 20 Feb 2026 16:21:38 +1030 Subject: [PATCH 07/14] Should notify when test has failed --- Jenkinsfile-SmokeTest | 19 ++++++----- eslint.config.mjs | 77 ------------------------------------------- 2 files changed, 11 insertions(+), 85 deletions(-) delete mode 100644 eslint.config.mjs diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 419acf58..5b05508c 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -100,13 +100,6 @@ def notify(Map slackArgs) { } } -def notifyOnFailure(String message) { - notify( - channel: '#tiny-integrations-dev', - color: 'danger', - message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" - ) -} timestamps { tinyPods.node() { @@ -142,8 +135,18 @@ timestamps { try { runSmokeTests(npmTag: npmTag, routeContent: customRouteContent, routeFilePath: "${WORKSPACE}/version.json") } catch (Exception e) { - notifyOnFailure("Failed with error: ${e}") + echo "Exception was caught: ${e}" currentBuild.result = 'FAILURE' + } finally { + if (currentBuild.result != 'SUCCESS') { + def color = ['UNSTABLE': 'warning', 'FAILURE': 'danger'] + def message = currentBuild.result == 'UNSTABLE' ? 'Tests have failed' : 'Build has failed' + notify( + channel: '#tiny-integrations-dev', + color: color.get(currentBuild.result, '#808080'), + message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" + ) + } } } } diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 86796224..00000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,77 +0,0 @@ -// eslint.config.js -import { defineConfig } from 'eslint/config'; -import tinymceEslintPlugin from '@tinymce/eslint-plugin'; -import js from '@eslint/js'; - -import pluginChaiFriendly from 'eslint-plugin-chai-friendly'; - -export default defineConfig([ - { - plugins: { - '@tinymce': tinymceEslintPlugin - }, - extends: [ '@tinymce/standard' ], - files: [ - 'tinymce-angular-component/src/**/*.ts', - 'stories/**/*.ts' - ], - ignores: [ - 'src/demo/demo.ts' - ], - languageOptions: { - parserOptions: { - sourceType: 'module', - project: [ - './tsconfig.json' - ] - }, - }, - rules: { - '@tinymce/prefer-fun': 'off', - 'no-underscore-dangle': 'off', - '@typescript-eslint/member-ordering': 'off', - } - }, - { - files: [ - '**/*.js' - ], - env: { - es6: true, - node: true, - browser: true - }, - plugins: { js }, - extends: [ 'js/recommended' ], - parser: 'espree', - languageOptions: { - parserOptions: { - ecmaVersion: 2020, - sourceType: 'module' - }, - }, - rules: { - 'indent': [ 'error', 2, { 'SwitchCase': 1 } ], - 'no-shadow': 'error', - 'no-unused-vars': [ 'error', { 'argsIgnorePattern': '^_' } ], - 'object-curly-spacing': [ 'error', 'always', { 'arraysInObjects': false, 'objectsInObjects': false } ], - 'quotes': [ 'error', 'single' ], - 'semi': 'error' - } - }, - { - files: [ - '**/*Test.ts', - '**/test/**/*.ts' - ], - plugins: { - 'chai-friendly': pluginChaiFriendly - }, - rules: { - 'no-unused-expressions': 'off', - 'no-console': 'off', - 'max-classes-per-file': 'off', - '@typescript-eslint/no-non-null-assertion': 'off' - } - } -]); From 222f3f56f408adb641f389a4fc731c0ebb59449f Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 10:56:06 +1030 Subject: [PATCH 08/14] Reduce passing routeFilePath as args --- Jenkinsfile-SmokeTest | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 5b05508c..60aec397 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -28,7 +28,8 @@ def runSmokeTests(Map args = new LinkedHashMap()) { def platforms = args.platforms ?: [ [ browser: "chrome", provider: "lambdatest" ] ] - String additionalArgs = "--chunk 20 --totalTimeout 1800000 --singleTimeout 90000 --retries 3 --customRoutes ${args.routeFilePath}" + String routeFilePath = "${WORKSPACE}/customRoutes.json" + String additionalArgs = "--chunk 20 --totalTimeout 1800000 --singleTimeout 90000 --retries 3 --customRoutes ${routeFilePath}" def processes = [:] @@ -56,7 +57,7 @@ def runSmokeTests(Map args = new LinkedHashMap()) { customArgs = customArgs + " --platformName \"${platform.os}\"" } - generateNPMVersionRouteFile(content: args.routeContent, filePath: args.routeFilePath) + generateNPMVersionRouteFile(content: args.routeContent, filePath: routeFilePath) updateDependenciesWithTag(npmTag: args.npmTag) bedrockTests( name: name, @@ -74,7 +75,7 @@ def runSmokeTests(Map args = new LinkedHashMap()) { def name = "headless-${platform.browser}${suffix}" processes[name] = { stage("${name}") { - generateNPMVersionRouteFile(content: args.routeContent, filePath: args.routeFilePath) + generateNPMVersionRouteFile(content: args.routeContent, filePath: routeFilePath) updateDependenciesWithTag(npmTag: args.npmTag) bedrockTests( name: name, @@ -126,14 +127,14 @@ timestamps { "response": { "status": 200, "json": { - "version": "${nextVersion} + smoke-test" + "version": "${nextVersion}" } } }] """ try { - runSmokeTests(npmTag: npmTag, routeContent: customRouteContent, routeFilePath: "${WORKSPACE}/version.json") + runSmokeTests(npmTag: npmTag, routeContent: customRouteContent) } catch (Exception e) { echo "Exception was caught: ${e}" currentBuild.result = 'FAILURE' From 53a26fa278fffa2192e2d7bb5d04ac27e0a2eab6 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 11:49:31 +1030 Subject: [PATCH 09/14] Change error message --- Jenkinsfile-SmokeTest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 60aec397..9242a1c0 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -127,7 +127,7 @@ timestamps { "response": { "status": 200, "json": { - "version": "${nextVersion}" + "version": "${nextVersion} + smoke_test" } } }] @@ -141,7 +141,7 @@ timestamps { } finally { if (currentBuild.result != 'SUCCESS') { def color = ['UNSTABLE': 'warning', 'FAILURE': 'danger'] - def message = currentBuild.result == 'UNSTABLE' ? 'Tests have failed' : 'Build has failed' + def message = currentBuild.result == 'UNSTABLE' ? 'Tests have failed' : 'An unexpected error has occurred' notify( channel: '#tiny-integrations-dev', color: color.get(currentBuild.result, '#808080'), From b8c714ef9e8f945bee73ff1e4bb5dc93e4f3f56a Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 12:07:08 +1030 Subject: [PATCH 10/14] Change the slack message --- Jenkinsfile-SmokeTest | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 9242a1c0..d3b80ff3 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -141,11 +141,12 @@ timestamps { } finally { if (currentBuild.result != 'SUCCESS') { def color = ['UNSTABLE': 'warning', 'FAILURE': 'danger'] - def message = currentBuild.result == 'UNSTABLE' ? 'Tests have failed' : 'An unexpected error has occurred' + def message = currentBuild.result == 'UNSTABLE' ? "Tests failed" : 'An unexpected error occurred while running tests' + notify( channel: '#tiny-integrations-dev', color: color.get(currentBuild.result, '#808080'), - message: "Build ${env.JOB_NAME} #${env.BUILD_NUMBER} failed: ${message} (<${env.BUILD_URL}|Open>)" + message: "${env.JOB_NAME} against ${nextVersion} failed: ${message} (<${env.BUILD_URL}|Open>)" ) } } From 60846c6802e0b9f425ccfbbd7c5dfb5644c713b1 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 12:14:55 +1030 Subject: [PATCH 11/14] Remove test data --- Jenkinsfile-SmokeTest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index d3b80ff3..f42db178 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -127,7 +127,7 @@ timestamps { "response": { "status": 200, "json": { - "version": "${nextVersion} + smoke_test" + "version": "${nextVersion}" } } }] From 177e111ed3cd06def405d884c56f779befc57795 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 13:42:14 +1030 Subject: [PATCH 12/14] Check current build status --- Jenkinsfile-SmokeTest | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index f42db178..49e9f1fa 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -139,6 +139,7 @@ timestamps { echo "Exception was caught: ${e}" currentBuild.result = 'FAILURE' } finally { + echo "Current build result: ${currentBuild.result}" if (currentBuild.result != 'SUCCESS') { def color = ['UNSTABLE': 'warning', 'FAILURE': 'danger'] def message = currentBuild.result == 'UNSTABLE' ? "Tests failed" : 'An unexpected error occurred while running tests' From 211d9ee629e0f0b3106b93bd35582f9640b9878a Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Mon, 23 Feb 2026 13:57:02 +1030 Subject: [PATCH 13/14] Fix notification being sent on success --- Jenkinsfile-SmokeTest | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile-SmokeTest b/Jenkinsfile-SmokeTest index 49e9f1fa..3b85065a 100644 --- a/Jenkinsfile-SmokeTest +++ b/Jenkinsfile-SmokeTest @@ -139,8 +139,7 @@ timestamps { echo "Exception was caught: ${e}" currentBuild.result = 'FAILURE' } finally { - echo "Current build result: ${currentBuild.result}" - if (currentBuild.result != 'SUCCESS') { + if (currentBuild.resultIsWorseOrEqualTo('UNSTABLE')) { def color = ['UNSTABLE': 'warning', 'FAILURE': 'danger'] def message = currentBuild.result == 'UNSTABLE' ? "Tests failed" : 'An unexpected error occurred while running tests' From c1642fa13da315eb2ca43c9577cdb206c2dd0e95 Mon Sep 17 00:00:00 2001 From: Ben Tran Date: Wed, 25 Feb 2026 09:00:38 +1030 Subject: [PATCH 14/14] Restore eslint --- eslint.config.mjs | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 eslint.config.mjs diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..86796224 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,77 @@ +// eslint.config.js +import { defineConfig } from 'eslint/config'; +import tinymceEslintPlugin from '@tinymce/eslint-plugin'; +import js from '@eslint/js'; + +import pluginChaiFriendly from 'eslint-plugin-chai-friendly'; + +export default defineConfig([ + { + plugins: { + '@tinymce': tinymceEslintPlugin + }, + extends: [ '@tinymce/standard' ], + files: [ + 'tinymce-angular-component/src/**/*.ts', + 'stories/**/*.ts' + ], + ignores: [ + 'src/demo/demo.ts' + ], + languageOptions: { + parserOptions: { + sourceType: 'module', + project: [ + './tsconfig.json' + ] + }, + }, + rules: { + '@tinymce/prefer-fun': 'off', + 'no-underscore-dangle': 'off', + '@typescript-eslint/member-ordering': 'off', + } + }, + { + files: [ + '**/*.js' + ], + env: { + es6: true, + node: true, + browser: true + }, + plugins: { js }, + extends: [ 'js/recommended' ], + parser: 'espree', + languageOptions: { + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module' + }, + }, + rules: { + 'indent': [ 'error', 2, { 'SwitchCase': 1 } ], + 'no-shadow': 'error', + 'no-unused-vars': [ 'error', { 'argsIgnorePattern': '^_' } ], + 'object-curly-spacing': [ 'error', 'always', { 'arraysInObjects': false, 'objectsInObjects': false } ], + 'quotes': [ 'error', 'single' ], + 'semi': 'error' + } + }, + { + files: [ + '**/*Test.ts', + '**/test/**/*.ts' + ], + plugins: { + 'chai-friendly': pluginChaiFriendly + }, + rules: { + 'no-unused-expressions': 'off', + 'no-console': 'off', + 'max-classes-per-file': 'off', + '@typescript-eslint/no-non-null-assertion': 'off' + } + } +]);