diff --git a/bin/stencil b/bin/stencil index c8abfe86681..5370db38ea5 100755 --- a/bin/stencil +++ b/bin/stencil @@ -18,14 +18,14 @@ if (isNodeLT(minimumVersion)) { currentVersion + ', however Stencil requires v' + minimumVersion + - '.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n' + '.0 or greater. It is recommended to use an Active LTS version of Node (https://nodejs.org/en/about/releases/).\n', ); process.exit(1); } if (isNodeLT(futureDeprecationMinVersion)) { console.warn( - '\nIn an upcoming major release of Stencil, Node v' + recommendedVersion + '.0 or higher will be required.\n' + '\nIn an upcoming major release of Stencil, Node v' + recommendedVersion + '.0 or higher will be required.\n', ); } else if (isNodeLT(recommendedVersion)) { console.warn( @@ -33,7 +33,7 @@ if (isNodeLT(futureDeprecationMinVersion)) { currentVersion + ", however Stencil's recommendation is v" + recommendedVersion + - '.0 or greater. Note that future versions of Stencil will eventually remove support for older Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n' + '.0 or greater. Note that future versions of Stencil will eventually remove support for older Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n', ); } diff --git a/package-lock.json b/package-lock.json index f0d1a82b51f..42accef256a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "stencil": "bin/stencil" }, "devDependencies": { - "@ionic/prettier-config": "^3.1.0", + "@ionic/prettier-config": "^4.0.0", "@rollup/plugin-commonjs": "15.1.0", "@rollup/plugin-json": "6.0.0", "@rollup/plugin-node-resolve": "9.0.0", @@ -848,9 +848,9 @@ } }, "node_modules/@ionic/prettier-config": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@ionic/prettier-config/-/prettier-config-3.1.0.tgz", - "integrity": "sha512-5cQ9qy9G0JDcIfUSP03EyX9ReEHK0mD34anvc2eCNpcca8GbY/wB0QS125FBkmV2DhDc5BvQSSM6VWZSGkxDJQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@ionic/prettier-config/-/prettier-config-4.0.0.tgz", + "integrity": "sha512-0DqL6CggVdgeJAWOLPUT73rF1VD5p0tVlCpC5GXz5vTIUBxNwsJ5085Q7wXjKiE5Odx3aOHGTcuRWCawFsLFag==", "dev": true, "peerDependencies": { "prettier": "^2.4.0 || ^3.0.0" @@ -10762,9 +10762,9 @@ "dev": true }, "@ionic/prettier-config": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@ionic/prettier-config/-/prettier-config-3.1.0.tgz", - "integrity": "sha512-5cQ9qy9G0JDcIfUSP03EyX9ReEHK0mD34anvc2eCNpcca8GbY/wB0QS125FBkmV2DhDc5BvQSSM6VWZSGkxDJQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@ionic/prettier-config/-/prettier-config-4.0.0.tgz", + "integrity": "sha512-0DqL6CggVdgeJAWOLPUT73rF1VD5p0tVlCpC5GXz5vTIUBxNwsJ5085Q7wXjKiE5Odx3aOHGTcuRWCawFsLFag==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 31fbb972983..c1d56435596 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "tsc.watch": "tsc --incremental --watch" }, "devDependencies": { - "@ionic/prettier-config": "^3.1.0", + "@ionic/prettier-config": "^4.0.0", "@rollup/plugin-commonjs": "15.1.0", "@rollup/plugin-json": "6.0.0", "@rollup/plugin-node-resolve": "9.0.0", diff --git a/scripts/build.ts b/scripts/build.ts index 7aa3def7f2a..977dd104c39 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -90,11 +90,11 @@ export async function bundleBuild(opts: BuildOptions): Promise { await Promise.all( rollupOption.output.map(async (output) => { await bundle.write(output); - }) + }), ); } else { await bundle.write(rollupOption.output); } - }) + }), ); } diff --git a/scripts/bundles/dev-server.ts b/scripts/bundles/dev-server.ts index e4e52e010db..c48d8668e8d 100644 --- a/scripts/bundles/dev-server.ts +++ b/scripts/bundles/dev-server.ts @@ -36,7 +36,7 @@ export async function devServer(opts: BuildOptions) { // copy server-worker-thread.js await fs.copy( join(opts.srcDir, 'dev-server', 'server-worker-thread.js'), - join(opts.output.devServerDir, 'server-worker-thread.js') + join(opts.output.devServerDir, 'server-worker-thread.js'), ); // copy template files diff --git a/scripts/bundles/helpers/lazy-require.js b/scripts/bundles/helpers/lazy-require.js index b97a87a69bf..7b87d85270c 100644 --- a/scripts/bundles/helpers/lazy-require.js +++ b/scripts/bundles/helpers/lazy-require.js @@ -11,6 +11,6 @@ function _lazyRequire(moduleId) { const importedModule = require(moduleId); return Reflect.set(importedModule, propertyKey, value); }, - } + }, ); } diff --git a/scripts/bundles/internal-platform-client.ts b/scripts/bundles/internal-platform-client.ts index 1cccebbda59..6c736037964 100644 --- a/scripts/bundles/internal-platform-client.ts +++ b/scripts/bundles/internal-platform-client.ts @@ -114,6 +114,6 @@ async function copyPolyfills(opts: BuildOptions, outputInternalClientPolyfillsDi const src = join(srcPolyfillsDir, fileName); const dest = join(outputInternalClientPolyfillsDir, fileName); await fs.copyFile(src, dest); - }) + }), ); } diff --git a/scripts/bundles/mock-doc.ts b/scripts/bundles/mock-doc.ts index 08b3eadd2f8..ba7089cecd0 100644 --- a/scripts/bundles/mock-doc.ts +++ b/scripts/bundles/mock-doc.ts @@ -86,7 +86,7 @@ async function bundleMockDocDts(inputDir: string, outputDir: string) { const output = await Promise.all( srcDtsFiles.map((inputDtsFile) => { return getDtsContent(inputDir, inputDtsFile); - }) + }), ); const srcIndexDts = await fs.readFile(join(inputDir, 'index.d.ts'), 'utf8'); diff --git a/scripts/bundles/plugins/pretty-minify.ts b/scripts/bundles/plugins/pretty-minify.ts index 1898cc4faa1..f6122eb4a01 100644 --- a/scripts/bundles/plugins/pretty-minify.ts +++ b/scripts/bundles/plugins/pretty-minify.ts @@ -28,7 +28,7 @@ export function prettyMinifyPlugin(opts: BuildOptions, preamble?: string): Plugi }); b.code = minifyResults.code; } - }) + }), ); }, }; diff --git a/scripts/release-tasks.ts b/scripts/release-tasks.ts index a3f6cf75518..06bca67505d 100644 --- a/scripts/release-tasks.ts +++ b/scripts/release-tasks.ts @@ -51,7 +51,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray { if (!pkg.private && isPrereleaseVersion(newVersion) && !opts.tag) { throw new Error( - 'You must specify a dist-tag using --tag when publishing a pre-release version. This prevents accidentally tagging unstable versions as "latest". https://docs.npmjs.com/cli/dist-tag' + 'You must specify a dist-tag using --tag when publishing a pre-release version. This prevents accidentally tagging unstable versions as "latest". https://docs.npmjs.com/cli/dist-tag', ); } }, @@ -67,7 +67,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray execa('npm', ['config', 'get', 'tag-version-prefix'])) .then( ({ stdout }) => (tagPrefix = stdout), - () => {} + () => {}, ) // verify that a tag for the new version string does not already exist by checking the output of // `git rev-parse --verify` @@ -84,7 +84,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray isDryRun, }, @@ -117,7 +117,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray isDryRun, - } + }, ); if (!opts.isPublishRelease) { @@ -162,7 +162,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray { return updateChangeLog(opts); }, - } + }, ); } @@ -224,7 +224,7 @@ export async function runReleaseTasks(opts: BuildOptions, args: ReadonlyArray): const pkg = opts.packageJson; const oldVersion = opts.packageJson.version; console.log( - `\nPrepare to publish ${opts.vermoji} ${color.bold.magenta(pkg.name)} ${color.dim(`(currently ${oldVersion})`)}\n` + `\nPrepare to publish ${opts.vermoji} ${color.bold.magenta(pkg.name)} ${color.dim(`(currently ${oldVersion})`)}\n`, ); try { @@ -90,7 +90,7 @@ async function publishRelease(opts: BuildOptions, args: ReadonlyArray): const pkg = opts.packageJson; if (opts.version !== pkg.version) { throw new Error( - `Prepare release data (${opts.version}) and package.json (${pkg.version}) versions do not match. Try re-running release prepare.` + `Prepare release data (${opts.version}) and package.json (${pkg.version}) versions do not match. Try re-running release prepare.`, ); } diff --git a/scripts/tech-debt-burndown-report.ts b/scripts/tech-debt-burndown-report.ts index 93359d54a45..7658f36295a 100644 --- a/scripts/tech-debt-burndown-report.ts +++ b/scripts/tech-debt-burndown-report.ts @@ -243,7 +243,7 @@ if (errorsOnPRCount === errorsOnMainCount) { lines.push(`That's ${errorsOnMainCount - errorsOnPRCount} fewer than on \`main\`! 🎉🎉🎉`); } else { lines.push( - `Unfortunately, it looks like that's an increase of ${errorsOnPRCount - errorsOnMainCount} over \`main\` 😞.` + `Unfortunately, it looks like that's an increase of ${errorsOnPRCount - errorsOnMainCount} over \`main\` 😞.`, ); const newEntries = prData.filter( (prTsError) => @@ -253,8 +253,8 @@ if (errorsOnPRCount === errorsOnMainCount) { prTsError.value.cursor.value.line === mainTsError.value.cursor.value.line && prTsError.value.cursor.value.col === mainTsError.value.cursor.value.col && prTsError.value.tsError.value.errorString === mainTsError.value.tsError.value.errorString && - prTsError.value.message.value === mainTsError.value.message.value - ) + prTsError.value.message.value === mainTsError.value.message.value, + ), ); lines.push( collapsible('Violations Not on `main` (may be more than the count above)', (out: string[]) => { @@ -269,11 +269,11 @@ if (errorsOnPRCount === errorsOnMainCount) { `${value.path.value}`, `(${location.line}, ${location.col})`, `${value.tsError.value.errorString}`, - `${sanitizedErrorMsg}` - ) + `${sanitizedErrorMsg}`, + ), ); }); - }) + }), ); lines.push(''); @@ -296,7 +296,7 @@ lines.push( .forEach(([path, errorCount]) => { out.push(tableRow(path, String(errorCount))); }); - }) + }), ); lines.push(''); @@ -310,8 +310,8 @@ lines.push( tableHeader( '[Typescript Error Code](https://github.com/microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json)', 'Count', - 'Error messages' - ) + 'Error messages', + ), ); sortEntries(errorCodeCounts).forEach(([tsErrorCode, errorCount]) => { @@ -324,11 +324,11 @@ lines.push( `
Error messages${[...messages] .map((msg) => msg.replace(/\n/g, '
')) .map((msg) => msg.replace(/\|/g, '\\|')) - .join('
')}
` - ) + .join('
')}`, + ), ); }); - }) + }), ); lines.push(''); @@ -350,7 +350,7 @@ if (deadCodeCountPR === deadCodeCountMain) { deadCodeLine.push(`That's ${deadCodeCountMain - deadCodeCountPR} fewer than on \`main\`! 🎉🎉🎉`); } else { deadCodeLine.push( - `Unfortunately, it looks like that's an increase of ${deadCodeCountPR - deadCodeCountMain} over \`main\` 😞.` + `Unfortunately, it looks like that's an increase of ${deadCodeCountPR - deadCodeCountMain} over \`main\` 😞.`, ); } lines.push(deadCodeLine.join('')); @@ -363,7 +363,7 @@ lines.push( deadCodePR.forEach((deadCode) => { out.push(tableRow(deadCode.fileName, deadCode.lineNumber, deadCode.identifier)); }); - }) + }), ); console.log(lines.join('\n')); diff --git a/scripts/test/release.spec.ts b/scripts/test/release.spec.ts index 217a11e9bf1..2cefe57c349 100644 --- a/scripts/test/release.spec.ts +++ b/scripts/test/release.spec.ts @@ -85,7 +85,7 @@ describe('release()', () => { packageJson: stubPackageData(), version: '0.0.1', }, - { spaces: 2 } + { spaces: 2 }, ); }); @@ -109,7 +109,7 @@ describe('release()', () => { packageJson: stubPackageData(), version: '0.0.1', }, - [prepareFlag] + [prepareFlag], ); }); }); @@ -200,7 +200,7 @@ describe('release()', () => { }); await expect(release(rootDir, [publishFlag])).rejects.toThrow( - 'Prepare release data (0.1.1) and package.json (0.1.0) versions do not match. Try re-running release prepare.' + 'Prepare release data (0.1.1) and package.json (0.1.0) versions do not match. Try re-running release prepare.', ); }); @@ -216,7 +216,7 @@ describe('release()', () => { tag: 'testing', version: '0.1.0', }, - [publishFlag] + [publishFlag], ); }); }); diff --git a/scripts/utils/test/options.spec.ts b/scripts/utils/test/options.spec.ts index 9b876b8530d..b31d9c025ba 100644 --- a/scripts/utils/test/options.spec.ts +++ b/scripts/utils/test/options.spec.ts @@ -106,7 +106,7 @@ describe('release options', () => { describe('publish + prod check', () => { it("throws an error if 'isPublishRelease' is set, but Stencil is not built for 'isProd'", () => { expect(() => getOptions(ROOT_DIR, { isProd: false, isPublishRelease: true })).toThrow( - 'release must also be a prod build' + 'release must also be a prod build', ); }); diff --git a/scripts/utils/test/release-utils.spec.ts b/scripts/utils/test/release-utils.spec.ts index b8299d33566..f0cd4b7f0c6 100644 --- a/scripts/utils/test/release-utils.spec.ts +++ b/scripts/utils/test/release-utils.spec.ts @@ -46,7 +46,7 @@ describe('release-utils', () => { expect(openMock).toHaveBeenCalledTimes(1); expect(openMock).toHaveBeenCalledWith( - 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=' + 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=', ); }); @@ -82,7 +82,7 @@ describe('release-utils', () => { expect(openMock).toHaveBeenCalledTimes(1); expect(openMock).toHaveBeenCalledWith( - 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Features%0A%0A*+**mock-doc%3A**+add+simple+MockEvent%23composedPath%28%29+impl+%28%5B%233204%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3204%29%29+%28%5B7b47d96%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F7b47d96e1e3c6c821d5c416fbe987646b4cd1551%29%29%0A*+**test%3A**+jest+27+support+%28%5B%233189%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3189%29%29+%28%5B10efeb6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F10efeb6f74888f05a13a47d8afc00b5e83a3f3db%29%29' + 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Features%0A%0A*+**mock-doc%3A**+add+simple+MockEvent%23composedPath%28%29+impl+%28%5B%233204%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3204%29%29+%28%5B7b47d96%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F7b47d96e1e3c6c821d5c416fbe987646b4cd1551%29%29%0A*+**test%3A**+jest+27+support+%28%5B%233189%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3189%29%29+%28%5B10efeb6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F10efeb6f74888f05a13a47d8afc00b5e83a3f3db%29%29', ); }); @@ -125,7 +125,7 @@ describe('release-utils', () => { expect(openMock).toHaveBeenCalledTimes(1); expect(openMock).toHaveBeenCalledWith( - 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Bug+Fixes%0A%0A*+**cli%3A**+wait+for+help+task+to+finish+before+exiting+%28%5B%233160%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3160%29%29+%28%5Bf10cee1%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Ff10cee12a8d00e7581fcf13216f01ded46227f49%29%29%0A*+**mock-doc%3A**+make+Node.contains%28%29+return+true+for+self+%28%5B%233150%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3150%29%29+%28%5Bf164407%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Ff164407f7463faba7a3c39afca942c2a26210b82%29%29%0A*+**mock-doc%3A**+allow+urls+as+css+values+%28%5B%232857%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F2857%29%29+%28%5B6faa5f2%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F6faa5f2f196ff786ffc4b818ac09708ba5de9b35%29%29%0A*+**sourcemaps%3A**+do+not+encode+inline+sourcemaps+%28%5B%233163%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3163%29%29+%28%5Bb2eb083%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Fb2eb083306802645ee6e31987917dea942882e46%29%29%2C+closes+%5B%233147%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3147%29%0A%0A%0A%23%23%23+Features%0A%0A*+**dist-custom-elements-bundle%3A**+add+deprecation+warning+%28%5B%233167%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3167%29%29+%28%5Bc7b07c6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Fc7b07c65265c7d4715f29835632cc6538ea63585%29%29' + 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Bug+Fixes%0A%0A*+**cli%3A**+wait+for+help+task+to+finish+before+exiting+%28%5B%233160%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3160%29%29+%28%5Bf10cee1%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Ff10cee12a8d00e7581fcf13216f01ded46227f49%29%29%0A*+**mock-doc%3A**+make+Node.contains%28%29+return+true+for+self+%28%5B%233150%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3150%29%29+%28%5Bf164407%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Ff164407f7463faba7a3c39afca942c2a26210b82%29%29%0A*+**mock-doc%3A**+allow+urls+as+css+values+%28%5B%232857%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F2857%29%29+%28%5B6faa5f2%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F6faa5f2f196ff786ffc4b818ac09708ba5de9b35%29%29%0A*+**sourcemaps%3A**+do+not+encode+inline+sourcemaps+%28%5B%233163%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3163%29%29+%28%5Bb2eb083%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Fb2eb083306802645ee6e31987917dea942882e46%29%29%2C+closes+%5B%233147%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3147%29%0A%0A%0A%23%23%23+Features%0A%0A*+**dist-custom-elements-bundle%3A**+add+deprecation+warning+%28%5B%233167%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3167%29%29+%28%5Bc7b07c6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2Fc7b07c65265c7d4715f29835632cc6538ea63585%29%29', ); }); @@ -161,7 +161,7 @@ describe('release-utils', () => { expect(openMock).toHaveBeenCalledTimes(1); expect(openMock).toHaveBeenCalledWith( - 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Features%0A%0A*+**mock-doc%3A**+add+simple+MockEvent%23composedPath%28%29+impl+%28%5B%233204%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3204%29%29+%28%5B7b47d96%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F7b47d96e1e3c6c821d5c416fbe987646b4cd1551%29%29%0A*+**test%3A**+jest+27+support+%28%5B%233189%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3189%29%29+%28%5B10efeb6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F10efeb6f74888f05a13a47d8afc00b5e83a3f3db%29%29' + 'https://github.com/ionic-team/stencil/releases/new?tag=v0.0.0&title=%F0%9F%9A%97+0.0.0+%282022-01-01%29&body=%23%23%23+Features%0A%0A*+**mock-doc%3A**+add+simple+MockEvent%23composedPath%28%29+impl+%28%5B%233204%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3204%29%29+%28%5B7b47d96%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F7b47d96e1e3c6c821d5c416fbe987646b4cd1551%29%29%0A*+**test%3A**+jest+27+support+%28%5B%233189%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fissues%2F3189%29%29+%28%5B10efeb6%5D%28https%3A%2F%2Fgithub.com%2Fionic-team%2Fstencil%2Fcommit%2F10efeb6f74888f05a13a47d8afc00b5e83a3f3db%29%29', ); }); }); diff --git a/src/cli/logs.ts b/src/cli/logs.ts index 86656661747..fadf4098ccc 100644 --- a/src/cli/logs.ts +++ b/src/cli/logs.ts @@ -63,7 +63,7 @@ export const loadedCompilerLog = ( sys: CompilerSystem, logger: Logger, flags: ConfigFlags, - coreCompiler: CoreCompiler + coreCompiler: CoreCompiler, ): void => { const sysDetails = sys.details; const runtimeInfo = `${sys.name} ${sys.version}`; @@ -73,7 +73,7 @@ export const loadedCompilerLog = ( : `Unknown Platform, Unknown CPU Model`; const statsInfo = sysDetails ? `cpus: ${sys.hardwareConcurrency}, freemem: ${Math.round( - sysDetails.freemem() / 1000000 + sysDetails.freemem() / 1000000, )}MB, totalmem: ${Math.round(sysDetails.totalmem / 1000000)}MB` : 'Unknown CPU Core Count, Unknown Memory'; @@ -111,15 +111,15 @@ export const startupCompilerLog = (coreCompiler: CoreCompiler, config: Validated if (isPrerelease && !isDevBuild) { logger.warn( logger.yellow( - `This is a prerelease build, undocumented changes might happen at any time. Technical support is not available for prereleases, but any assistance testing is appreciated.` - ) + `This is a prerelease build, undocumented changes might happen at any time. Technical support is not available for prereleases, but any assistance testing is appreciated.`, + ), ); } if (config.devMode && !isDebug) { if (config.buildEs5) { logger.warn( - `Generating ES5 during development is a very task expensive, initial and incremental builds will be much slower. Drop the '--es5' flag and use a modern browser for development.` + `Generating ES5 during development is a very task expensive, initial and incremental builds will be much slower. Drop the '--es5' flag and use a modern browser for development.`, ); } diff --git a/src/cli/run.ts b/src/cli/run.ts index 7c579be285a..39d4fd4de0f 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -114,7 +114,7 @@ export const runTask = async ( coreCompiler: CoreCompiler, config: d.Config, task: d.TaskCommand, - sys: d.CompilerSystem + sys: d.CompilerSystem, ): Promise => { const flags = createConfigFlags(config.flags ?? { task }); config.flags = flags; @@ -164,7 +164,7 @@ export const runTask = async ( default: strictConfig.logger.error( - `${strictConfig.logger.emoji('❌ ')}Invalid stencil command, please see the options below:` + `${strictConfig.logger.emoji('❌ ')}Invalid stencil command, please see the options below:`, ); await taskHelp(strictConfig.flags, strictConfig.logger, sys); return config.sys.exit(1); diff --git a/src/cli/task-build.ts b/src/cli/task-build.ts index 2603c4fec2d..01ed70fb7e5 100644 --- a/src/cli/task-build.ts +++ b/src/cli/task-build.ts @@ -36,7 +36,7 @@ export const taskBuild = async (coreCompiler: CoreCompiler, config: d.ValidatedC config, results.hydrateAppFilePath, results.componentGraph, - null + null, ); config.logger.printDiagnostics(prerenderDiagnostics); diff --git a/src/cli/task-generate.ts b/src/cli/task-generate.ts index f37dfea3186..66373795e89 100644 --- a/src/cli/task-generate.ts +++ b/src/cli/task-generate.ts @@ -64,8 +64,8 @@ export const taskGenerate = async (config: ValidatedConfig): Promise => { const writtenFiles = await Promise.all( filesToGenerate.map((file) => - getBoilerplateAndWriteFile(config, componentName, extensionsToGenerate.includes('css'), file) - ) + getBoilerplateAndWriteFile(config, componentName, extensionsToGenerate.includes('css'), file), + ), ).catch((error) => config.logger.error(error)); if (!writtenFiles) { @@ -138,7 +138,7 @@ const getBoilerplateAndWriteFile = async ( config: ValidatedConfig, componentName: string, withCss: boolean, - file: BoilerplateFile + file: BoilerplateFile, ): Promise => { const boilerplate = getBoilerplateByExtension(componentName, file.extension, withCss); await config.sys.writeFile(normalizePath(file.path), boilerplate); @@ -165,13 +165,13 @@ const checkForOverwrite = async (files: readonly BoilerplateFile[], config: Vali if ((await config.sys.readFile(path)) !== undefined) { alreadyPresent.push(path); } - }) + }), ); if (alreadyPresent.length > 0) { config.logger.error( 'Generating code would overwrite the following files:', - ...alreadyPresent.map((path) => '\t' + normalizePath(path)) + ...alreadyPresent.map((path) => '\t' + normalizePath(path)), ); await config.sys.exit(1); } diff --git a/src/cli/task-info.ts b/src/cli/task-info.ts index 091ece56fd0..8e5d6219e71 100644 --- a/src/cli/task-info.ts +++ b/src/cli/task-info.ts @@ -17,7 +17,7 @@ export const taskInfo = (coreCompiler: CoreCompiler, sys: CompilerSystem, logger console.log( `${logger.cyan(' CPU Model:')} ${details.cpuModel} (${sys.hardwareConcurrency} cpu${ sys.hardwareConcurrency !== 1 ? 's' : '' - })` + })`, ); console.log(`${logger.cyan(' Compiler:')} ${sys.getCompilerExecutingPath()}`); console.log(`${logger.cyan(' Build:')} ${coreCompiler.buildId}`); diff --git a/src/cli/task-prerender.ts b/src/cli/task-prerender.ts index 4aae29ecdfb..7ea76f57592 100644 --- a/src/cli/task-prerender.ts +++ b/src/cli/task-prerender.ts @@ -29,7 +29,7 @@ export const runPrerenderTask = async ( config: ValidatedConfig, hydrateAppFilePath: string, componentGraph: BuildResultsComponentGraph, - srcIndexHtmlPath: string + srcIndexHtmlPath: string, ) => { const diagnostics: Diagnostic[] = []; diff --git a/src/cli/task-telemetry.ts b/src/cli/task-telemetry.ts index 08671a43a44..66013881987 100644 --- a/src/cli/task-telemetry.ts +++ b/src/cli/task-telemetry.ts @@ -14,7 +14,7 @@ export const taskTelemetry = async (flags: ConfigFlags, sys: d.CompilerSystem, l const isEnabling = flags.args.includes('on'); const isDisabling = flags.args.includes('off'); const INFORMATION = `Opt in or out of telemetry. Information about the data we collect is available on our website: ${logger.bold( - 'https://stenciljs.com/telemetry' + 'https://stenciljs.com/telemetry', )}`; const THANK_YOU = `Thank you for helping to make Stencil better! 💖`; const ENABLED_MESSAGE = `${logger.green('Enabled')}. ${THANK_YOU}\n\n`; diff --git a/src/cli/task-test.ts b/src/cli/task-test.ts index aa32b3177a8..c10838f350b 100644 --- a/src/cli/task-test.ts +++ b/src/cli/task-test.ts @@ -28,8 +28,8 @@ export const taskTest = async (config: ValidatedConfig): Promise => { // ensure we've got pixelmatch for screenshots config.logger.warn( config.logger.yellow( - `EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.` - ) + `EXPERIMENTAL: screenshot visual diff testing is currently under heavy development and has not reached a stable status. However, any assistance testing would be appreciated.`, + ), ); } } diff --git a/src/cli/telemetry/helpers.ts b/src/cli/telemetry/helpers.ts index 18f1ddba508..b74733c036f 100644 --- a/src/cli/telemetry/helpers.ts +++ b/src/cli/telemetry/helpers.ts @@ -18,7 +18,7 @@ export const isInteractive = (sys: d.CompilerSystem, flags: ConfigFlags, object? tty: sys.isTTY() ? true : false, ci: ['CI', 'BUILD_ID', 'BUILD_NUMBER', 'BITBUCKET_COMMIT', 'CODEBUILD_BUILD_ARN'].filter( - (v) => !!sys.getEnvironmentVar?.(v) + (v) => !!sys.getEnvironmentVar?.(v), ).length > 0 || !!flags.ci, }); diff --git a/src/cli/telemetry/telemetry.ts b/src/cli/telemetry/telemetry.ts index 75e16f92714..d3b3639d814 100644 --- a/src/cli/telemetry/telemetry.ts +++ b/src/cli/telemetry/telemetry.ts @@ -18,7 +18,7 @@ export async function telemetryBuildFinishedAction( sys: d.CompilerSystem, config: d.ValidatedConfig, coreCompiler: CoreCompiler, - result: d.CompilerBuildResults + result: d.CompilerBuildResults, ) { const tracking = await shouldTrack(config, sys, !!config.flags.ci); @@ -48,7 +48,7 @@ export async function telemetryAction( sys: d.CompilerSystem, config: d.ValidatedConfig, coreCompiler: CoreCompiler, - action?: d.TelemetryCallback + action?: d.TelemetryCallback, ) { const tracking = await shouldTrack(config, sys, !!config.flags.ci); @@ -94,7 +94,7 @@ export async function telemetryAction( */ export function hasAppTarget(config: d.ValidatedConfig): boolean { return config.outputTargets.some( - (target) => target.type === WWW && (!!target.serviceWorker || (!!target.baseUrl && target.baseUrl !== '/')) + (target) => target.type === WWW && (!!target.serviceWorker || (!!target.baseUrl && target.baseUrl !== '/')), ); } @@ -130,7 +130,7 @@ export const prepareData = async ( config: d.ValidatedConfig, sys: d.CompilerSystem, duration_ms: number | undefined, - component_count: number | undefined = undefined + component_count: number | undefined = undefined, ): Promise => { const { typescript, rollup } = coreCompiler.versions || { typescript: 'unknown', rollup: 'unknown' }; const { packages, packagesNoVersions } = await getInstalledPackages(sys, config); @@ -241,7 +241,7 @@ export const anonymizeConfigForTelemetry = (config: d.ValidatedConfig): d.Config return value; } return 'omitted'; - }) + }), ); // this prop has to be handled separately because it is an array @@ -274,7 +274,7 @@ export const anonymizeConfigForTelemetry = (config: d.ValidatedConfig): d.Config */ async function getInstalledPackages( sys: d.CompilerSystem, - config: d.ValidatedConfig + config: d.ValidatedConfig, ): Promise<{ packages: string[]; packagesNoVersions: string[] }> { let packages: string[] = []; let packagesNoVersions: string[] = []; @@ -287,7 +287,7 @@ async function getInstalledPackages( const packageJson: d.PackageJsonData | null = await tryFn( readJson, sys, - sys.resolvePath(appRootDir + '/package.json') + sys.resolvePath(appRootDir + '/package.json'), ); // They don't have a package.json for some reason? Eject button. @@ -303,7 +303,7 @@ async function getInstalledPackages( // Collect packages only in the stencil, ionic, or capacitor org's: // https://www.npmjs.com/org/stencil const ionicPackages = rawPackages.filter( - ([k]) => k.startsWith('@stencil/') || k.startsWith('@ionic/') || k.startsWith('@capacitor/') + ([k]) => k.startsWith('@stencil/') || k.startsWith('@ionic/') || k.startsWith('@capacitor/'), ); try { @@ -380,7 +380,7 @@ export async function sendMetric( sys: d.CompilerSystem, config: d.ValidatedConfig, name: string, - value: d.TrackableData + value: d.TrackableData, ): Promise { const session_id = await getTelemetryToken(sys); diff --git a/src/cli/telemetry/test/telemetry.spec.ts b/src/cli/telemetry/test/telemetry.spec.ts index d4bccbc126f..bc51528ea26 100644 --- a/src/cli/telemetry/test/telemetry.spec.ts +++ b/src/cli/telemetry/test/telemetry.spec.ts @@ -27,7 +27,7 @@ describe('telemetryBuildFinishedAction', () => { spyShouldTrack.mockReturnValue( new Promise((resolve) => { resolve(true); - }) + }), ); const results = { @@ -60,7 +60,7 @@ describe('telemetryAction', () => { spyShouldTrack.mockReturnValue( new Promise((resolve) => { resolve(true); - }) + }), ); await telemetry.telemetryAction(sys, config, coreCompiler, () => {}); @@ -74,7 +74,7 @@ describe('telemetryAction', () => { spyShouldTrack.mockReturnValue( new Promise((resolve) => { resolve(true); - }) + }), ); await telemetry.telemetryAction(sys, config, coreCompiler, async () => { diff --git a/src/cli/test/run.spec.ts b/src/cli/test/run.spec.ts index 746bb6ba908..a657f99bcb4 100644 --- a/src/cli/test/run.spec.ts +++ b/src/cli/test/run.spec.ts @@ -42,7 +42,7 @@ describe('run', () => { // use the 'help' task as a reasonable default for all calls to this function. // code paths that require a different task can always override this value as needed. task: 'help', - }) + }), ); }); @@ -74,7 +74,7 @@ describe('run', () => { unknownArgs: [], }, mockLogger, - mockSystem + mockSystem, ); taskHelpSpy.mockRestore(); @@ -84,7 +84,7 @@ describe('run', () => { parseFlagsSpy.mockReturnValue( createConfigFlags({ task: null, - }) + }), ); await run(cliInitOptions); @@ -98,7 +98,7 @@ describe('run', () => { unknownArgs: [], }, mockLogger, - mockSystem + mockSystem, ); taskHelpSpy.mockRestore(); @@ -108,7 +108,7 @@ describe('run', () => { parseFlagsSpy.mockReturnValue( createConfigFlags({ help: true, - }) + }), ); await run(cliInitOptions); @@ -122,7 +122,7 @@ describe('run', () => { knownArgs: [], }, mockLogger, - mockSystem + mockSystem, ); taskHelpSpy.mockRestore(); diff --git a/src/cli/test/task-generate.spec.ts b/src/cli/test/task-generate.spec.ts index 520a071f02c..68817cd7b9e 100644 --- a/src/cli/test/task-generate.spec.ts +++ b/src/cli/test/task-generate.spec.ts @@ -65,7 +65,7 @@ describe('generate task', () => { await taskGenerate(config); expect(config.sys.exit).toHaveBeenCalledWith(1); expect(errorSpy).toHaveBeenCalledWith( - 'Please run this command in your root directory (i. e. the one containing stencil.config.ts).' + 'Please run this command in your root directory (i. e. the one containing stencil.config.ts).', ); }); @@ -99,7 +99,7 @@ describe('generate task', () => { await silentGenerate(config); expect(createDirSpy).toHaveBeenCalledWith( includeTests ? `${config.srcDir}/components/my-component/test` : `${config.srcDir}/components/my-component`, - { recursive: true } + { recursive: true }, ); }); @@ -117,7 +117,7 @@ describe('generate task', () => { userChoices.forEach((file) => { expect(writeFileSpy).toHaveBeenCalledWith( file.path, - getBoilerplateByExtension('my-component', file.extension, true) + getBoilerplateByExtension('my-component', file.extension, true), ); }); }); @@ -131,7 +131,7 @@ describe('generate task', () => { '\t/src/components/my-component/my-component.tsx', '\t/src/components/my-component/my-component.css', '\t/src/components/my-component/test/my-component.spec.tsx', - '\t/src/components/my-component/test/my-component.e2e.ts' + '\t/src/components/my-component/test/my-component.e2e.ts', ); expect(config.sys.exit).toHaveBeenCalledWith(1); }); diff --git a/src/client/client-load-module.ts b/src/client/client-load-module.ts index 0c6d10d5671..e568b14126c 100644 --- a/src/client/client-load-module.ts +++ b/src/client/client-load-module.ts @@ -8,14 +8,14 @@ export const cmpModules = /*@__PURE__*/ new Map | d.ComponentConstructor => { // loadModuleImport const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); const bundleId = cmpMeta.$lazyBundleId$; if (BUILD.isDev && typeof bundleId !== 'string') { consoleDevError( - `Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.` + `Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`, ); return undefined; } diff --git a/src/client/client-patch-browser.ts b/src/client/client-patch-browser.ts index de8794dfcda..5daf909f482 100644 --- a/src/client/client-patch-browser.ts +++ b/src/client/client-patch-browser.ts @@ -31,7 +31,7 @@ export const patchBrowser = (): Promise => { ? Array.from(doc.querySelectorAll('script')).find( (s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || - s.getAttribute('data-stencil-namespace') === NAMESPACE + s.getAttribute('data-stencil-namespace') === NAMESPACE, ) : null; const importMeta = import.meta.url; diff --git a/src/client/client-window.ts b/src/client/client-window.ts index 642cb3f9bac..153bed5469a 100644 --- a/src/client/client-window.ts +++ b/src/client/client-window.ts @@ -44,7 +44,7 @@ export const supportsListenerOptions = /*@__PURE__*/ (() => { get() { supportsListenerOptions = true; }, - }) + }), ); } catch (e) {} return supportsListenerOptions; diff --git a/src/compiler/app-core/app-es5-disabled.ts b/src/compiler/app-core/app-es5-disabled.ts index 33100a75402..eacb8ee253d 100644 --- a/src/compiler/app-core/app-es5-disabled.ts +++ b/src/compiler/app-core/app-es5-disabled.ts @@ -6,7 +6,7 @@ import type * as d from '../../declarations'; export const generateEs5DisabledMessage = async ( config: d.Config, compilerCtx: d.CompilerCtx, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { // not doing an es5 right now // but it's possible during development the user @@ -109,7 +109,7 @@ h2 { config.fsNamespace }.esm.js"${escapeHtml(`>`)} ${escapeHtml(`nomodule ${escapeHtml( - `src="/build/${config.fsNamespace}.js">` + `src="/build/${config.fsNamespace}.js">`, )} `; diff --git a/src/compiler/app-core/app-polyfills.ts b/src/compiler/app-core/app-polyfills.ts index e41c7b21826..90b109f9189 100644 --- a/src/compiler/app-core/app-polyfills.ts +++ b/src/compiler/app-core/app-polyfills.ts @@ -10,7 +10,7 @@ export const getClientPolyfill = async (config: d.Config, compilerCtx: d.Compile 'internal', 'client', 'polyfills', - polyfillFile + polyfillFile, ); return compilerCtx.fs.readFile(polyfillFilePath); }; @@ -20,7 +20,7 @@ export const getAppBrowserCorePolyfills = async (config: d.Config, compilerCtx: const polyfills = INLINE_POLYFILLS.slice(); const results = await Promise.all( - polyfills.map((polyfillFile) => getClientPolyfill(config, compilerCtx, polyfillFile)) + polyfills.map((polyfillFile) => getClientPolyfill(config, compilerCtx, polyfillFile)), ); // concat the polyfills diff --git a/src/compiler/app-core/bundle-app-core.ts b/src/compiler/app-core/bundle-app-core.ts index 81c1b0e3dd3..01ac850d50c 100644 --- a/src/compiler/app-core/bundle-app-core.ts +++ b/src/compiler/app-core/bundle-app-core.ts @@ -17,7 +17,7 @@ export const generateRollupOutput = async ( build: RollupBuild, options: OutputOptions, config: d.Config, - entryModules: d.EntryModule[] + entryModules: d.EntryModule[], ): Promise => { if (build == null) { return null; diff --git a/src/compiler/build/build-finish.ts b/src/compiler/build/build-finish.ts index c8536252105..3a8cbffa573 100644 --- a/src/compiler/build/build-finish.ts +++ b/src/compiler/build/build-finish.ts @@ -45,7 +45,7 @@ const buildDone = async ( config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - aborted: boolean + aborted: boolean, ): Promise => { if (buildCtx.hasFinished && buildCtx.buildResults) { // we've already marked this build as finished and diff --git a/src/compiler/build/build-hmr.ts b/src/compiler/build/build-hmr.ts index 8ad1b76d80d..62877ff92dd 100644 --- a/src/compiler/build/build-hmr.ts +++ b/src/compiler/build/build-hmr.ts @@ -52,7 +52,7 @@ export const generateHmr = (config: d.Config, compilerCtx: d.CompilerCtx, buildC styleText: s.styleText, } as d.HmrStyleUpdate; }), - (s) => s.styleId + (s) => s.styleId, ); } @@ -118,7 +118,7 @@ const addTsFileImporters = ( filesToLookForImporters: string[], checkedFiles: Set, changedScriptFiles: string[], - scriptFile: string + scriptFile: string, ) => { if (!changedScriptFiles.includes(scriptFile)) { // add it to our list of files to transpile diff --git a/src/compiler/build/build-stats.ts b/src/compiler/build/build-stats.ts index f3514728780..22e79f5bc5e 100644 --- a/src/compiler/build/build-stats.ts +++ b/src/compiler/build/build-stats.ts @@ -10,7 +10,7 @@ import type * as d from '../../declarations'; */ export function generateBuildStats( config: d.Config, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): result.Result { // TODO(STENCIL-461): Investigate making this return only a single type const buildResults = buildCtx.buildResults; @@ -79,7 +79,7 @@ export function generateBuildStats( */ export async function writeBuildStats( config: d.Config, - data: result.Result + data: result.Result, ): Promise { const statsTargets = config.outputTargets.filter(isOutputTargetStats); @@ -91,7 +91,7 @@ export async function writeBuildStats( if (result.error) { config.logger.warn([`Stats failed to write file to ${outputTarget.file}`]); } - }) + }), ); }); } diff --git a/src/compiler/build/build.ts b/src/compiler/build/build.ts index 9e5979777f3..8e55a6c0ff4 100644 --- a/src/compiler/build/build.ts +++ b/src/compiler/build/build.ts @@ -14,7 +14,7 @@ export const build = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - tsBuilder: ts.BuilderProgram + tsBuilder: ts.BuilderProgram, ) => { try { // reset process.cwd() for 3rd-party plugins diff --git a/src/compiler/build/full-build.ts b/src/compiler/build/full-build.ts index b989c0db04b..7a2ec27ebd2 100644 --- a/src/compiler/build/full-build.ts +++ b/src/compiler/build/full-build.ts @@ -13,7 +13,7 @@ import { BuildContext } from './build-ctx'; */ export const createFullBuild = async ( config: d.ValidatedConfig, - compilerCtx: d.CompilerCtx + compilerCtx: d.CompilerCtx, ): Promise => { return new Promise((resolve) => { let tsWatchProgram: ts.WatchOfConfigFile = null; diff --git a/src/compiler/build/validate-files.ts b/src/compiler/build/validate-files.ts index e75cf61f457..5451dc37ce6 100644 --- a/src/compiler/build/validate-files.ts +++ b/src/compiler/build/validate-files.ts @@ -13,7 +13,7 @@ import { validateBuildPackageJson } from '../types/validate-build-package-json'; export const validateBuildFiles = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise<(void | void[])[]> => { if (buildCtx.hasError) { return null; diff --git a/src/compiler/build/watch-build.ts b/src/compiler/build/watch-build.ts index 219f8849e3e..be5a18bc750 100644 --- a/src/compiler/build/watch-build.ts +++ b/src/compiler/build/watch-build.ts @@ -31,7 +31,7 @@ import { BuildContext } from './build-ctx'; */ export const createWatchBuild = async ( config: d.ValidatedConfig, - compilerCtx: d.CompilerCtx + compilerCtx: d.CompilerCtx, ): Promise => { let isRebuild = false; let tsWatchProgram: { @@ -74,13 +74,13 @@ export const createWatchBuild = async ( if (config.flags.debug) { config.logger.debug(`WATCH_BUILD::watchBuild::onBuild filesAdded: ${formatFilesForDebug(buildCtx.filesAdded)}`); config.logger.debug( - `WATCH_BUILD::watchBuild::onBuild filesDeleted: ${formatFilesForDebug(buildCtx.filesDeleted)}` + `WATCH_BUILD::watchBuild::onBuild filesDeleted: ${formatFilesForDebug(buildCtx.filesDeleted)}`, ); config.logger.debug( - `WATCH_BUILD::watchBuild::onBuild filesUpdated: ${formatFilesForDebug(buildCtx.filesUpdated)}` + `WATCH_BUILD::watchBuild::onBuild filesUpdated: ${formatFilesForDebug(buildCtx.filesUpdated)}`, ); config.logger.debug( - `WATCH_BUILD::watchBuild::onBuild filesWritten: ${formatFilesForDebug(buildCtx.filesWritten)}` + `WATCH_BUILD::watchBuild::onBuild filesWritten: ${formatFilesForDebug(buildCtx.filesWritten)}`, ); } @@ -177,7 +177,7 @@ export const createWatchBuild = async ( } config.logger.debug( - `WATCH_BUILD::fs_event_change - type=${eventKind}, path=${filePath}, time=${new Date().getTime()}` + `WATCH_BUILD::fs_event_change - type=${eventKind}, path=${filePath}, time=${new Date().getTime()}`, ); // Trigger a rebuild of the project @@ -325,7 +325,7 @@ const updateCompilerCtxCache = ( config: d.Config, compilerCtx: d.CompilerCtx, path: string, - kind: d.CompilerFileWatcherEvent + kind: d.CompilerFileWatcherEvent, ) => { compilerCtx.fs.clearFileCache(path); compilerCtx.changedFiles.add(path); diff --git a/src/compiler/build/write-build.ts b/src/compiler/build/write-build.ts index 9c61d3ebe5b..f1205c7edee 100644 --- a/src/compiler/build/write-build.ts +++ b/src/compiler/build/write-build.ts @@ -13,7 +13,7 @@ import { validateBuildFiles } from './validate-files'; export const writeBuild = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { const timeSpan = buildCtx.createTimeSpan(`writeBuildFiles started`, true); diff --git a/src/compiler/bundle/app-data-plugin.ts b/src/compiler/bundle/app-data-plugin.ts index 75e3219a84a..9365b80199e 100644 --- a/src/compiler/bundle/app-data-plugin.ts +++ b/src/compiler/bundle/app-data-plugin.ts @@ -13,7 +13,7 @@ export const appDataPlugin = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, build: d.BuildConditionals, - platform: 'client' | 'hydrate' | 'worker' + platform: 'client' | 'hydrate' | 'worker', ): Plugin => { if (!platform) { return { diff --git a/src/compiler/bundle/bundle-output.ts b/src/compiler/bundle/bundle-output.ts index 528c5dd4839..94e10396b29 100644 --- a/src/compiler/bundle/bundle-output.ts +++ b/src/compiler/bundle/bundle-output.ts @@ -26,7 +26,7 @@ export const bundleOutput = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - bundleOpts: BundleOptions + bundleOpts: BundleOptions, ) => { try { const rollupOptions = getRollupOptions(config, compilerCtx, buildCtx, bundleOpts); @@ -56,7 +56,7 @@ export const getRollupOptions = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - bundleOpts: BundleOptions + bundleOpts: BundleOptions, ): RollupOptions => { const customResolveOptions = createCustomResolverAsync(config.sys, compilerCtx.fs, [ '.tsx', diff --git a/src/compiler/bundle/core-resolve-plugin.ts b/src/compiler/bundle/core-resolve-plugin.ts index bf4e37db6a3..34be7071fc1 100644 --- a/src/compiler/bundle/core-resolve-plugin.ts +++ b/src/compiler/bundle/core-resolve-plugin.ts @@ -19,7 +19,7 @@ export const coreResolvePlugin = ( config: d.Config, compilerCtx: d.CompilerCtx, platform: 'client' | 'hydrate' | 'worker', - externalRuntime: boolean + externalRuntime: boolean, ): Plugin => { const compilerExe = config.sys.getCompilerExecutingPath(); const internalClient = getStencilInternalModule(config, compilerExe, 'client/index.js'); @@ -129,7 +129,7 @@ export const getStencilInternalModule = (config: d.Config, compilerExe: string, rootDir: config.rootDir, moduleId: '@stencil/core', path: 'internal/' + internalModule, - }) + }), ); } diff --git a/src/compiler/bundle/dev-module.ts b/src/compiler/bundle/dev-module.ts index d9c7f9525bc..eb9db9ce2d3 100644 --- a/src/compiler/bundle/dev-module.ts +++ b/src/compiler/bundle/dev-module.ts @@ -10,7 +10,7 @@ import { DEV_MODULE_CACHE_BUSTER, DEV_MODULE_DIR } from './constants'; export const compilerRequest = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - data: d.CompilerRequest + data: d.CompilerRequest, ) => { const results: d.CompilerRequestResponse = { path: data.path, @@ -84,7 +84,7 @@ const bundleDevModule = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, parsedUrl: ParsedDevModuleUrl, - results: d.CompilerRequestResponse + results: d.CompilerRequestResponse, ) => { const buildCtx = new BuildContext(config, compilerCtx); @@ -182,7 +182,7 @@ const parseDevModuleUrl = (config: d.Config, u: string) => { const getDevModuleCachePath = (config: d.Config, parsedUrl: ParsedDevModuleUrl) => { return join( config.cacheDir, - `dev_module_${parsedUrl.nodeModuleId}_${parsedUrl.nodeModuleVersion}_${DEV_MODULE_CACHE_BUSTER}.log` + `dev_module_${parsedUrl.nodeModuleId}_${parsedUrl.nodeModuleVersion}_${DEV_MODULE_CACHE_BUSTER}.log`, ); }; diff --git a/src/compiler/bundle/dev-node-module-resolve.ts b/src/compiler/bundle/dev-node-module-resolve.ts index 17f8080f472..ad93a8e90dc 100644 --- a/src/compiler/bundle/dev-node-module-resolve.ts +++ b/src/compiler/bundle/dev-node-module-resolve.ts @@ -9,7 +9,7 @@ export const devNodeModuleResolveId = async ( config: d.Config, inMemoryFs: InMemoryFileSystem, resolvedId: PartialResolvedId, - importee: string + importee: string, ) => { if (!shouldCheckDevModule(resolvedId, importee)) { return resolvedId; diff --git a/src/compiler/bundle/ext-format-plugin.ts b/src/compiler/bundle/ext-format-plugin.ts index 64f712030b2..5a93e0c62e4 100644 --- a/src/compiler/bundle/ext-format-plugin.ts +++ b/src/compiler/bundle/ext-format-plugin.ts @@ -56,7 +56,7 @@ const formatUrl = ( pluginCtx: TransformPluginContext, code: string, filePath: string, - ext: string + ext: string, ) => { const mime = FORMAT_URL_MIME[ext]; if (!mime) { diff --git a/src/compiler/bundle/ext-transforms-plugin.ts b/src/compiler/bundle/ext-transforms-plugin.ts index f8d751d1364..71c34b58135 100644 --- a/src/compiler/bundle/ext-transforms-plugin.ts +++ b/src/compiler/bundle/ext-transforms-plugin.ts @@ -21,7 +21,7 @@ export const extTransformsPlugin = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - bundleOpts: BundleOptions + bundleOpts: BundleOptions, ): Plugin => { return { name: 'extTransformsPlugin', @@ -92,7 +92,7 @@ export const extTransformsPlugin = ( collectionDirs.map(async (outputTarget) => { const collectionPath = join(outputTarget.collectionDir, relPath); await compilerCtx.fs.writeFile(collectionPath, pluginTransforms.code); - }) + }), ); } } diff --git a/src/compiler/bundle/test/ext-transforms-plugin.spec.ts b/src/compiler/bundle/test/ext-transforms-plugin.spec.ts index 527706a09bb..5335f949834 100644 --- a/src/compiler/bundle/test/ext-transforms-plugin.spec.ts +++ b/src/compiler/bundle/test/ext-transforms-plugin.spec.ts @@ -33,7 +33,7 @@ describe('extTransformsPlugin', () => { compilerComponentMeta.sourceFilePath, mockModule({ cmps: [compilerComponentMeta], - }) + }), ); const bundleOpts: BundleOptions = { @@ -134,7 +134,7 @@ describe('extTransformsPlugin', () => { // @ts-ignore the Rollup plugins expect to be called in a Rollup context await plugin.transform('asdf', `/some/stubbed/path/foo.css?${queryParams}`); expect(transformCssToEsmSpy.mock.calls[0][0].commentOriginalSelector).toBe(false); - } + }, ); }); }); diff --git a/src/compiler/bundle/worker-plugin.ts b/src/compiler/bundle/worker-plugin.ts index 1678e5b2bc7..abc02effcdf 100644 --- a/src/compiler/bundle/worker-plugin.ts +++ b/src/compiler/bundle/worker-plugin.ts @@ -11,7 +11,7 @@ export const workerPlugin = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, platform: string, - inlineWorkers: boolean + inlineWorkers: boolean, ): Plugin => { if (platform === 'worker' || platform === 'hydrate') { return { @@ -66,7 +66,7 @@ export const workerPlugin = ( buildCtx, this, workersMap, - workerEntryPath + workerEntryPath, ); const referenceId = this.emitFile({ type: 'asset', @@ -87,7 +87,7 @@ export const workerPlugin = ( buildCtx, this, workersMap, - workerEntryPath + workerEntryPath, ); const referenceId = this.emitFile({ type: 'asset', @@ -144,7 +144,7 @@ const getWorker = async ( buildCtx: d.BuildCtx, ctx: PluginContext, workersMap: Map, - workerEntryPath: string + workerEntryPath: string, ): Promise => { let worker = workersMap.get(workerEntryPath); if (!worker) { @@ -165,7 +165,7 @@ const buildWorker = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, ctx: PluginContext, - workerEntryPath: string + workerEntryPath: string, ) => { const workerName = getWorkerName(workerEntryPath); const workerMsgId = `stencil.${workerName}`; diff --git a/src/compiler/cache.ts b/src/compiler/cache.ts index d556cd68b6d..3dc4e90d181 100644 --- a/src/compiler/cache.ts +++ b/src/compiler/cache.ts @@ -12,7 +12,7 @@ export class Cache implements d.Cache { constructor( private config: d.Config, - private cacheFs: InMemoryFileSystem + private cacheFs: InMemoryFileSystem, ) { this.sys = config.sys; this.logger = config.logger; diff --git a/src/compiler/config/config-utils.ts b/src/compiler/config/config-utils.ts index 0b4b125feb3..0a00766d3fc 100644 --- a/src/compiler/config/config-utils.ts +++ b/src/compiler/config/config-utils.ts @@ -29,7 +29,7 @@ export const setBooleanConfig = ( config: d.UnvalidatedConfig, configName: (K & keyof ConfigFlags) | K, flagName: keyof ConfigFlags | null, - defaultValue: d.Config[K] + defaultValue: d.Config[K], ) => { if (flagName) { const flagValue = config.flags?.[flagName]; diff --git a/src/compiler/config/load-config.ts b/src/compiler/config/load-config.ts index e0f0929854a..50ac9d07171 100644 --- a/src/compiler/config/load-config.ts +++ b/src/compiler/config/load-config.ts @@ -153,7 +153,7 @@ const loadConfigFile = async (diagnostics: Diagnostic[], configPath: string): Pr */ const evaluateConfigFile = async ( diagnostics: Diagnostic[], - configFilePath: string + configFilePath: string, ): Promise<{ config?: UnvalidatedConfig } | null> => { let configFileData: { config?: UnvalidatedConfig } | null = null; diff --git a/src/compiler/config/outputs/validate-collection.ts b/src/compiler/config/outputs/validate-collection.ts index f3cc39c158b..842f0193861 100644 --- a/src/compiler/config/outputs/validate-collection.ts +++ b/src/compiler/config/outputs/validate-collection.ts @@ -13,7 +13,7 @@ import { getAbsolutePath } from '../config-utils'; */ export const validateCollection = ( config: d.ValidatedConfig, - userOutputs: d.OutputTarget[] + userOutputs: d.OutputTarget[], ): d.OutputTargetDistCollection[] => { return userOutputs.filter(isOutputTargetDistCollection).map((outputTarget) => { return { diff --git a/src/compiler/config/outputs/validate-custom-element.ts b/src/compiler/config/outputs/validate-custom-element.ts index 0e5e31c626d..fe23cb5e141 100644 --- a/src/compiler/config/outputs/validate-custom-element.ts +++ b/src/compiler/config/outputs/validate-custom-element.ts @@ -22,7 +22,7 @@ import { validateCopy } from '../validate-copy'; */ export const validateCustomElement = ( config: ValidatedConfig, - userOutputs: ReadonlyArray + userOutputs: ReadonlyArray, ): ReadonlyArray => { const defaultDir = 'dist'; @@ -73,6 +73,6 @@ export const validateCustomElement = ( return outputs; }, - [] as (OutputTargetDistCustomElements | OutputTargetCopy | OutputTargetDistTypes)[] + [] as (OutputTargetDistCustomElements | OutputTargetCopy | OutputTargetDistTypes)[], ); }; diff --git a/src/compiler/config/outputs/validate-custom-output.ts b/src/compiler/config/outputs/validate-custom-output.ts index 64b95fe5b9d..9e722ff4ffe 100644 --- a/src/compiler/config/outputs/validate-custom-output.ts +++ b/src/compiler/config/outputs/validate-custom-output.ts @@ -5,7 +5,7 @@ import type * as d from '../../../declarations'; export const validateCustomOutput = ( config: d.ValidatedConfig, diagnostics: d.Diagnostic[], - userOutputs: d.OutputTarget[] + userOutputs: d.OutputTarget[], ) => { return userOutputs.filter(isOutputTargetCustom).map((o) => { if (o.validate) { diff --git a/src/compiler/config/outputs/validate-docs.ts b/src/compiler/config/outputs/validate-docs.ts index 3af4f66ab8f..1b013ec3b6a 100644 --- a/src/compiler/config/outputs/validate-docs.ts +++ b/src/compiler/config/outputs/validate-docs.ts @@ -21,7 +21,7 @@ export const validateDocs = (config: d.ValidatedConfig, diagnostics: d.Diagnosti validateJsonDocsOutputTarget(config, diagnostics, { type: 'docs-json', file: config.flags.docsJson, - }) + }), ); } @@ -78,7 +78,7 @@ const validateReadmeOutputTarget = (config: d.ValidatedConfig, outputTarget: d.O const validateJsonDocsOutputTarget = ( config: d.ValidatedConfig, diagnostics: d.Diagnostic[], - outputTarget: d.OutputTargetDocsJson + outputTarget: d.OutputTargetDocsJson, ) => { if (!isString(outputTarget.file)) { const err = buildError(diagnostics); diff --git a/src/compiler/config/outputs/validate-www.ts b/src/compiler/config/outputs/validate-www.ts index d0ea0c78af3..86e7108268f 100644 --- a/src/compiler/config/outputs/validate-www.ts +++ b/src/compiler/config/outputs/validate-www.ts @@ -37,7 +37,7 @@ export const validateWww = (config: d.ValidatedConfig, diagnostics: d.Diagnostic return userWwwOutputs.reduce( ( outputs: (d.OutputTargetWww | d.OutputTargetDistLazy | d.OutputTargetCopy | d.OutputTargetDistGlobalStyles)[], - o + o, ) => { const outputTarget = validateWwwOutputTarget(config, o, diagnostics); outputs.push(outputTarget); @@ -79,14 +79,14 @@ export const validateWww = (config: d.ValidatedConfig, diagnostics: d.Diagnostic return outputs; }, - [] + [], ); }; const validateWwwOutputTarget = ( config: d.ValidatedConfig, outputTarget: d.OutputTargetWww, - diagnostics: d.Diagnostic[] + diagnostics: d.Diagnostic[], ) => { if (!isString(outputTarget.baseUrl)) { outputTarget.baseUrl = '/'; diff --git a/src/compiler/config/test/load-config.spec.ts b/src/compiler/config/test/load-config.spec.ts index e21b30bca03..763bf676e8a 100644 --- a/src/compiler/config/test/load-config.spec.ts +++ b/src/compiler/config/test/load-config.spec.ts @@ -34,7 +34,7 @@ describe('load config', () => { include: ['src'], }, null, - 2 + 2, ); mock({ @@ -119,7 +119,7 @@ describe('load config', () => { level: 'error', lines: [], messageText: `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the "./${path.dirname( - noTsConfigPath + noTsConfigPath, )}" directory.`, relFilePath: null, type: 'build', @@ -137,7 +137,7 @@ describe('load config', () => { level: 'error', lines: [], messageText: expect.stringMatching( - `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the` + `Unable to load TypeScript config file. Please create a "tsconfig.json" file within the`, ), relFilePath: null, type: 'build', diff --git a/src/compiler/config/test/validate-config.spec.ts b/src/compiler/config/test/validate-config.spec.ts index 02629cab2cb..9f7c1bd0db0 100644 --- a/src/compiler/config/test/validate-config.spec.ts +++ b/src/compiler/config/test/validate-config.spec.ts @@ -335,7 +335,7 @@ describe('validation', () => { (targetType) => { const { config } = validateConfig(userConfig, bootstrapConfig); expect(config.outputTargets.some((o) => o.type === targetType)).toBe(false); - } + }, ); it('should set devInspector false', () => { @@ -488,7 +488,7 @@ describe('validation', () => { const { config } = validateConfig(userConfig, bootstrapConfig); expect(config.validatePrimaryPackageOutputTarget).toBe(validatePrimaryPackageOutputTarget); - } + }, ); }); }); diff --git a/src/compiler/config/test/validate-dev-server.spec.ts b/src/compiler/config/test/validate-dev-server.spec.ts index a228bb8b637..218482f949e 100644 --- a/src/compiler/config/test/validate-dev-server.spec.ts +++ b/src/compiler/config/test/validate-dev-server.spec.ts @@ -35,7 +35,7 @@ describe('validateDevServer', () => { inputConfig.devServer = { ...inputDevServerConfig, address }; const { config } = validateConfig(inputConfig, mockLoadConfigInit()); expect(config.devServer.address).toBe('localhost'); - } + }, ); it('should set address', () => { @@ -119,7 +119,7 @@ describe('validateDevServer', () => { inputConfig.devServer = { ...inputDevServerConfig, address, port: 1234 }; const { config } = validateConfig(inputConfig, mockLoadConfigInit()); expect(config.devServer.port).toBe(1234); - } + }, ); it('should not set default port if null', () => { diff --git a/src/compiler/config/test/validate-output-dist-collection.spec.ts b/src/compiler/config/test/validate-output-dist-collection.spec.ts index 1b2841d56b8..75c0b7bc0d6 100644 --- a/src/compiler/config/test/validate-output-dist-collection.spec.ts +++ b/src/compiler/config/test/validate-output-dist-collection.spec.ts @@ -82,7 +82,7 @@ describe('validateDistCollectionOutputTarget', () => { transformAliasedImportPaths, }, ]); - } + }, ); }); }); diff --git a/src/compiler/config/test/validate-testing.spec.ts b/src/compiler/config/test/validate-testing.spec.ts index 150e846dc97..34d349e933a 100644 --- a/src/compiler/config/test/validate-testing.spec.ts +++ b/src/compiler/config/test/validate-testing.spec.ts @@ -94,7 +94,7 @@ describe('validateTesting', () => { userConfig.testing = { browserHeadless: browserHeadlessValue }; const { config } = validateConfig(userConfig, mockLoadConfigInit()); expect(config.testing.browserHeadless).toBe(browserHeadlessValue); - } + }, ); it('defaults the headless mode to true when browserHeadless is not provided', () => { @@ -337,7 +337,7 @@ describe('validateTesting', () => { path.join('testing', 'jest-setuptestframework.js'), ...setupFilesAfterEnv, ]); - } + }, ); }); @@ -430,7 +430,7 @@ describe('validateTesting', () => { const { config } = validateConfig(userConfig, mockLoadConfigInit()); expect(config.testing.allowableMismatchedRatio).toBe(allowableMismatchedRatio); - } + }, ); it.each([-1, -0.1, 1.1, 2])( @@ -454,7 +454,7 @@ describe('validateTesting', () => { relFilePath: null, type: 'build', }); - } + }, ); it.each([true, null])('does nothing when a non-number (%s) is provided', (allowableMismatchedRatio) => { @@ -501,7 +501,7 @@ describe('validateTesting', () => { relFilePath: null, type: 'build', }); - } + }, ); it.each([true, null])('defaults to a reasonable value if a non-number (%s) is provided', (pixelmatchThreshold) => { diff --git a/src/compiler/config/transpile-options.ts b/src/compiler/config/transpile-options.ts index aaaf0e33a8b..f3da7583884 100644 --- a/src/compiler/config/transpile-options.ts +++ b/src/compiler/config/transpile-options.ts @@ -154,7 +154,7 @@ export const getTranspileConfig = (input: TranspileOptions): TranspileConfig => export const getTranspileCssConfig = ( compileOpts: TranspileOptions, importData: ImportData, - results: TranspileResults + results: TranspileResults, ) => { const transformInput: TransformCssToEsmInput = { file: results.inputFilePath, diff --git a/src/compiler/config/validate-config.ts b/src/compiler/config/validate-config.ts index e0882f80589..07e91b27b49 100644 --- a/src/compiler/config/validate-config.ts +++ b/src/compiler/config/validate-config.ts @@ -53,7 +53,7 @@ let CACHED_VALIDATED_CONFIG: ValidatedConfig | null = null; */ export const validateConfig = ( userConfig: UnvalidatedConfig = {}, - bootstrapConfig: LoadConfigInit + bootstrapConfig: LoadConfigInit, ): ConfigValidationResults => { const diagnostics: Diagnostic[] = []; @@ -121,7 +121,7 @@ export const validateConfig = ( validatedConfig, 'sourceMap', null, - typeof validatedConfig.sourceMap === 'undefined' ? true : validatedConfig.sourceMap + typeof validatedConfig.sourceMap === 'undefined' ? true : validatedConfig.sourceMap, ); setBooleanConfig(validatedConfig, 'watch', 'watch', false); setBooleanConfig(validatedConfig, 'buildDocs', 'docs', !validatedConfig.devMode); diff --git a/src/compiler/config/validate-copy.ts b/src/compiler/config/validate-copy.ts index bd6bd542bac..cb58cba79ec 100644 --- a/src/compiler/config/validate-copy.ts +++ b/src/compiler/config/validate-copy.ts @@ -10,7 +10,7 @@ import type * as d from '../../declarations'; */ export const validateCopy = ( copy: d.CopyTask[] | boolean | null | undefined, - defaultCopy: d.CopyTask[] = [] + defaultCopy: d.CopyTask[] = [], ): d.CopyTask[] => { if (copy === null || copy === false) { return []; diff --git a/src/compiler/config/validate-prerender.ts b/src/compiler/config/validate-prerender.ts index 20f9761ce52..c689f4d1976 100644 --- a/src/compiler/config/validate-prerender.ts +++ b/src/compiler/config/validate-prerender.ts @@ -6,7 +6,7 @@ import type * as d from '../../declarations'; export const validatePrerender = ( config: d.ValidatedConfig, diagnostics: d.Diagnostic[], - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { if (!config.flags.ssr && !config.flags.prerender && config.flags.task !== 'prerender') { return; diff --git a/src/compiler/config/validate-service-worker.ts b/src/compiler/config/validate-service-worker.ts index fe15cac9f25..e7165afbef2 100644 --- a/src/compiler/config/validate-service-worker.ts +++ b/src/compiler/config/validate-service-worker.ts @@ -96,7 +96,7 @@ const addGlobIgnores = (config: d.ValidatedConfig, globIgnores: string[]) => { `**/*.system.js`, `**/${config.fsNamespace}.js`, `**/${config.fsNamespace}.esm.js`, - `**/${config.fsNamespace}.css` + `**/${config.fsNamespace}.css`, ); }; diff --git a/src/compiler/config/validate-testing.ts b/src/compiler/config/validate-testing.ts index d6dd0ae43d1..6e7da70913a 100644 --- a/src/compiler/config/validate-testing.ts +++ b/src/compiler/config/validate-testing.ts @@ -66,7 +66,7 @@ export const validateTesting = (config: d.ValidatedConfig, diagnostics: d.Diagno '..', '..', 'screenshot', - 'local-connector.js' + 'local-connector.js', ); } @@ -77,7 +77,7 @@ export const validateTesting = (config: d.ValidatedConfig, diagnostics: d.Diagno (config.outputTargets ?? []) .filter( - (o): o is d.OutputTargetWww | d.OutputTargetDist => (isOutputTargetDist(o) || isOutputTargetWww(o)) && !!o.dir + (o): o is d.OutputTargetWww | d.OutputTargetDist => (isOutputTargetDist(o) || isOutputTargetWww(o)) && !!o.dir, ) .forEach((outputTarget) => { testing.testPathIgnorePatterns?.push(outputTarget.dir!); @@ -95,7 +95,7 @@ export const validateTesting = (config: d.ValidatedConfig, diagnostics: d.Diagno } testing.setupFilesAfterEnv.unshift( - join(config.sys!.getCompilerExecutingPath(), '..', '..', 'testing', 'jest-setuptestframework.js') + join(config.sys!.getCompilerExecutingPath(), '..', '..', 'testing', 'jest-setuptestframework.js'), ); if (isString(testing.testEnvironment)) { diff --git a/src/compiler/docs/custom/index.ts b/src/compiler/docs/custom/index.ts index b98e8d8c18f..600f25e1a78 100644 --- a/src/compiler/docs/custom/index.ts +++ b/src/compiler/docs/custom/index.ts @@ -5,7 +5,7 @@ import type * as d from '../../../declarations'; export const generateCustomDocs = async ( config: d.ValidatedConfig, docsData: d.JsonDocs, - outputTargets: d.OutputTarget[] + outputTargets: d.OutputTarget[], ) => { const customOutputTargets = outputTargets.filter(isOutputTargetDocsCustom); if (customOutputTargets.length === 0) { @@ -18,6 +18,6 @@ export const generateCustomDocs = async ( } catch (e) { config.logger.error(`uncaught custom docs error: ${e}`); } - }) + }), ); }; diff --git a/src/compiler/docs/generate-doc-data.ts b/src/compiler/docs/generate-doc-data.ts index 9edb8159c16..549ad3f7880 100644 --- a/src/compiler/docs/generate-doc-data.ts +++ b/src/compiler/docs/generate-doc-data.ts @@ -20,7 +20,7 @@ import { AUTO_GENERATE_COMMENT } from './constants'; export const generateDocData = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { const jsonOutputTargets = config.outputTargets.filter(isOutputTargetDocsJson); const supplementalPublicTypes = findSupplementalPublicTypes(jsonOutputTargets); @@ -72,7 +72,7 @@ function findSupplementalPublicTypes(outputTargets: d.OutputTargetDocsJson[]): s const getDocsComponents = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { const results = await Promise.all( buildCtx.moduleFiles.map(async (moduleFile) => { @@ -111,7 +111,7 @@ const getDocsComponents = async ( parts: getDocsParts(cmp.htmlParts, cmp.docs.tags), listeners: getDocsListeners(cmp.listeners), })); - }) + }), ); return sortBy(flatOne(results), (cmp) => cmp.tag); @@ -119,7 +119,7 @@ const getDocsComponents = async ( const buildDocsDepGraph = ( cmp: d.ComponentCompilerMeta, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): d.JsonDocsDependencyGraph => { const dependencies: d.JsonDocsDependencyGraph = {}; function walk(tagName: string): void { @@ -168,7 +168,7 @@ const getDocsEncapsulation = (cmp: d.ComponentCompilerMeta): 'shadow' | 'scoped' const getDocsProperties = (cmpMeta: d.ComponentCompilerMeta): d.JsonDocsProp[] => { return sortBy( [...getRealProperties(cmpMeta.properties), ...getVirtualProperties(cmpMeta.virtualProperties)], - (p) => p.name + (p) => p.name, ); }; @@ -342,7 +342,7 @@ const getDocsDeprecationText = (tags: d.JsonDocsTag[]): string | undefined => { const getDocsSlots = (tags: d.JsonDocsTag[]): d.JsonDocsSlot[] => { return sortBy( getNameText('slot', tags).map(([name, docs]) => ({ name, docs })), - (a) => a.name + (a) => a.name, ); }; @@ -351,7 +351,7 @@ const getDocsParts = (vdom: string[], tags: d.JsonDocsTag[]): d.JsonDocsSlot[] = const vdomParts = vdom.map((name) => ({ name, docs: '' })); return sortBy( unique([...docsParts, ...vdomParts], (p) => p.name), - (p) => p.name + (p) => p.name, ); }; @@ -466,7 +466,7 @@ const generateUsages = async (compilerCtx: d.CompilerCtx, usagesDir: string): Pr const key = parts.join('.'); usages[key] = await compilerCtx.fs.readFile(f.absPath); - }) + }), ); Object.keys(usages) diff --git a/src/compiler/docs/json/index.ts b/src/compiler/docs/json/index.ts index 1b8c14ad387..5e34261b664 100644 --- a/src/compiler/docs/json/index.ts +++ b/src/compiler/docs/json/index.ts @@ -7,7 +7,7 @@ export const generateJsonDocs = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, docsData: d.JsonDocs, - outputTargets: d.OutputTarget[] + outputTargets: d.OutputTarget[], ) => { const jsonOutputTargets = outputTargets.filter(isOutputTargetDocsJson); if (jsonOutputTargets.length === 0) { @@ -53,7 +53,7 @@ export default _default; await Promise.all( jsonOutputTargets.map((jsonOutput) => { return writeDocsOutput(compilerCtx, jsonOutput, jsonContent, typesContent); - }) + }), ); }; @@ -61,7 +61,7 @@ export const writeDocsOutput = async ( compilerCtx: d.CompilerCtx, jsonOutput: d.OutputTargetDocsJson, jsonContent: string, - typesContent: string + typesContent: string, ) => { return Promise.all([ compilerCtx.fs.writeFile(jsonOutput.file, jsonContent), diff --git a/src/compiler/docs/readme/index.ts b/src/compiler/docs/readme/index.ts index e39a31c49f9..db1b2e5797f 100644 --- a/src/compiler/docs/readme/index.ts +++ b/src/compiler/docs/readme/index.ts @@ -7,7 +7,7 @@ export const generateReadmeDocs = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, docsData: d.JsonDocs, - outputTargets: d.OutputTarget[] + outputTargets: d.OutputTarget[], ) => { const readmeOutputTargets = outputTargets.filter(isOutputTargetDocsReadme); if (readmeOutputTargets.length === 0) { @@ -21,7 +21,7 @@ export const generateReadmeDocs = async ( await Promise.all( docsData.components.map((cmpData) => { return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components); - }) + }), ); }; diff --git a/src/compiler/docs/readme/output-docs.ts b/src/compiler/docs/readme/output-docs.ts index 25e8a533474..a30a8f98dc9 100644 --- a/src/compiler/docs/readme/output-docs.ts +++ b/src/compiler/docs/readme/output-docs.ts @@ -17,7 +17,7 @@ export const generateReadme = async ( compilerCtx: d.CompilerCtx, readmeOutputs: d.OutputTargetDocsReadme[], docsData: d.JsonDocsComponent, - cmps: d.JsonDocsComponent[] + cmps: d.JsonDocsComponent[], ) => { const isUpdate = !!docsData.readme; const userContent = isUpdate ? docsData.readme : getDefaultReadme(docsData); @@ -37,7 +37,7 @@ export const generateReadme = async ( } } } - }) + }), ); }; @@ -45,7 +45,7 @@ export const generateMarkdown = ( userContent: string, cmp: d.JsonDocsComponent, cmps: d.JsonDocsComponent[], - readmeOutput: d.OutputTargetDocsReadme + readmeOutput: d.OutputTargetDocsReadme, ) => { //If the readmeOutput.dependencies is true or undefined the dependencies will be generated. const dependencies = readmeOutput.dependencies !== false ? depsToMarkdown(cmp, cmps) : []; diff --git a/src/compiler/docs/test/generate-doc-data.spec.ts b/src/compiler/docs/test/generate-doc-data.spec.ts index 210f0a2d0c8..996f1f71b74 100644 --- a/src/compiler/docs/test/generate-doc-data.spec.ts +++ b/src/compiler/docs/test/generate-doc-data.spec.ts @@ -40,7 +40,7 @@ describe('generate-doc-data', () => { * @returns the arguments required to invoke the method under test */ const setup = ( - moduleMap: d.ModuleMap + moduleMap: d.ModuleMap, ): { validatedConfig: d.ValidatedConfig; compilerCtx: d.CompilerCtx; buildCtx: d.BuildCtx } => { const validatedConfig: d.ValidatedConfig = mockValidatedConfig(); @@ -127,7 +127,7 @@ describe('generate-doc-data', () => { await compilerCtx.fs.writeFile( 'readme.md', - `this is manually generated user content\n${AUTO_GENERATE_COMMENT}\nauto-generated content` + `this is manually generated user content\n${AUTO_GENERATE_COMMENT}\nauto-generated content`, ); const generatedDocData = await generateDocData(validatedConfig, compilerCtx, buildCtx); diff --git a/src/compiler/docs/vscode/index.ts b/src/compiler/docs/vscode/index.ts index 93f17dd0503..17f1c83538e 100644 --- a/src/compiler/docs/vscode/index.ts +++ b/src/compiler/docs/vscode/index.ts @@ -21,7 +21,7 @@ import { getNameText } from '../generate-doc-data'; export const generateVscodeDocs = async ( compilerCtx: d.CompilerCtx, docsData: d.JsonDocs, - outputTargets: d.OutputTarget[] + outputTargets: d.OutputTarget[], ): Promise => { const vsCodeOutputTargets = outputTargets.filter(isOutputTargetDocsVscode); if (vsCodeOutputTargets.length === 0) { @@ -55,7 +55,7 @@ export const generateVscodeDocs = async ( // fields in the custom data may have a value of `undefined`. calling `stringify` will remove such fields. const jsonContent = JSON.stringify(json, null, 2); await compilerCtx.fs.writeFile(outputTarget.file, jsonContent); - }) + }), ); }; @@ -129,7 +129,7 @@ const serializeAttribute = (prop: DocPropWithAttribute): AttributeData => { const values = prop.values .filter( (jsonDocValue: d.JsonDocsValue): jsonDocValue is Required => - jsonDocValue.type === 'string' && jsonDocValue.value !== undefined + jsonDocValue.type === 'string' && jsonDocValue.value !== undefined, ) .map((jsonDocValue: Required) => ({ name: jsonDocValue.value })); diff --git a/src/compiler/entries/component-bundles.ts b/src/compiler/entries/component-bundles.ts index 23696797386..cc39a63c845 100644 --- a/src/compiler/entries/component-bundles.ts +++ b/src/compiler/entries/component-bundles.ts @@ -21,7 +21,7 @@ import { getDefaultBundles } from './default-bundles'; function computeUsedComponents( config: d.ValidatedConfig, defaultBundles: readonly d.ComponentCompilerMeta[][], - allCmps: readonly d.ComponentCompilerMeta[] + allCmps: readonly d.ComponentCompilerMeta[], ): Set { if (!config.excludeUnusedDependencies) { // the user/config has specified that Stencil should use all the dependencies it's found, return the set of all @@ -63,7 +63,7 @@ function computeUsedComponents( */ export function generateComponentBundles( config: d.ValidatedConfig, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): readonly d.ComponentCompilerMeta[][] { const components = sortBy(buildCtx.components, (cmp: d.ComponentCompilerMeta) => cmp.dependents.length); @@ -89,7 +89,7 @@ export function generateComponentBundles( .map((c: d.ComponentCompilerMeta) => [c]); return [...defaultBundles, ...optimizeBundlers(bundlers, 0.6)].filter( - (b: readonly d.ComponentCompilerMeta[]) => b.length > 0 + (b: readonly d.ComponentCompilerMeta[]) => b.length > 0, ); } @@ -101,7 +101,7 @@ export function generateComponentBundles( */ function optimizeBundlers( bundles: readonly d.ComponentCompilerMeta[][], - threshold: number + threshold: number, ): readonly d.ComponentCompilerMeta[][] { /** * build a mapping of component tag names in each `bundles` entry to the index where that entry occurs in `bundles`: diff --git a/src/compiler/entries/default-bundles.ts b/src/compiler/entries/default-bundles.ts index c28e1b28dfb..f9b88322268 100644 --- a/src/compiler/entries/default-bundles.ts +++ b/src/compiler/entries/default-bundles.ts @@ -13,7 +13,7 @@ import { getUsedComponents } from '../html/used-components'; export function getDefaultBundles( config: d.ValidatedConfig, buildCtx: d.BuildCtx, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): readonly d.ComponentCompilerMeta[][] { // get all of the user defined bundles in the Stencil config file const userConfigEntryPoints = getUserConfigBundles(config, buildCtx, cmps); @@ -53,7 +53,7 @@ export function getDefaultBundles( export function getUserConfigBundles( config: d.ValidatedConfig, buildCtx: d.BuildCtx, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): readonly d.ComponentCompilerMeta[][] { const definedTags = new Set(); const entryTags = config.bundles.map((b: d.ConfigBundle) => { diff --git a/src/compiler/entries/resolve-component-dependencies.ts b/src/compiler/entries/resolve-component-dependencies.ts index 43e6815dccb..8e736ef12ac 100644 --- a/src/compiler/entries/resolve-component-dependencies.ts +++ b/src/compiler/entries/resolve-component-dependencies.ts @@ -24,7 +24,7 @@ function computeDependents(cmps: d.ComponentCompilerMeta[]) { function resolveTransitiveDependencies( cmp: d.ComponentCompilerMeta, cmps: d.ComponentCompilerMeta[], - visited: Set + visited: Set, ): string[] { if (visited.has(cmp)) { return cmp.dependencies; @@ -37,7 +37,7 @@ function resolveTransitiveDependencies( const transitiveDeps = flatOne( dependencies .map((tagName) => cmps.find((c) => c.tagName === tagName)) - .map((c) => resolveTransitiveDependencies(c, cmps, visited)) + .map((c) => resolveTransitiveDependencies(c, cmps, visited)), ); return (cmp.dependencies = [...dependencies, ...transitiveDeps]); } diff --git a/src/compiler/html/inject-module-preloads.ts b/src/compiler/html/inject-module-preloads.ts index 0b200a4a51d..1e8385973c4 100644 --- a/src/compiler/html/inject-module-preloads.ts +++ b/src/compiler/html/inject-module-preloads.ts @@ -11,7 +11,7 @@ export const optimizeCriticalPath = (doc: Document, criticalBundlers: string[], export const injectModulePreloads = (doc: Document, paths: string[]) => { const existingLinks = (Array.from(doc.querySelectorAll('link[rel=modulepreload]')) as HTMLLinkElement[]).map((link) => - link.getAttribute('href') + link.getAttribute('href'), ); const addLinks = paths.filter((path) => !existingLinks.includes(path)).map((path) => createModulePreload(doc, path)); diff --git a/src/compiler/html/inject-sw-script.ts b/src/compiler/html/inject-sw-script.ts index bc18c6c2365..5c9f60db7c5 100644 --- a/src/compiler/html/inject-sw-script.ts +++ b/src/compiler/html/inject-sw-script.ts @@ -6,7 +6,7 @@ export const updateIndexHtmlServiceWorker = async ( config: d.Config, buildCtx: d.BuildCtx, doc: Document, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { const serviceWorker = outputTarget.serviceWorker; diff --git a/src/compiler/html/inline-esm-import.ts b/src/compiler/html/inline-esm-import.ts index 29e3ffd7761..dd231496061 100644 --- a/src/compiler/html/inline-esm-import.ts +++ b/src/compiler/html/inline-esm-import.ts @@ -11,7 +11,7 @@ export const optimizeEsmImport = async ( config: d.Config, compilerCtx: d.CompilerCtx, doc: Document, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { const resourcesUrl = getAbsoluteBuildDir(outputTarget); const entryFilename = `${config.fsNamespace}.esm.js`; @@ -19,7 +19,7 @@ export const optimizeEsmImport = async ( const script = Array.from(doc.querySelectorAll('script')).find( (s) => - s.getAttribute('type') === 'module' && !s.hasAttribute('crossorigin') && s.getAttribute('src') === expectedSrc + s.getAttribute('type') === 'module' && !s.hasAttribute('crossorigin') && s.getAttribute('src') === expectedSrc, ); if (!script) { diff --git a/src/compiler/html/inline-style-sheets.ts b/src/compiler/html/inline-style-sheets.ts index 83d0eb32a4b..9bebddf84fe 100644 --- a/src/compiler/html/inline-style-sheets.ts +++ b/src/compiler/html/inline-style-sheets.ts @@ -6,7 +6,7 @@ export const inlineStyleSheets = ( compilerCtx: d.CompilerCtx, doc: Document, maxSize: number, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { const globalLinks = Array.from(doc.querySelectorAll('link[rel=stylesheet]')) as HTMLLinkElement[]; return Promise.all( @@ -29,6 +29,6 @@ export const inlineStyleSheets = ( link.parentNode.insertBefore(inlinedStyles, link); link.remove(); } catch (e) {} - }) + }), ); }; diff --git a/src/compiler/html/remove-unused-styles.ts b/src/compiler/html/remove-unused-styles.ts index 11932dbadec..e473cef0f07 100644 --- a/src/compiler/html/remove-unused-styles.ts +++ b/src/compiler/html/remove-unused-styles.ts @@ -27,7 +27,7 @@ export const removeUnusedStyles = (doc: Document, diagnostics: d.Diagnostic[]) = const removeUnusedStyleText = ( usedSelectors: UsedSelectors, diagnostics: d.Diagnostic[], - styleElm: HTMLStyleElement + styleElm: HTMLStyleElement, ) => { try { // parse the css from being applied to the document diff --git a/src/compiler/html/update-global-styles-link.ts b/src/compiler/html/update-global-styles-link.ts index 6868b1cdc33..85792260e49 100644 --- a/src/compiler/html/update-global-styles-link.ts +++ b/src/compiler/html/update-global-styles-link.ts @@ -7,7 +7,7 @@ export const updateGlobalStylesLink = ( config: d.Config, doc: Document, globalScriptFilename: string, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { if (!globalScriptFilename) { return; diff --git a/src/compiler/html/validate-manifest-json.ts b/src/compiler/html/validate-manifest-json.ts index 3a6a0bfbe36..edbc0aa313a 100644 --- a/src/compiler/html/validate-manifest-json.ts +++ b/src/compiler/html/validate-manifest-json.ts @@ -27,7 +27,7 @@ export const validateManifestJson = (config: d.ValidatedConfig, compilerCtx: d.C } } } catch (e) {} - }) + }), ); }; @@ -35,13 +35,13 @@ const validateManifestJsonData = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, manifestFilePath: string, - manifestData: any + manifestData: any, ) => { if (Array.isArray(manifestData.icons)) { await Promise.all( manifestData.icons.map((manifestIcon: any) => { return validateManifestJsonIcon(compilerCtx, buildCtx, manifestFilePath, manifestIcon); - }) + }), ); } }; @@ -50,7 +50,7 @@ const validateManifestJsonIcon = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, manifestFilePath: string, - manifestIcon: any + manifestIcon: any, ) => { let iconSrc = manifestIcon.src; if (typeof iconSrc !== 'string') { diff --git a/src/compiler/optimize/minify-css.ts b/src/compiler/optimize/minify-css.ts index 4e44db71dbf..065055ab0cd 100644 --- a/src/compiler/optimize/minify-css.ts +++ b/src/compiler/optimize/minify-css.ts @@ -20,7 +20,7 @@ export const minifyCss = async (input: { css: string; resolveUrl?: (url: string) const resolveStylesheetUrl = async ( nodes: CssNode[], resolveUrl: (url: string) => Promise | string, - resolved: Map + resolved: Map, ) => { for (const node of nodes) { if (node.type === CssNodeType.Declaration && isString(node.value) && node.value.includes('url(')) { diff --git a/src/compiler/optimize/optimize-module.ts b/src/compiler/optimize/optimize-module.ts index 18a807e896b..9fd956233de 100644 --- a/src/compiler/optimize/optimize-module.ts +++ b/src/compiler/optimize/optimize-module.ts @@ -26,7 +26,7 @@ interface OptimizeModuleOptions { export const optimizeModule = async ( config: Config, compilerCtx: CompilerCtx, - opts: OptimizeModuleOptions + opts: OptimizeModuleOptions, ): Promise => { if ((!opts.minify && opts.sourceTarget !== 'es5') || opts.input === '') { return { @@ -184,7 +184,7 @@ export const prepareModule = async ( input: string, minifyOpts: MinifyOptions, transpileToEs5: boolean, - inlineHelpers: boolean + inlineHelpers: boolean, ): Promise => { const results: OptimizeJsResult = { output: input, @@ -214,7 +214,7 @@ export const prepareModule = async ( // need to merge sourcemaps at this point const mergeMap = sourceMapMerge( (minifyOpts.sourceMap as SourceMapOptions)?.content as SourceMap, - JSON.parse(tsResults.sourceMapText) + JSON.parse(tsResults.sourceMapText), ); if (mergeMap != null) { diff --git a/src/compiler/output-targets/copy/assets-copy-tasks.ts b/src/compiler/output-targets/copy/assets-copy-tasks.ts index 60831d76bca..d1b74515f95 100644 --- a/src/compiler/output-targets/copy/assets-copy-tasks.ts +++ b/src/compiler/output-targets/copy/assets-copy-tasks.ts @@ -7,7 +7,7 @@ export const getComponentAssetsCopyTasks = ( config: d.ValidatedConfig, buildCtx: d.BuildCtx, dest: string, - collectionsPath: boolean + collectionsPath: boolean, ) => { if (!dest) { return []; @@ -51,7 +51,7 @@ export const getComponentAssetsCopyTasks = ( export const canSkipAssetsCopy = ( compilerCtx: d.CompilerCtx, entryModules: d.EntryModule[], - filesChanged: string[] + filesChanged: string[], ) => { if (!compilerCtx.hasSuccessfulBuild) { // always copy assets if we haven't had a successful build yet diff --git a/src/compiler/output-targets/copy/output-copy.ts b/src/compiler/output-targets/copy/output-copy.ts index 19992f0a24a..65360e6e365 100644 --- a/src/compiler/output-targets/copy/output-copy.ts +++ b/src/compiler/output-targets/copy/output-copy.ts @@ -47,7 +47,7 @@ const getCopyTasks = ( config: d.ValidatedConfig, buildCtx: d.BuildCtx, o: d.OutputTargetCopy, - changedFiles: string[] + changedFiles: string[], ) => { if (!Array.isArray(o.copy)) { return []; diff --git a/src/compiler/output-targets/dist-collection/index.ts b/src/compiler/output-targets/dist-collection/index.ts index 4ad54a9d0a6..38898d66aa4 100644 --- a/src/compiler/output-targets/dist-collection/index.ts +++ b/src/compiler/output-targets/dist-collection/index.ts @@ -30,7 +30,7 @@ export const outputCollection = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - changedModuleFiles: d.Module[] + changedModuleFiles: d.Module[], ): Promise => { const outputTargets = config.outputTargets.filter(isOutputTargetDistCollection); if (outputTargets.length === 0) { @@ -75,9 +75,9 @@ export const outputCollection = async ( const sourceMapOutputFilePath = join(target.collectionDir, relativeSourceMapPath); await compilerCtx.fs.writeFile(sourceMapOutputFilePath, mapCode, { outputTargetType: target.type }); } - }) + }), ); - }) + }), ); await writeCollectionManifests(config, compilerCtx, buildCtx, outputTargets); @@ -92,7 +92,7 @@ const writeCollectionManifests = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTargets: d.OutputTargetDistCollection[] + outputTargets: d.OutputTargetDistCollection[], ) => { const collectionData = JSON.stringify(serializeCollectionManifest(config, compilerCtx, buildCtx), null, 2); return Promise.all(outputTargets.map((o) => writeCollectionManifest(compilerCtx, collectionData, o))); @@ -106,7 +106,7 @@ const writeCollectionManifests = async ( const writeCollectionManifest = async ( compilerCtx: d.CompilerCtx, collectionData: string, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ) => { // get the absolute path to the directory where the collection will be saved const { collectionDir } = outputTarget; diff --git a/src/compiler/output-targets/dist-custom-elements/custom-elements-build-conditionals.ts b/src/compiler/output-targets/dist-custom-elements/custom-elements-build-conditionals.ts index 358d94d2518..223d94491b8 100644 --- a/src/compiler/output-targets/dist-custom-elements/custom-elements-build-conditionals.ts +++ b/src/compiler/output-targets/dist-custom-elements/custom-elements-build-conditionals.ts @@ -11,7 +11,7 @@ import { getBuildFeatures, updateBuildConditionals } from '../../app-core/app-da */ export const getCustomElementsBuildConditionals = ( config: d.ValidatedConfig, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): d.BuildConditionals => { // because custom elements bundling does not customize the build conditionals by default // then the default in "import { BUILD, NAMESPACE } from '@stencil/core/internal/app-data'" diff --git a/src/compiler/output-targets/dist-custom-elements/custom-elements-types.ts b/src/compiler/output-targets/dist-custom-elements/custom-elements-types.ts index 773d33e91e5..679700ff321 100644 --- a/src/compiler/output-targets/dist-custom-elements/custom-elements-types.ts +++ b/src/compiler/output-targets/dist-custom-elements/custom-elements-types.ts @@ -15,14 +15,14 @@ export const generateCustomElementsTypes = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - typesDir: string + typesDir: string, ): Promise => { const outputTargets = config.outputTargets.filter(isOutputTargetDistCustomElements); await Promise.all( outputTargets.map((outputTarget) => - generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, typesDir, outputTarget) - ) + generateCustomElementsTypesOutput(config, compilerCtx, buildCtx, typesDir, outputTarget), + ), ); }; @@ -40,7 +40,7 @@ const generateCustomElementsTypesOutput = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, typesDir: string, - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ) => { const isBarrelExport = outputTarget.customElementsExportBehavior === 'single-export-module'; const isBundleExport = outputTarget.customElementsExportBehavior === 'bundle'; @@ -166,7 +166,7 @@ const generateCustomElementsTypesOutput = async ( const fileName = `${cmp.tagName}.d.ts`; const filePath = join(outputTarget.dir!, fileName); await compilerCtx.fs.writeFile(filePath, dtsCode, { outputTargetType: outputTarget.type }); - }) + }), ); }; diff --git a/src/compiler/output-targets/dist-custom-elements/index.ts b/src/compiler/output-targets/dist-custom-elements/index.ts index 4403f6bc3e3..73403269a75 100644 --- a/src/compiler/output-targets/dist-custom-elements/index.ts +++ b/src/compiler/output-targets/dist-custom-elements/index.ts @@ -38,7 +38,7 @@ import { getCustomElementsBuildConditionals } from './custom-elements-build-cond export const outputCustomElements = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { if (!config.buildDist) { return; @@ -71,7 +71,7 @@ export const getBundleOptions = ( config: d.ValidatedConfig, buildCtx: d.BuildCtx, compilerCtx: d.CompilerCtx, - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ): BundleOptions => ({ id: 'customElements', platform: 'client', @@ -106,7 +106,7 @@ export const bundleCustomElements = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ) => { try { const bundleOpts = getBundleOptions(config, buildCtx, compilerCtx, outputTarget); @@ -185,7 +185,7 @@ export const bundleCustomElements = async ( export const addCustomElementInputs = ( buildCtx: d.BuildCtx, bundleOpts: BundleOptions, - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ): void => { const components = buildCtx.components; // An array to store the imports of these modules that we're going to add to our entry chunk @@ -210,7 +210,7 @@ export const addCustomElementInputs = ( } else { // the `importName` may collide with the `exportName`, alias it just in case it does with `importAs` exp.push( - `import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';` + `import { ${importName} as ${importAs}, defineCustomElement as cmpDefCustomEle } from '${cmp.sourceFilePath}';`, ); exp.push(`export const ${exportName} = ${importAs};`); exp.push(`export const defineCustomElement = cmpDefCustomEle;`); @@ -222,7 +222,7 @@ export const addCustomElementInputs = ( // `cmp.sourceFilePath`, we would end up with duplicated modules in our // output. indexExports.push( - `export { ${exportName}, defineCustomElement as defineCustomElement${exportName} } from '${coreKey}';` + `export { ${exportName}, defineCustomElement as defineCustomElement${exportName} } from '${coreKey}';`, ); } @@ -249,7 +249,7 @@ export const generateEntryPoint = ( outputTarget: d.OutputTargetDistCustomElements, cmpImports: string[] = [], cmpExports: string[] = [], - cmpNames: string[] = [] + cmpNames: string[] = [], ): string => { const body: string[] = []; const imports: string[] = []; @@ -258,7 +258,7 @@ export const generateEntryPoint = ( // Exports that are always present exports.push( `export { setAssetPath, setNonce, setPlatformOptions } from '${STENCIL_INTERNAL_CLIENT_ID}';`, - `export * from '${USER_INDEX_ENTRY_ID}';` + `export * from '${USER_INDEX_ENTRY_ID}';`, ); // Content related to global scripts @@ -281,7 +281,7 @@ export const generateEntryPoint = ( ' }', ' });', ' }', - '};' + '};', ); } @@ -319,7 +319,7 @@ const getCustomBeforeTransformers = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, components: d.ComponentCompilerMeta[], - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ): ts.TransformerFactory[] => { const transformOpts: d.TransformOptions = { coreImportPath: STENCIL_INTERNAL_CLIENT_ID, @@ -342,7 +342,7 @@ const getCustomBeforeTransformers = ( customBeforeTransformers.push( nativeComponentTransform(compilerCtx, transformOpts), proxyCustomElement(compilerCtx, transformOpts), - removeCollectionImports(compilerCtx) + removeCollectionImports(compilerCtx), ); return customBeforeTransformers; }; diff --git a/src/compiler/output-targets/dist-hydrate-script/bundle-hydrate-factory.ts b/src/compiler/output-targets/dist-hydrate-script/bundle-hydrate-factory.ts index 55042b51eb2..a1f3c22e5e0 100644 --- a/src/compiler/output-targets/dist-hydrate-script/bundle-hydrate-factory.ts +++ b/src/compiler/output-targets/dist-hydrate-script/bundle-hydrate-factory.ts @@ -16,7 +16,7 @@ export const bundleHydrateFactory = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, _build: d.BuildConditionals, - appFactoryEntryCode: string + appFactoryEntryCode: string, ) => { try { const bundleOpts: BundleOptions = { @@ -56,7 +56,7 @@ export const bundleHydrateFactory = async ( */ const getCustomBeforeTransformers = ( config: d.ValidatedConfig, - compilerCtx: d.CompilerCtx + compilerCtx: d.CompilerCtx, ): ts.TransformerFactory[] => { const transformOpts: d.TransformOptions = { coreImportPath: STENCIL_INTERNAL_HYDRATE_ID, @@ -75,7 +75,7 @@ const getCustomBeforeTransformers = ( customBeforeTransformers.push( hydrateComponentTransform(compilerCtx, transformOpts), - removeCollectionImports(compilerCtx) + removeCollectionImports(compilerCtx), ); return customBeforeTransformers; }; diff --git a/src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts b/src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts index 4361b0209a6..b39b191557c 100644 --- a/src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts +++ b/src/compiler/output-targets/dist-hydrate-script/generate-hydrate-app.ts @@ -20,7 +20,7 @@ export const generateHydrateApp = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTargets: d.OutputTargetHydrate[] + outputTargets: d.OutputTargetHydrate[], ) => { try { const packageDir = join(config.sys.getCompilerExecutingPath(), '..', '..'); diff --git a/src/compiler/output-targets/dist-hydrate-script/index.ts b/src/compiler/output-targets/dist-hydrate-script/index.ts index effc9f4ddbb..a51d6593dad 100644 --- a/src/compiler/output-targets/dist-hydrate-script/index.ts +++ b/src/compiler/output-targets/dist-hydrate-script/index.ts @@ -6,7 +6,7 @@ import { generateHydrateApp } from './generate-hydrate-app'; export const outputHydrateScript = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ) => { const hydrateOutputTargets = config.outputTargets.filter(isOutputTargetHydrate); if (hydrateOutputTargets.length > 0) { diff --git a/src/compiler/output-targets/dist-hydrate-script/write-hydrate-outputs.ts b/src/compiler/output-targets/dist-hydrate-script/write-hydrate-outputs.ts index 3fb5f381eff..0383a9e1a57 100644 --- a/src/compiler/output-targets/dist-hydrate-script/write-hydrate-outputs.ts +++ b/src/compiler/output-targets/dist-hydrate-script/write-hydrate-outputs.ts @@ -9,12 +9,12 @@ export const writeHydrateOutputs = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, outputTargets: d.OutputTargetHydrate[], - rollupOutput: RollupOutput + rollupOutput: RollupOutput, ) => { return Promise.all( outputTargets.map((outputTarget) => { return writeHydrateOutput(config, compilerCtx, buildCtx, outputTarget, rollupOutput); - }) + }), ); }; @@ -23,7 +23,7 @@ const writeHydrateOutput = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, outputTarget: d.OutputTargetHydrate, - rollupOutput: RollupOutput + rollupOutput: RollupOutput, ) => { const hydratePackageName = await getHydratePackageName(config, compilerCtx); @@ -37,7 +37,7 @@ const writeHydrateOutput = async ( config, hydrateCoreIndexPath, hydrateCoreIndexDtsFilePath, - hydratePackageName + hydratePackageName, ); await Promise.all([ @@ -55,7 +55,7 @@ const writeHydrateOutput = async ( const filePath = join(hydrateAppDirPath, output.fileName); await compilerCtx.fs.writeFile(filePath, output.code, { immediateWrite: true }); } - }) + }), ); }; @@ -63,7 +63,7 @@ const getHydratePackageJson = ( config: d.ValidatedConfig, hydrateAppFilePath: string, hydrateDtsFilePath: string, - hydratePackageName: string + hydratePackageName: string, ) => { const pkg: d.PackageJsonData = { name: hydratePackageName, @@ -88,7 +88,7 @@ const getHydratePackageName = async (config: d.ValidatedConfig, compilerCtx: d.C const copyHydrateRunnerDts = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - hydrateAppDirPath: string + hydrateAppDirPath: string, ) => { const packageDir = join(config.sys.getCompilerExecutingPath(), '..', '..'); const srcHydrateDir = join(packageDir, 'internal', 'hydrate', 'runner.d.ts'); diff --git a/src/compiler/output-targets/dist-lazy/generate-cjs.ts b/src/compiler/output-targets/dist-lazy/generate-cjs.ts index 6be00932581..a568d2a459a 100644 --- a/src/compiler/output-targets/dist-lazy/generate-cjs.ts +++ b/src/compiler/output-targets/dist-lazy/generate-cjs.ts @@ -11,7 +11,7 @@ export const generateCjs = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, rollupBuild: RollupBuild, - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const cjsOutputs = outputTargets.filter((o) => !!o.cjsDir); @@ -38,7 +38,7 @@ export const generateCjs = async ( results, 'es2017', false, - '.cjs' + '.cjs', ); await generateShortcuts(compilerCtx, results, cjsOutputs); @@ -51,7 +51,7 @@ export const generateCjs = async ( const generateShortcuts = ( compilerCtx: d.CompilerCtx, rollupResult: d.RollupResult[], - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const indexFilename = rollupResult.find((r) => r.type === 'chunk' && r.isIndex).fileName; return Promise.all( @@ -62,6 +62,6 @@ const generateShortcuts = ( const shortcutContent = `module.exports = require('${relativePath}');\n`; await compilerCtx.fs.writeFile(o.cjsIndexFile, shortcutContent, { outputTargetType: o.type }); } - }) + }), ); }; diff --git a/src/compiler/output-targets/dist-lazy/generate-esm-browser.ts b/src/compiler/output-targets/dist-lazy/generate-esm-browser.ts index 16c0f7371eb..c20f19e1051 100644 --- a/src/compiler/output-targets/dist-lazy/generate-esm-browser.ts +++ b/src/compiler/output-targets/dist-lazy/generate-esm-browser.ts @@ -10,7 +10,7 @@ export const generateEsmBrowser = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, rollupBuild: RollupBuild, - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const esmOutputs = outputTargets.filter((o) => !!o.esmDir && !!o.isBrowserBuild); if (esmOutputs.length) { @@ -38,7 +38,7 @@ export const generateEsmBrowser = async ( output, 'es2017', true, - '' + '', ); } } diff --git a/src/compiler/output-targets/dist-lazy/generate-esm.ts b/src/compiler/output-targets/dist-lazy/generate-esm.ts index 6827dd6973b..57570672955 100644 --- a/src/compiler/output-targets/dist-lazy/generate-esm.ts +++ b/src/compiler/output-targets/dist-lazy/generate-esm.ts @@ -12,7 +12,7 @@ export const generateEsm = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, rollupBuild: RollupBuild, - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const esmEs5Outputs = config.buildEs5 ? outputTargets.filter((o) => !!o.esmEs5Dir && !o.isBrowserBuild) : []; const esmOutputs = outputTargets.filter((o) => !!o.esmDir && !o.isBrowserBuild); @@ -39,7 +39,7 @@ export const generateEsm = async ( output, 'es2017', false, - '' + '', ); const es5destinations = esmEs5Outputs.map((o) => o.esmEs5Dir); @@ -52,7 +52,7 @@ export const generateEsm = async ( output, 'es5', false, - '' + '', ); await copyPolyfills(config, compilerCtx, esmOutputs); @@ -66,7 +66,7 @@ export const generateEsm = async ( const copyPolyfills = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const destinations = outputTargets.filter((o) => o.polyfills).map((o) => o.esmDir); if (destinations.length === 0) { @@ -81,9 +81,9 @@ const copyPolyfills = async ( return Promise.all( files.map((f) => { return compilerCtx.fs.copyFile(f.absPath, join(dest, 'polyfills', f.relPath)); - }) + }), ); - }) + }), ); }; @@ -91,7 +91,7 @@ const generateShortcuts = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, outputTargets: d.OutputTargetDistLazy[], - rollupResult: RollupResult[] + rollupResult: RollupResult[], ): Promise => { const indexFilename = rollupResult.find((r) => r.type === 'chunk' && r.isIndex).fileName; @@ -105,6 +105,6 @@ const generateShortcuts = ( const shortcutContent = `export * from '${relativePath}';`; await compilerCtx.fs.writeFile(o.esmIndexFile, shortcutContent, { outputTargetType: o.type }); } - }) + }), ); }; diff --git a/src/compiler/output-targets/dist-lazy/generate-lazy-module.ts b/src/compiler/output-targets/dist-lazy/generate-lazy-module.ts index d90d29125ed..0875d1c60cf 100644 --- a/src/compiler/output-targets/dist-lazy/generate-lazy-module.ts +++ b/src/compiler/output-targets/dist-lazy/generate-lazy-module.ts @@ -21,7 +21,7 @@ export const generateLazyModules = async ( results: d.RollupResult[], sourceTarget: d.SourceTarget, isBrowserBuild: boolean, - sufix: string + sufix: string, ): Promise => { if (!Array.isArray(destinations) || destinations.length === 0) { return []; @@ -43,9 +43,9 @@ export const generateLazyModules = async ( sourceTarget, shouldMinify, isBrowserBuild, - sufix + sufix, ); - }) + }), ); if ((!!config.extras?.experimentalImportInjection || !!config.extras?.enableImportInjection) && !isBrowserBuild) { @@ -63,9 +63,9 @@ export const generateLazyModules = async ( destinations, sourceTarget, shouldMinify, - isBrowserBuild + isBrowserBuild, ); - }) + }), ); const lazyRuntimeData = formatLazyBundlesRuntimeMeta(bundleModules); @@ -82,9 +82,9 @@ export const generateLazyModules = async ( lazyRuntimeData, sourceTarget, shouldMinify, - isBrowserBuild + isBrowserBuild, ); - }) + }), ); await Promise.all( @@ -94,9 +94,9 @@ export const generateLazyModules = async ( return Promise.all( destinations.map((dest) => { return compilerCtx.fs.writeFile(join(dest, r.fileName), r.content); - }) + }), ); - }) + }), ); return bundleModules; @@ -123,7 +123,7 @@ const addStaticImports = (rollupChunkResults: d.RollupChunkResult[], bundleModul switch(bundleId) { ${bundleModules.map((mod) => generateCjs(mod.output.bundleId)).join('')} } - }` + }`, ); }); }; @@ -190,7 +190,7 @@ const generateLazyEntryModule = async ( sourceTarget: d.SourceTarget, shouldMinify: boolean, isBrowserBuild: boolean, - sufix: string + sufix: string, ): Promise => { const entryModule = buildCtx.entryModules.find((entryModule) => entryModule.entryKey === rollupResult.entryKey); const shouldHash = config.hashFileNames && isBrowserBuild; @@ -204,7 +204,7 @@ const generateLazyEntryModule = async ( false, isBrowserBuild, rollupResult.code, - rollupResult.map + rollupResult.map, ); const output = await writeLazyModule( @@ -216,7 +216,7 @@ const generateLazyEntryModule = async ( shouldHash, code, sourceMap, - sufix + sufix, ); return { @@ -236,7 +236,7 @@ const writeLazyChunk = async ( destinations: string[], sourceTarget: d.SourceTarget, shouldMinify: boolean, - isBrowserBuild: boolean + isBrowserBuild: boolean, ) => { const { code, sourceMap } = await convertChunk( config, @@ -247,7 +247,7 @@ const writeLazyChunk = async ( rollupResult.isCore, isBrowserBuild, rollupResult.code, - rollupResult.map + rollupResult.map, ); await Promise.all( @@ -259,7 +259,7 @@ const writeLazyChunk = async ( compilerCtx.fs.writeFile(filePath + '.map', JSON.stringify(sourceMap), { outputTargetType }); } compilerCtx.fs.writeFile(filePath, fileCode, { outputTargetType }); - }) + }), ); }; @@ -273,7 +273,7 @@ const writeLazyEntry = async ( lazyRuntimeData: string, sourceTarget: d.SourceTarget, shouldMinify: boolean, - isBrowserBuild: boolean + isBrowserBuild: boolean, ): Promise => { if (isBrowserBuild && ['loader'].includes(rollupResult.entryKey)) { return; @@ -288,7 +288,7 @@ const writeLazyEntry = async ( false, isBrowserBuild, inputCode, - rollupResult.map + rollupResult.map, ); await Promise.all( @@ -300,7 +300,7 @@ const writeLazyEntry = async ( compilerCtx.fs.writeFile(filePath + '.map', JSON.stringify(sourceMap), { outputTargetType }); } return compilerCtx.fs.writeFile(filePath, fileCode, { outputTargetType }); - }) + }), ); }; @@ -407,7 +407,7 @@ const convertChunk = async ( isCore: boolean, isBrowserBuild: boolean, code: string, - rollupSrcMap: RollupSourceMap + rollupSrcMap: RollupSourceMap, ) => { let sourceMap = rollupToStencilSourceMap(rollupSrcMap); const inlineHelpers = isBrowserBuild || !hasDependency(buildCtx, 'tslib'); diff --git a/src/compiler/output-targets/dist-lazy/generate-system.ts b/src/compiler/output-targets/dist-lazy/generate-system.ts index ac22cc83301..c084644a8ac 100644 --- a/src/compiler/output-targets/dist-lazy/generate-system.ts +++ b/src/compiler/output-targets/dist-lazy/generate-system.ts @@ -12,7 +12,7 @@ export const generateSystem = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, rollupBuild: RollupBuild, - outputTargets: d.OutputTargetDistLazy[] + outputTargets: d.OutputTargetDistLazy[], ): Promise => { const systemOutputs = outputTargets.filter((o) => !!o.systemDir); @@ -38,7 +38,7 @@ export const generateSystem = async ( results, 'es5', true, - '.system' + '.system', ); await generateSystemLoaders(config, compilerCtx, results, systemOutputs); @@ -52,7 +52,7 @@ const generateSystemLoaders = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, rollupResult: d.RollupResult[], - systemOutputs: d.OutputTargetDistLazy[] + systemOutputs: d.OutputTargetDistLazy[], ): Promise => { const loaderFilename = rollupResult.find((r) => r.type === 'chunk' && r.isBrowserLoader).fileName; @@ -63,7 +63,7 @@ const writeSystemLoader = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, loaderFilename: string, - outputTarget: d.OutputTargetDistLazy + outputTarget: d.OutputTargetDistLazy, ): Promise => { if (outputTarget.systemLoaderFile) { const entryPointPath = join(outputTarget.systemDir, loaderFilename); @@ -79,7 +79,7 @@ const getSystemLoader = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, corePath: string, - includePolyfills: boolean + includePolyfills: boolean, ): Promise => { const polyfills = includePolyfills ? await getAppBrowserCorePolyfills(config, compilerCtx) diff --git a/src/compiler/output-targets/dist-lazy/lazy-build-conditionals.ts b/src/compiler/output-targets/dist-lazy/lazy-build-conditionals.ts index 14e5fcc5e99..cfeaca58b6d 100644 --- a/src/compiler/output-targets/dist-lazy/lazy-build-conditionals.ts +++ b/src/compiler/output-targets/dist-lazy/lazy-build-conditionals.ts @@ -5,7 +5,7 @@ import { getBuildFeatures, updateBuildConditionals } from '../../app-core/app-da export const getLazyBuildConditionals = ( config: d.ValidatedConfig, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): d.BuildConditionals => { const build = getBuildFeatures(cmps) as d.BuildConditionals; diff --git a/src/compiler/output-targets/dist-lazy/lazy-output.ts b/src/compiler/output-targets/dist-lazy/lazy-output.ts index fd092420530..076ddff0aba 100644 --- a/src/compiler/output-targets/dist-lazy/lazy-output.ts +++ b/src/compiler/output-targets/dist-lazy/lazy-output.ts @@ -28,7 +28,7 @@ import { getLazyBuildConditionals } from './lazy-build-conditionals'; export const outputLazy = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { const outputTargets = config.outputTargets.filter(isOutputTargetDistLazy); if (outputTargets.length === 0) { @@ -109,7 +109,7 @@ export const outputLazy = async ( */ const getCustomBeforeTransformers = ( config: d.ValidatedConfig, - compilerCtx: d.CompilerCtx + compilerCtx: d.CompilerCtx, ): ts.TransformerFactory[] => { const transformOpts: d.TransformOptions = { coreImportPath: STENCIL_CORE_ID, @@ -128,7 +128,7 @@ const getCustomBeforeTransformers = ( customBeforeTransformers.push( lazyComponentTransform(compilerCtx, transformOpts), - removeCollectionImports(compilerCtx) + removeCollectionImports(compilerCtx), ); return customBeforeTransformers; }; diff --git a/src/compiler/output-targets/dist-lazy/write-lazy-entry-module.ts b/src/compiler/output-targets/dist-lazy/write-lazy-entry-module.ts index 889bee43d37..dae558ad50c 100644 --- a/src/compiler/output-targets/dist-lazy/write-lazy-entry-module.ts +++ b/src/compiler/output-targets/dist-lazy/write-lazy-entry-module.ts @@ -12,7 +12,7 @@ export const writeLazyModule = async ( shouldHash: boolean, code: string, sourceMap: d.SourceMap, - sufix: string + sufix: string, ): Promise => { // code = replaceStylePlaceholders(entryModule.cmps, modeName, code); @@ -29,7 +29,7 @@ export const writeLazyModule = async ( if (!!sourceMap) { compilerCtx.fs.writeFile(join(dst, fileName) + '.map', JSON.stringify(sourceMap), { outputTargetType }); } - }) + }), ); return { @@ -44,7 +44,7 @@ const getBundleId = async ( entryKey: string, shouldHash: boolean, code: string, - sufix: string + sufix: string, ): Promise => { if (shouldHash) { const hash = await config.sys.generateContentHash(code, config.hashedFileNameLength); diff --git a/src/compiler/output-targets/empty-dir.ts b/src/compiler/output-targets/empty-dir.ts index 5a16647a344..25a5da21f4f 100644 --- a/src/compiler/output-targets/empty-dir.ts +++ b/src/compiler/output-targets/empty-dir.ts @@ -27,7 +27,7 @@ const isEmptable = (o: d.OutputTarget): o is OutputTargetEmptiable => export const emptyOutputTargets = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ) => { if (buildCtx.isRebuild) { return; diff --git a/src/compiler/output-targets/index.ts b/src/compiler/output-targets/index.ts index 10d67cc873f..1911f493866 100644 --- a/src/compiler/output-targets/index.ts +++ b/src/compiler/output-targets/index.ts @@ -14,7 +14,7 @@ import { outputWww } from './output-www'; export const generateOutputTargets = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ) => { const timeSpan = buildCtx.createTimeSpan('generate outputs started', true); diff --git a/src/compiler/output-targets/output-custom.ts b/src/compiler/output-targets/output-custom.ts index ba2a0238385..2fe17c622cc 100644 --- a/src/compiler/output-targets/output-custom.ts +++ b/src/compiler/output-targets/output-custom.ts @@ -7,7 +7,7 @@ export const outputCustom = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, docs: d.JsonDocs, - outputTargets: d.OutputTarget[] + outputTargets: d.OutputTarget[], ) => { const customOutputTargets = outputTargets.filter(isOutputTargetCustom); if (customOutputTargets.length === 0) { @@ -23,6 +23,6 @@ export const outputCustom = async ( catchError(buildCtx.diagnostics, e); } timespan.finish(`generate ${o.name} finished`); - }) + }), ); }; diff --git a/src/compiler/output-targets/output-docs.ts b/src/compiler/output-targets/output-docs.ts index 744d457d7a1..b01d7bd451b 100644 --- a/src/compiler/output-targets/output-docs.ts +++ b/src/compiler/output-targets/output-docs.ts @@ -23,7 +23,7 @@ import { outputCustom } from './output-custom'; export const outputDocs = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { if (!config.buildDocs) { return; @@ -34,7 +34,7 @@ export const outputDocs = async ( isOutputTargetDocsReadme(o) || isOutputTargetDocsJson(o) || isOutputTargetDocsCustom(o) || - isOutputTargetDocsVscode(o) + isOutputTargetDocsVscode(o), ); if (docsOutputTargets.length === 0) { diff --git a/src/compiler/output-targets/output-lazy-loader.ts b/src/compiler/output-targets/output-lazy-loader.ts index 409293097e5..f30ca3de43d 100644 --- a/src/compiler/output-targets/output-lazy-loader.ts +++ b/src/compiler/output-targets/output-lazy-loader.ts @@ -15,7 +15,7 @@ export const outputLazyLoader = async (config: d.ValidatedConfig, compilerCtx: d const generateLoader = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - outputTarget: d.OutputTargetDistLazyLoader + outputTarget: d.OutputTargetDistLazyLoader, ) => { const loaderPath = outputTarget.dir; const es2017Dir = outputTarget.esmDir; @@ -41,7 +41,7 @@ const generateLoader = async ( unpkg: './cdn.js', }, null, - 2 + 2, ); const es5EntryPoint = join(es5Dir, 'loader.js'); diff --git a/src/compiler/output-targets/output-service-workers.ts b/src/compiler/output-targets/output-service-workers.ts index 12e460ba7fe..619fb138ec2 100644 --- a/src/compiler/output-targets/output-service-workers.ts +++ b/src/compiler/output-targets/output-service-workers.ts @@ -26,7 +26,7 @@ export const outputServiceWorkers = async (config: d.ValidatedConfig, buildCtx: const workbox: d.Workbox = config.sys.lazyRequire.require(config.rootDir, 'workbox-build'); await Promise.all( - wwwServiceOutputs.map((outputTarget) => generateServiceWorker(config, buildCtx, workbox, outputTarget)) + wwwServiceOutputs.map((outputTarget) => generateServiceWorker(config, buildCtx, workbox, outputTarget)), ); } }; diff --git a/src/compiler/output-targets/output-types.ts b/src/compiler/output-targets/output-types.ts index 0945ba58bbc..49a5697a702 100644 --- a/src/compiler/output-targets/output-types.ts +++ b/src/compiler/output-targets/output-types.ts @@ -12,7 +12,7 @@ import { generateTypes } from '../types/generate-types'; export const outputTypes = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { const outputTargets = config.outputTargets.filter(isOutputTargetDistTypes); if (outputTargets.length === 0) { diff --git a/src/compiler/output-targets/output-www.ts b/src/compiler/output-targets/output-www.ts index c8885386e68..8409ae7d9db 100644 --- a/src/compiler/output-targets/output-www.ts +++ b/src/compiler/output-targets/output-www.ts @@ -25,7 +25,7 @@ export const outputWww = async (config: d.ValidatedConfig, compilerCtx: d.Compil const criticalBundles = getCriticalPath(buildCtx); await Promise.all( - outputTargets.map((outputTarget) => generateWww(config, compilerCtx, buildCtx, criticalBundles, outputTarget)) + outputTargets.map((outputTarget) => generateWww(config, compilerCtx, buildCtx, criticalBundles, outputTarget)), ); timespan.finish(`generate www finished`); @@ -40,8 +40,8 @@ const getCriticalPath = (buildCtx: d.BuildCtx) => { flatOne( getUsedComponents(buildCtx.indexDoc, buildCtx.components) .map((tagName) => getScopeId(tagName)) - .map((scopeId) => buildCtx.componentGraph.get(scopeId) || []) - ) + .map((scopeId) => buildCtx.componentGraph.get(scopeId) || []), + ), ).sort(); }; @@ -50,7 +50,7 @@ const generateWww = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, criticalPath: string[], - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { if (!config.buildEs5) { await generateEs5DisabledMessage(config, compilerCtx, outputTarget); @@ -84,7 +84,7 @@ const generateHostConfig = (compilerCtx: d.CompilerCtx, outputTarget: d.OutputTa }, }, null, - ' ' + ' ', ); return compilerCtx.fs.writeFile(hostConfigPath, hostConfigContent, { outputTargetType: outputTarget.type }); @@ -95,7 +95,7 @@ const generateIndexHtml = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, criticalPath: string[], - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { if (compilerCtx.hasSuccessfulBuild && !buildCtx.hasHtmlChanges) { // no need to rebuild index.html if there were no app file changes @@ -113,7 +113,7 @@ const generateIndexHtml = async ( const globalStylesFilename = await generateHashedCopy( config, compilerCtx, - join(outputTarget.buildDir, `${config.fsNamespace}.css`) + join(outputTarget.buildDir, `${config.fsNamespace}.css`), ); const scriptFound = await optimizeEsmImport(config, compilerCtx, doc, outputTarget); await inlineStyleSheets(compilerCtx, doc, MAX_CSS_INLINE_SIZE, outputTarget); diff --git a/src/compiler/output-targets/test/output-targets-collection.spec.ts b/src/compiler/output-targets/test/output-targets-collection.spec.ts index da1185d23fc..95d00e6bfce 100644 --- a/src/compiler/output-targets/test/output-targets-collection.spec.ts +++ b/src/compiler/output-targets/test/output-targets-collection.spec.ts @@ -67,7 +67,7 @@ describe('Dist Collection output target', () => { type: 'dist-collection', }); expect(mapImportPathSpy).toHaveBeenCalledTimes(1); - } + }, ); }); }); diff --git a/src/compiler/output-targets/test/output-targets-dist-custom-elements.spec.ts b/src/compiler/output-targets/test/output-targets-dist-custom-elements.spec.ts index 231e4716a73..16a9f1cc42e 100644 --- a/src/compiler/output-targets/test/output-targets-dist-custom-elements.spec.ts +++ b/src/compiler/output-targets/test/output-targets-dist-custom-elements.spec.ts @@ -61,7 +61,7 @@ describe('Custom Elements output target', () => { config.outputTargets = outputTargets; await outputCustomElements(config, compilerCtx, buildCtx); expect(bundleCustomElementsSpy).not.toHaveBeenCalled(); - } + }, ); describe('generateEntryPoint', () => { @@ -159,7 +159,7 @@ export * from '${USER_INDEX_ENTRY_ID}'; config, buildCtx, compilerCtx, - config.outputTargets[0] as OutputTargetDistCustomElements + config.outputTargets[0] as OutputTargetDistCustomElements, ); addCustomElementInputs(buildCtx, bundleOptions, config.outputTargets[0] as OutputTargetDistCustomElements); expect(bundleOptions.loader['\0core']).toEqual( @@ -168,7 +168,7 @@ export { setAssetPath, setNonce, setPlatformOptions } from '${STENCIL_INTERNAL_C export * from '${USER_INDEX_ENTRY_ID}'; globalScripts(); -` +`, ); }); }); @@ -192,7 +192,7 @@ globalScripts(); config, buildCtx, compilerCtx, - config.outputTargets[0] as OutputTargetDistCustomElements + config.outputTargets[0] as OutputTargetDistCustomElements, ); addCustomElementInputs(buildCtx, bundleOptions, config.outputTargets[0] as OutputTargetDistCustomElements); expect(bundleOptions.loader['\0core']).toEqual( @@ -203,7 +203,7 @@ export { StubCmp, defineCustomElement as defineCustomElementStubCmp } from '\0St export { MyBestComponent, defineCustomElement as defineCustomElementMyBestComponent } from '\0MyBestComponent'; globalScripts(); -` +`, ); }); @@ -219,7 +219,7 @@ globalScripts(); config, buildCtx, compilerCtx, - config.outputTargets[0] as OutputTargetDistCustomElements + config.outputTargets[0] as OutputTargetDistCustomElements, ); addCustomElementInputs(buildCtx, bundleOptions, config.outputTargets[0] as OutputTargetDistCustomElements); expect(bundleOptions.loader['\0core']).toEqual( @@ -229,7 +229,7 @@ export * from '${USER_INDEX_ENTRY_ID}'; export { ComponentWithJsx, defineCustomElement as defineCustomElementComponentWithJsx } from '\0ComponentWithJsx'; globalScripts(); -` +`, ); }); }); @@ -252,7 +252,7 @@ globalScripts(); config, buildCtx, compilerCtx, - config.outputTargets[0] as OutputTargetDistCustomElements + config.outputTargets[0] as OutputTargetDistCustomElements, ); addCustomElementInputs(buildCtx, bundleOptions, config.outputTargets[0] as OutputTargetDistCustomElements); expect(bundleOptions.loader['\0core']).toEqual( @@ -275,7 +275,7 @@ export const defineCustomElements = (opts) => { }); } }; -` +`, ); }); }); diff --git a/src/compiler/output-targets/test/output-targets-dist.spec.ts b/src/compiler/output-targets/test/output-targets-dist.spec.ts index 9b1bf6ce3dc..c718750ab85 100644 --- a/src/compiler/output-targets/test/output-targets-dist.spec.ts +++ b/src/compiler/output-targets/test/output-targets-dist.spec.ts @@ -47,7 +47,7 @@ describe.skip('outputTarget, dist', () => { 'User', 'testing', 'src', - 'global.ts' + 'global.ts', )]: `export default function() { console.log('my global'); }`, }); await compiler.fs.commit(); diff --git a/src/compiler/output-targets/test/output-targets-www-dist.spec.ts b/src/compiler/output-targets/test/output-targets-www-dist.spec.ts index f54da155e41..5117c857d07 100644 --- a/src/compiler/output-targets/test/output-targets-www-dist.spec.ts +++ b/src/compiler/output-targets/test/output-targets-www-dist.spec.ts @@ -55,7 +55,7 @@ describe.skip('outputTarget, www / dist / docs', () => { 'testing', 'src', 'components', - 'cmp-a.tsx' + 'cmp-a.tsx', )]: `@Component({ tag: 'cmp-a' }) export class CmpA {}`, }); await compiler.fs.commit(); diff --git a/src/compiler/output-targets/test/output-targets-www.spec.ts b/src/compiler/output-targets/test/output-targets-www.spec.ts index daba3a1e43f..ff700f5aee7 100644 --- a/src/compiler/output-targets/test/output-targets-www.spec.ts +++ b/src/compiler/output-targets/test/output-targets-www.spec.ts @@ -28,7 +28,7 @@ describe.skip('outputTarget, www', () => { 'testing', 'src', 'components', - 'cmp-a.tsx' + 'cmp-a.tsx', )]: `@Component({ tag: 'cmp-a' }) export class CmpA {}`, }); await compiler.fs.commit(); diff --git a/src/compiler/plugin/plugin.ts b/src/compiler/plugin/plugin.ts index 5f288992241..023be394778 100644 --- a/src/compiler/plugin/plugin.ts +++ b/src/compiler/plugin/plugin.ts @@ -62,7 +62,7 @@ export const runPluginTransforms = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, id: string, - cmp?: d.ComponentCompilerMeta + cmp?: d.ComponentCompilerMeta, ): Promise => { const pluginCtx: PluginCtx = { config: config, @@ -103,7 +103,7 @@ export const runPluginTransforms = async ( id, id, transformResults.code, - cmp.styleDocs + cmp.styleDocs, ); transformResults.code = cssParseResults.styleText; transformResults.dependencies = cssParseResults.imports; @@ -163,7 +163,7 @@ export const runPluginTransforms = async ( id, transformResults.id, transformResults.code, - cmp.styleDocs + cmp.styleDocs, ); transformResults.code = cssParseResults.styleText; transformResults.dependencies = cssParseResults.imports; @@ -174,7 +174,7 @@ export const runPluginTransforms = async ( buildCtx, id, transformResults.id, - transformResults.code + transformResults.code, ); transformResults.code = cssParseResults.styleText; transformResults.dependencies = cssParseResults.imports; @@ -189,7 +189,7 @@ export const runPluginTransformsEsmImports = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, code: string, - id: string + id: string, ) => { const pluginCtx: PluginCtx = { config: config, @@ -243,7 +243,7 @@ export const runPluginTransformsEsmImports = async ( } if (Array.isArray(pluginTransformResults.dependencies)) { const imports = pluginTransformResults.dependencies.filter( - (f) => !transformResults.dependencies.includes(f) + (f) => !transformResults.dependencies.includes(f), ); transformResults.dependencies.push(...imports); } @@ -270,7 +270,7 @@ export const runPluginTransformsEsmImports = async ( buildCtx, id, transformResults.id, - transformResults.code + transformResults.code, ); transformResults.code = cssParseResults.styleText; if (Array.isArray(cssParseResults.imports)) { diff --git a/src/compiler/plugin/test/plugin.spec.ts b/src/compiler/plugin/test/plugin.spec.ts index e27c01fa1a2..9abf278b6cd 100644 --- a/src/compiler/plugin/test/plugin.spec.ts +++ b/src/compiler/plugin/test/plugin.spec.ts @@ -40,7 +40,7 @@ describe.skip('plugin', () => { } `, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); @@ -74,7 +74,7 @@ describe.skip('plugin', () => { } `, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); @@ -116,7 +116,7 @@ describe.skip('plugin', () => { } `, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); @@ -160,7 +160,7 @@ describe.skip('plugin', () => { } `, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); diff --git a/src/compiler/prerender/crawl-urls.ts b/src/compiler/prerender/crawl-urls.ts index 30361ef5df9..ebccbeeef6b 100644 --- a/src/compiler/prerender/crawl-urls.ts +++ b/src/compiler/prerender/crawl-urls.ts @@ -7,7 +7,7 @@ export const crawlAnchorsForNextUrls = ( diagnostics: d.Diagnostic[], baseUrl: URL, currentUrl: URL, - parsedAnchors: d.HydrateAnchorElement[] + parsedAnchors: d.HydrateAnchorElement[], ) => { if (!Array.isArray(parsedAnchors) || parsedAnchors.length === 0) { return []; diff --git a/src/compiler/prerender/prerender-main.ts b/src/compiler/prerender/prerender-main.ts index 91f125ee0f7..612c4d0b492 100644 --- a/src/compiler/prerender/prerender-main.ts +++ b/src/compiler/prerender/prerender-main.ts @@ -27,7 +27,7 @@ const runPrerender = async ( hydrateAppFilePath: string, componentGraph: d.BuildResultsComponentGraph, srcIndexHtmlPath: string, - buildId: string + buildId: string, ) => { const startTime = Date.now(); const diagnostics: d.Diagnostic[] = []; @@ -98,9 +98,9 @@ const runPrerender = async ( hydrateAppFilePath, componentGraph, srcIndexHtmlPath, - outputTarget + outputTarget, ); - }) + }), ); } catch (e: any) { catchError(diagnostics, e); @@ -131,7 +131,7 @@ const runPrerenderOutputTarget = async ( hydrateAppFilePath: string, componentGraph: d.BuildResultsComponentGraph, srcIndexHtmlPath: string, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { try { const timeSpan = config.logger.createTimeSpan(`prerendering started`); @@ -192,7 +192,7 @@ const runPrerenderOutputTarget = async ( srcIndexHtmlPath, outputTarget, hydrateOpts, - manager + manager, ); if (diagnostics.length > 0 || !templateData || !isString(templateData.html)) { return; @@ -264,7 +264,7 @@ const createPrerenderTemplate = async (config: d.Config, templateHtml: string) = const createComponentGraphPath = async ( config: d.Config, componentGraph: d.BuildResultsComponentGraph, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ) => { if (componentGraph) { const content = getComponentPathContent(componentGraph, outputTarget); diff --git a/src/compiler/prerender/prerender-optimize.ts b/src/compiler/prerender/prerender-optimize.ts index 609aa6883e6..779c074c189 100644 --- a/src/compiler/prerender/prerender-optimize.ts +++ b/src/compiler/prerender/prerender-optimize.ts @@ -50,7 +50,7 @@ export const inlineExternalStyleSheets = async (sys: d.CompilerSystem, appDir: s // move to the end of doc.body.appendChild(link); } catch (e) {} - }) + }), ); }; @@ -94,7 +94,7 @@ export const minifyScriptElements = async (doc: Document, addMinifiedAttr: boole scriptElm.setAttribute(dataMinifiedAttr, ''); } } - }) + }), ); }; @@ -103,7 +103,7 @@ export const minifyStyleElements = async ( appDir: string, doc: Document, currentUrl: URL, - addMinifiedAttr: boolean + addMinifiedAttr: boolean, ) => { const styleElms = Array.from(doc.querySelectorAll('style')).filter((styleElm) => { if (styleElm.hasAttribute(dataMinifiedAttr)) { @@ -133,14 +133,14 @@ export const minifyStyleElements = async ( styleElm.setAttribute(dataMinifiedAttr, ''); } } - }) + }), ); }; export const excludeStaticComponents = ( doc: Document, hydrateOpts: d.PrerenderHydrateOptions, - hydrateResults: d.HydrateResults + hydrateResults: d.HydrateResults, ) => { const staticComponents = hydrateOpts.staticComponents.filter((tag) => { return hydrateResults.components.some((cmp) => cmp.tag === tag); @@ -175,7 +175,7 @@ export const addModulePreloads = ( doc: Document, hydrateOpts: d.PrerenderHydrateOptions, hydrateResults: d.HydrateResults, - componentGraph: Map + componentGraph: Map, ) => { if (!componentGraph) { return false; @@ -186,7 +186,7 @@ export const addModulePreloads = ( const cmpTags = hydrateResults.components.filter((cmp) => !staticComponents.includes(cmp.tag)); const modulePreloads = unique( - flatOne(cmpTags.map((cmp) => getScopeId(cmp.tag, cmp.mode)).map((scopeId) => componentGraph.get(scopeId) || [])) + flatOne(cmpTags.map((cmp) => getScopeId(cmp.tag, cmp.mode)).map((scopeId) => componentGraph.get(scopeId) || [])), ); injectModulePreloads(doc, modulePreloads); @@ -221,7 +221,7 @@ export const hashAssets = async ( hydrateOpts: d.PrerenderHydrateOptions, appDir: string, doc: Document, - currentUrl: URL + currentUrl: URL, ) => { // do one at a time to prevent too many opened files and memory usage issues // hash id is cached in each worker, so shouldn't have to do this for every page @@ -273,7 +273,7 @@ export const hashAssets = async ( await hashAsset(sys, hydrateOpts, appDir, doc, currentUrl, 'picture > source', ['srcset']); const pageStates = Array.from( - doc.querySelectorAll('script[data-stencil-static="page.state"][type="application/json"]') + doc.querySelectorAll('script[data-stencil-static="page.state"][type="application/json"]'), ) as HTMLScriptElement[]; if (pageStates.length > 0) { await Promise.all( @@ -287,7 +287,7 @@ export const hashAssets = async ( } pageStateScript.textContent = JSON.stringify(pageState); } - }) + }), ); } }; @@ -299,7 +299,7 @@ const hashAsset = async ( doc: Document, currentUrl: URL, selector: string, - srcAttrs: string[] + srcAttrs: string[], ) => { const elms = Array.from(doc.querySelectorAll(selector)); @@ -332,7 +332,7 @@ const hashPageStateAstAssets = async ( appDir: string, currentUrl: URL, pageStateScript: HTMLScriptElement, - node: any[] + node: any[], ) => { const tagName = node[0]; const attrs = node[1]; diff --git a/src/compiler/prerender/prerender-queue.ts b/src/compiler/prerender/prerender-queue.ts index 91bc0fc0c98..fe0021417f0 100644 --- a/src/compiler/prerender/prerender-queue.ts +++ b/src/compiler/prerender/prerender-queue.ts @@ -160,7 +160,7 @@ const prerenderUrl = async (results: d.PrerenderResults, manager: d.PrerenderMan const urlsCompletedSize = manager.urlsCompleted.size; if (manager.progressLogger && urlsCompletedSize > 1) { manager.progressLogger.update( - ` prerendered ${urlsCompletedSize} urls: ${manager.config.logger.dim(previewUrl)}` + ` prerendered ${urlsCompletedSize} urls: ${manager.config.logger.dim(previewUrl)}`, ); } diff --git a/src/compiler/prerender/prerender-template-html.ts b/src/compiler/prerender/prerender-template-html.ts index 8709fa754a5..69480c6db1c 100644 --- a/src/compiler/prerender/prerender-template-html.ts +++ b/src/compiler/prerender/prerender-template-html.ts @@ -18,7 +18,7 @@ export const generateTemplateHtml = async ( srcIndexHtmlPath: string, outputTarget: d.OutputTargetWww, hydrateOpts: d.PrerenderHydrateOptions, - manager: d.PrerenderManager + manager: d.PrerenderManager, ) => { try { if (!isString(srcIndexHtmlPath)) { diff --git a/src/compiler/prerender/prerender-worker.ts b/src/compiler/prerender/prerender-worker.ts index beea092c052..d69c96e06df 100644 --- a/src/compiler/prerender/prerender-worker.ts +++ b/src/compiler/prerender/prerender-worker.ts @@ -125,7 +125,7 @@ export const prerenderWorker = async (sys: d.CompilerSystem, prerenderRequest: d if (hydrateOpts.hashAssets && !prerenderRequest.isDebug) { try { docPromises.push( - hashAssets(sys, prerenderCtx, results.diagnostics, hydrateOpts, prerenderRequest.appDir, doc, url) + hashAssets(sys, prerenderCtx, results.diagnostics, hydrateOpts, prerenderRequest.appDir, doc, url), ); } catch (e: any) { catchError(results.diagnostics, e); @@ -142,7 +142,7 @@ export const prerenderWorker = async (sys: d.CompilerSystem, prerenderRequest: d results.diagnostics, baseUrl, url, - hydrateResults.anchors + hydrateResults.anchors, ); } @@ -188,7 +188,7 @@ export const prerenderWorker = async (sys: d.CompilerSystem, prerenderRequest: d const contentFilePath = join(pageDir, contentFileName); await sys.writeFile(contentFilePath, s.content); } - }) + }), ); } diff --git a/src/compiler/public.ts b/src/compiler/public.ts index 194bd3239e6..b313e5fdc50 100644 --- a/src/compiler/public.ts +++ b/src/compiler/public.ts @@ -35,7 +35,7 @@ export { transpile, transpileSync } from './transpile'; export declare const createCompiler: (config: Config) => Promise; export declare const createPrerenderer: ( - config: Config + config: Config, ) => Promise<{ start: (opts: PrerenderStartOptions) => Promise }>; /** diff --git a/src/compiler/service-worker/generate-sw.ts b/src/compiler/service-worker/generate-sw.ts index 6091a98f833..7ee050a019a 100644 --- a/src/compiler/service-worker/generate-sw.ts +++ b/src/compiler/service-worker/generate-sw.ts @@ -7,7 +7,7 @@ export const generateServiceWorker = async ( config: d.ValidatedConfig, buildCtx: d.BuildCtx, workbox: d.Workbox, - outputTarget: d.OutputTargetWww + outputTarget: d.OutputTargetWww, ): Promise => { const serviceWorker = await getServiceWorker(outputTarget); if (serviceWorker.unregister) { diff --git a/src/compiler/service-worker/test/service-worker.spec.ts b/src/compiler/service-worker/test/service-worker.spec.ts index bac63dc8af8..86c8d74e843 100644 --- a/src/compiler/service-worker/test/service-worker.spec.ts +++ b/src/compiler/service-worker/test/service-worker.spec.ts @@ -33,7 +33,7 @@ describe.skip('service worker', () => { path.join(root, 'src', 'components', 'cmp-a', 'cmp-a.tsx'), ` @Component({ tag: 'cmp-a' }) export class CmpA { render() { return

cmp-a

; } } - ` + `, ); await compiler.fs.commit(); diff --git a/src/compiler/style/css-imports.ts b/src/compiler/style/css-imports.ts index 82978097cee..f194267b273 100644 --- a/src/compiler/style/css-imports.ts +++ b/src/compiler/style/css-imports.ts @@ -27,7 +27,7 @@ export const parseCssImports = async ( srcFilePath: string, resolvedFilePath: string, styleText: string, - styleDocs?: d.StyleDoc[] + styleDocs?: d.StyleDoc[], ): Promise => { const isCssEntry = resolvedFilePath.toLowerCase().endsWith('.css'); const allCssImports: string[] = []; @@ -58,7 +58,7 @@ export const parseCssImports = async ( async function resolveAndFlattenImports( srcFilePath: string, resolvedFilePath: string, - styleText: string + styleText: string, ): Promise { // if we've seen this path before we early return if (resolvedFilePaths.has(resolvedFilePath)) { @@ -93,7 +93,7 @@ export const parseCssImports = async ( cssImportData.styleText = await resolveAndFlattenImports( cssImportData.filePath, cssImportData.filePath, - cssImportData.styleText + cssImportData.styleText, ); } else { // we had some error loading the file from disk, so write a diagnostic @@ -101,7 +101,7 @@ export const parseCssImports = async ( err.messageText = `Unable to read css import: ${cssImportData.srcImport}`; err.absFilePath = srcFilePath; } - }) + }), ); // replace import statements with the actual CSS code in children modules @@ -162,7 +162,7 @@ export const getCssImports = async ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, filePath: string, - styleText: string + styleText: string, ) => { const imports: d.CssImportData[] = []; @@ -230,7 +230,7 @@ export const resolveCssNodeModule = async ( compilerCtx: d.CompilerCtx, diagnostics: d.Diagnostic[], filePath: string, - cssImportData: d.CssImportData + cssImportData: d.CssImportData, ) => { try { const m = getModuleId(cssImportData.url); diff --git a/src/compiler/style/css-parser/test/minify-css.spec.ts b/src/compiler/style/css-parser/test/minify-css.spec.ts index 25ee0ed2cb9..f09cb1ce7db 100644 --- a/src/compiler/style/css-parser/test/minify-css.spec.ts +++ b/src/compiler/style/css-parser/test/minify-css.spec.ts @@ -29,7 +29,7 @@ describe('minifyCss', () => { }, }); expect(c).toBe( - `@font-face{font-family:"Open Sans";src:url("/font.woff2?mph=88") format("woff2"),url('/font.woff?mph=88') format('woff')}` + `@font-face{font-family:"Open Sans";src:url("/font.woff2?mph=88") format("woff2"),url('/font.woff?mph=88') format('woff')}`, ); }); }); diff --git a/src/compiler/style/css-to-esm.ts b/src/compiler/style/css-to-esm.ts index c48247d031a..bf0ea9effd6 100644 --- a/src/compiler/style/css-to-esm.ts +++ b/src/compiler/style/css-to-esm.ts @@ -133,7 +133,7 @@ const transformCssToEsmModule = (input: d.TransformCssToEsmInput): d.TransformCs encapsulation: input.encapsulation, mode: input.mode, }, - input.styleImportData + input.styleImportData, ); // str.append(`import ${cssImport.varName} from '${importPath}';\n`); @@ -159,7 +159,7 @@ const transformCssToEsmModule = (input: d.TransformCssToEsmInput): d.TransformCs */ const generateTransformCssToEsm = ( input: d.TransformCssToEsmInput, - results: d.TransformCssToEsmOutput + results: d.TransformCssToEsmOutput, ): d.TransformCssToEsmOutput => { const s = new MagicString(''); @@ -210,7 +210,7 @@ const getCssToEsmImports = ( varNames: Set, cssText: string, filePath: string, - modeName: string + modeName: string, ): d.CssToEsmImportData[] => { const cssImports: d.CssToEsmImportData[] = []; diff --git a/src/compiler/style/global-styles.ts b/src/compiler/style/global-styles.ts index 8cd19c7c1df..995d08ca2ab 100644 --- a/src/compiler/style/global-styles.ts +++ b/src/compiler/style/global-styles.ts @@ -8,7 +8,7 @@ import { optimizeCss } from './optimize-css'; export const generateGlobalStyles = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ) => { const outputTargets = config.outputTargets.filter(isOutputTargetDistGlobalStyles); if (outputTargets.length === 0) { @@ -44,7 +44,7 @@ const buildGlobalStyles = async (config: d.ValidatedConfig, compilerCtx: d.Compi compilerCtx, buildCtx.diagnostics, transformResults.code, - globalStylePath + globalStylePath, ); compilerCtx.cachedGlobalStyle = optimizedCss; @@ -98,7 +98,7 @@ const canSkipGlobalStyles = async (config: d.ValidatedConfig, compilerCtx: d.Com buildCtx, config.globalStyle, compilerCtx.cachedGlobalStyle, - [] + [], ); if (hasChangedImports) { return false; @@ -113,7 +113,7 @@ const hasChangedImportFile = async ( buildCtx: d.BuildCtx, filePath: string, content: string, - noLoop: string[] + noLoop: string[], ): Promise => { if (noLoop.includes(filePath)) { return false; @@ -129,7 +129,7 @@ const hasChangedImportContent = async ( buildCtx: d.BuildCtx, filePath: string, content: string, - checkedFiles: string[] + checkedFiles: string[], ) => { const cssImports = await getCssImports(config, compilerCtx, buildCtx, filePath, content); if (cssImports.length === 0) { diff --git a/src/compiler/style/optimize-css.ts b/src/compiler/style/optimize-css.ts index 3f6f6e42cb8..a34426c5390 100644 --- a/src/compiler/style/optimize-css.ts +++ b/src/compiler/style/optimize-css.ts @@ -8,7 +8,7 @@ export const optimizeCss = async ( compilerCtx: d.CompilerCtx, diagnostics: d.Diagnostic[], styleText: string, - filePath: string + filePath: string, ) => { if (typeof styleText !== 'string' || !styleText.length) { // don't bother with invalid data diff --git a/src/compiler/style/test/build-conditionals.spec.ts b/src/compiler/style/test/build-conditionals.spec.ts index 0b783a67a18..d14a60460b3 100644 --- a/src/compiler/style/test/build-conditionals.spec.ts +++ b/src/compiler/style/test/build-conditionals.spec.ts @@ -54,7 +54,7 @@ describe.skip('build-conditionals', () => { { [path.join(root, 'src', 'cmp-a.tsx')]: `@Component({ tag: 'cmp-a' }) export class CmpA {}`, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); @@ -80,7 +80,7 @@ describe.skip('build-conditionals', () => { } }`, }, - { clearFileCache: true } + { clearFileCache: true }, ); await compiler.fs.commit(); diff --git a/src/compiler/style/test/css-imports.spec.ts b/src/compiler/style/test/css-imports.spec.ts index bc8bb611297..be31858f300 100644 --- a/src/compiler/style/test/css-imports.spec.ts +++ b/src/compiler/style/test/css-imports.spec.ts @@ -356,7 +356,7 @@ describe('css-imports', () => { filePath: normalizePath(path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css')), srcImport: `@import '~@ionic/core/dist/ionic/ionic.css';`, updatedImport: `@import "${normalizePath( - path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css') + path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css'), )}";`, url: `~@ionic/core/dist/ionic/ionic.css`, }, @@ -413,7 +413,7 @@ describe('css-imports', () => { filePath: normalizePath(path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css')), srcImport: `@import '~@ionic/core/dist/ionic/ionic.css';`, updatedImport: `@import "${normalizePath( - path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css') + path.join(root, 'node_modules', '@ionic', 'core', 'dist', 'ionic', 'ionic.css'), )}";`, url: `~@ionic/core/dist/ionic/ionic.css`, }, @@ -485,7 +485,7 @@ describe('css-imports', () => { mainFilePath, mainFilePath, files[mainFilePath], - [] + [], ); // CSS from child and grandchild are merged in expect(result.styleText).toBe('div { display: flex } :host { color: red; }'); diff --git a/src/compiler/style/test/style-rebuild.spec.ts b/src/compiler/style/test/style-rebuild.spec.ts index b22c1382037..8600751bf5a 100644 --- a/src/compiler/style/test/style-rebuild.spec.ts +++ b/src/compiler/style/test/style-rebuild.spec.ts @@ -32,7 +32,7 @@ xdescribe('component-styles', () => { "target": "es2017" } } - ` + `, ); const { config } = validateConfig( @@ -40,7 +40,7 @@ xdescribe('component-styles', () => { rootDir: '/', tsconfig: '/tsconfig.json', }, - mockLoadConfigInit() + mockLoadConfigInit(), ); config.sys = sys; compiler = await createCompiler(config); @@ -86,7 +86,7 @@ xdescribe('component-styles', () => { it('should build one component w/ out inline style, and re-compile when adding inline styles', async () => { await compiler.sys.writeFile( path.join(root, 'src', 'cmp-a.tsx'), - `@Component({ tag: 'cmp-a' }) export class CmpA {}` + `@Component({ tag: 'cmp-a' }) export class CmpA {}`, ); const watcher = await compiler.createWatcher(); // compiler.config.watch = true; diff --git a/src/compiler/sys/fetch/fetch-module-async.ts b/src/compiler/sys/fetch/fetch-module-async.ts index 10cdb4924fe..6e828ca4dc8 100644 --- a/src/compiler/sys/fetch/fetch-module-async.ts +++ b/src/compiler/sys/fetch/fetch-module-async.ts @@ -9,7 +9,7 @@ export const fetchModuleAsync = async ( inMemoryFs: InMemoryFileSystem, pkgVersions: Map, url: string, - filePath: string + filePath: string, ) => { if (skipFilePathFetch(filePath) || known404Urls.has(url) || skipUrlFetch(url)) { return undefined; diff --git a/src/compiler/sys/fetch/fetch-module-sync.ts b/src/compiler/sys/fetch/fetch-module-sync.ts index 6695d7e51c0..ae0060be357 100644 --- a/src/compiler/sys/fetch/fetch-module-sync.ts +++ b/src/compiler/sys/fetch/fetch-module-sync.ts @@ -11,7 +11,7 @@ export const fetchModuleSync = ( inMemoryFs: InMemoryFileSystem, pkgVersions: Map, url: string, - filePath: string + filePath: string, ) => { if (skipFilePathFetch(filePath)) { return undefined; diff --git a/src/compiler/sys/fetch/write-fetch-success.ts b/src/compiler/sys/fetch/write-fetch-success.ts index e761eab1fbc..0330cd4f233 100644 --- a/src/compiler/sys/fetch/write-fetch-success.ts +++ b/src/compiler/sys/fetch/write-fetch-success.ts @@ -10,7 +10,7 @@ export const writeFetchSuccessSync = ( url: string, filePath: string, content: string, - pkgVersions: Map + pkgVersions: Map, ) => { if (url.endsWith('package.json')) { setPackageVersionByContent(pkgVersions, content); @@ -42,7 +42,7 @@ export const writeFetchSuccessAsync = async ( url: string, filePath: string, content: string, - pkgVersions: Map + pkgVersions: Map, ) => { if (url.endsWith('package.json')) { setPackageVersionByContent(pkgVersions, content); diff --git a/src/compiler/sys/in-memory-fs.ts b/src/compiler/sys/in-memory-fs.ts index bf46c75c9a6..8d329a21eaa 100644 --- a/src/compiler/sys/in-memory-fs.ts +++ b/src/compiler/sys/in-memory-fs.ts @@ -326,7 +326,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { initPath: string, dirPath: string, opts: FsReaddirOptions, - collectedPaths: FsReaddirItem[] + collectedPaths: FsReaddirItem[], ) => { // used internally only so we could easily recursively drill down // loop through this directory and sub directories @@ -367,7 +367,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { // let's keep drilling down await readDirectory(initPath, absPath, opts, collectedPaths); } - }) + }), ); } }; @@ -522,7 +522,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { return null; } return removeItem(item.absPath); - }) + }), ); } catch (e) { // do not throw error if the directory never existed @@ -889,7 +889,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { const [src, dest] = data; await sys.copyFile(src, dest); return [src, dest]; - }) + }), ); return copiedFiles; }; @@ -908,7 +908,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { throw new Error(`unable to writeFile without filePath`); } return commitWriteFile(filePath); - }) + }), ); return writtenFiles; }; @@ -948,7 +948,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { } await sys.removeFile(filePath); return filePath; - }) + }), ); return deletedFiles; }; @@ -1065,7 +1065,7 @@ export const createInMemoryFs = (sys: d.CompilerSystem) => { queueDeleteFromDisk: null, queueWriteToDisk: null, useCache: null, - }) + }), ); return item; }; diff --git a/src/compiler/sys/logger/terminal-logger.ts b/src/compiler/sys/logger/terminal-logger.ts index 99212fb2727..2f2909d548d 100644 --- a/src/compiler/sys/logger/terminal-logger.ts +++ b/src/compiler/sys/logger/terminal-logger.ts @@ -151,7 +151,7 @@ export const createTerminalLogger = (loggerSys: TerminalLoggerSys): Logger => { textBold: boolean, newLineSuffix: boolean, debug: boolean, - appendTo: string[] + appendTo: string[], ) => { let msg = finishMsg; diff --git a/src/compiler/sys/logger/test/terminal-logger.spec.ts b/src/compiler/sys/logger/test/terminal-logger.spec.ts index 7504e2ea995..851c8c7b3cd 100644 --- a/src/compiler/sys/logger/test/terminal-logger.spec.ts +++ b/src/compiler/sys/logger/test/terminal-logger.spec.ts @@ -160,11 +160,11 @@ describe('terminal-logger', () => { expect(logMock).toHaveBeenNthCalledWith( 1, - `${cyan('[32:32.0]')} start the timespan ${dim('...')} ${dim(' MEM: 10.0MB')}` + `${cyan('[32:32.0]')} start the timespan ${dim('...')} ${dim(' MEM: 10.0MB')}`, ); expect(logMock).toHaveBeenNthCalledWith( 2, - `${cyan('[32:42.0]')} finish the timespan ${dim('in 10.00 s')} ${dim(' MEM: 10.0MB')}` + `${cyan('[32:42.0]')} finish the timespan ${dim('in 10.00 s')} ${dim(' MEM: 10.0MB')}`, ); }); @@ -194,7 +194,7 @@ describe('terminal-logger', () => { jest.advanceTimersByTime(10_000); timespan.finish('finish the timespan'); expect(logMock).not.toHaveBeenCalled(); - } + }, ); }); @@ -216,7 +216,7 @@ describe('terminal-logger', () => { expect(logMock).toHaveBeenNthCalledWith(1, `${dim('[32:32.0]')} start the timespan ${dim('...')}`); expect(logMock).toHaveBeenNthCalledWith( 2, - `${dim('[32:32.0]')} finish the timespan ${dim('in less than 1 ms')}` + `${dim('[32:32.0]')} finish the timespan ${dim('in less than 1 ms')}`, ); }); diff --git a/src/compiler/sys/resolve/resolve-module-async.ts b/src/compiler/sys/resolve/resolve-module-async.ts index 35d44da2d0f..855ad7890ca 100644 --- a/src/compiler/sys/resolve/resolve-module-async.ts +++ b/src/compiler/sys/resolve/resolve-module-async.ts @@ -9,7 +9,7 @@ import { getPackageDirPath } from './resolve-utils'; export const resolveModuleIdAsync = ( sys: d.CompilerSystem, inMemoryFs: InMemoryFileSystem, - opts: d.ResolveModuleIdOptions + opts: d.ResolveModuleIdOptions, ) => { const resolverOpts: AsyncOpts = createCustomResolverAsync(sys, inMemoryFs, opts.exts); resolverOpts.basedir = dirname(normalizeFsPath(opts.containingFile)); @@ -46,7 +46,7 @@ export const resolveModuleIdAsync = ( export const createCustomResolverAsync = ( sys: d.CompilerSystem, inMemoryFs: InMemoryFileSystem, - exts: string[] + exts: string[], ): any => { return { async isFile(filePath: string, cb: (err: any, isFile: boolean) => void) { diff --git a/src/compiler/sys/resolve/resolve-module-sync.ts b/src/compiler/sys/resolve/resolve-module-sync.ts index 32903057193..0b484aa497d 100644 --- a/src/compiler/sys/resolve/resolve-module-sync.ts +++ b/src/compiler/sys/resolve/resolve-module-sync.ts @@ -8,7 +8,7 @@ import { InMemoryFileSystem } from '../in-memory-fs'; export const resolveRemoteModuleIdSync = ( config: d.Config, inMemoryFs: InMemoryFileSystem, - opts: d.ResolveModuleIdOptions + opts: d.ResolveModuleIdOptions, ) => { const packageJson = resolveRemotePackageJsonSync(config, inMemoryFs, opts.moduleId); if (packageJson) { @@ -30,7 +30,7 @@ export const resolveRemoteModuleIdSync = ( const resolveRemotePackageJsonSync = (config: d.Config, inMemoryFs: InMemoryFileSystem, moduleId: string) => { if (inMemoryFs) { const filePath = normalizePath( - config.sys.getLocalModulePath({ rootDir: config.rootDir, moduleId, path: 'package.json' }) + config.sys.getLocalModulePath({ rootDir: config.rootDir, moduleId, path: 'package.json' }), ); const pkgJson = inMemoryFs.readFileSync(filePath); if (typeof pkgJson === 'string') { @@ -45,7 +45,7 @@ const resolveRemotePackageJsonSync = (config: d.Config, inMemoryFs: InMemoryFile export const resolveModuleIdSync = ( sys: d.CompilerSystem, inMemoryFs: InMemoryFileSystem, - opts: d.ResolveModuleIdOptions + opts: d.ResolveModuleIdOptions, ) => { if (inMemoryFs) { const resolverOpts = createCustomResolverSync(sys, inMemoryFs, opts.exts); @@ -61,7 +61,7 @@ export const resolveModuleIdSync = ( export const createCustomResolverSync = ( sys: d.CompilerSystem, inMemoryFs: InMemoryFileSystem, - exts: string[] + exts: string[], ): SyncOpts => { return { isFile(filePath: string) { diff --git a/src/compiler/sys/resolve/tests/resolve-module.spec.ts b/src/compiler/sys/resolve/tests/resolve-module.spec.ts index 1e546a74685..d501b850b7c 100644 --- a/src/compiler/sys/resolve/tests/resolve-module.spec.ts +++ b/src/compiler/sys/resolve/tests/resolve-module.spec.ts @@ -93,7 +93,7 @@ describe('resolve modules', () => { expect(getPackageDirPath('/node_modules/my-pkg/', 'my-pkg')).toBe('/node_modules/my-pkg'); expect(getPackageDirPath('/node_modules/my-pkg/some/path.js', 'my-pkg')).toBe('/node_modules/my-pkg'); expect(getPackageDirPath('/node_modules/something/node_modules/my-pkg/some/path.js', 'my-pkg')).toBe( - '/node_modules/something/node_modules/my-pkg' + '/node_modules/something/node_modules/my-pkg', ); expect(getPackageDirPath('/node_modules/idk/some/path.js', 'my-pkg')).toBe(null); expect(getPackageDirPath('/my-pkg/node_modules/some/path.js', 'my-pkg')).toBe(null); diff --git a/src/compiler/sys/resolve/tests/resolve-utils.spec.ts b/src/compiler/sys/resolve/tests/resolve-utils.spec.ts index 378afa65e0c..5b417562f62 100644 --- a/src/compiler/sys/resolve/tests/resolve-utils.spec.ts +++ b/src/compiler/sys/resolve/tests/resolve-utils.spec.ts @@ -6,21 +6,21 @@ describe('resolve-utils', () => { 'returns true for a file ending with .ts (%s)', (fileName) => { expect(isTsFile(fileName)).toEqual(true); - } + }, ); it.each(['.tsx', 'foo.tsx', 'foo.bar.tsx', 'foo/bar.tsx'])( 'returns false for a file ending with .tsx (%s)', (fileName) => { expect(isTsFile(fileName)).toEqual(false); - } + }, ); it.each(['foo.js', 'foo.doc', 'foo.css', 'foo.html'])( 'returns false for other a file with another extension (%s)', (fileName) => { expect(isTsFile(fileName)).toEqual(false); - } + }, ); it('returns false for .d.ts and .d.tsx files', () => { @@ -40,7 +40,7 @@ describe('resolve-utils', () => { 'returns false for non-lowercase extensions (%s)', (fileName) => { expect(isTsFile(fileName)).toEqual(false); - } + }, ); }); @@ -49,14 +49,14 @@ describe('resolve-utils', () => { 'returns true for a file ending with .js (%s)', (fileName) => { expect(isJsFile(fileName)).toEqual(true); - } + }, ); it.each(['.jsx', 'foo.txt', 'foo/bar.css', 'foo.bar.html'])( 'returns false for other a file with another extension (%s)', (fileName) => { expect(isJsFile(fileName)).toEqual(false); - } + }, ); it('returns true for a file named "spec.js"', () => { diff --git a/src/compiler/sys/stencil-sys.ts b/src/compiler/sys/stencil-sys.ts index 008ada832da..d82b11fc808 100644 --- a/src/compiler/sys/stencil-sys.ts +++ b/src/compiler/sys/stencil-sys.ts @@ -110,7 +110,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => { const createDirRecursiveSync = ( p: string, opts: CompilerSystemCreateDirectoryOptions, - results: CompilerSystemCreateDirectoryResults + results: CompilerSystemCreateDirectoryResults, ) => { const parentDir = dirname(p); @@ -303,7 +303,7 @@ export const createSystem = (c?: { logger?: Logger }): CompilerSystem => { const removeDirSyncRecursive = ( p: string, opts: CompilerSystemRemoveDirectoryOptions, - results: CompilerSystemRemoveDirectoryResults + results: CompilerSystemRemoveDirectoryResults, ) => { if (!results.error) { p = normalize(p); diff --git a/src/compiler/sys/typescript/tests/typescript-resolve-module.spec.ts b/src/compiler/sys/typescript/tests/typescript-resolve-module.spec.ts index 2080af7abeb..bfddaabbaa3 100644 --- a/src/compiler/sys/typescript/tests/typescript-resolve-module.spec.ts +++ b/src/compiler/sys/typescript/tests/typescript-resolve-module.spec.ts @@ -44,7 +44,7 @@ describe('typescript resolve module', () => { it('resolve ./stencil-private.d.ts to full dts path when imported by internal dts url', async () => { const moduleName = './stencil-private'; const containingFile = normalizePath( - sys.getLocalModulePath({ rootDir: config.rootDir, moduleId: '@stencil/core', path: 'internal/index.d.ts' }) + sys.getLocalModulePath({ rootDir: config.rootDir, moduleId: '@stencil/core', path: 'internal/index.d.ts' }), ); expect(containingFile).toBe('/some/path/node_modules/@stencil/core/internal/index.d.ts'); diff --git a/src/compiler/sys/typescript/typescript-config.ts b/src/compiler/sys/typescript/typescript-config.ts index e430e3f4544..b170a87f136 100644 --- a/src/compiler/sys/typescript/typescript-config.ts +++ b/src/compiler/sys/typescript/typescript-config.ts @@ -163,7 +163,7 @@ const createDefaultTsConfig = (config: d.Config) => include: [relative(config.rootDir, config.srcDir)], }, null, - 2 + 2, ); const hasSrcDirectoryInclude = (includeProp: string[], src: string) => diff --git a/src/compiler/sys/typescript/typescript-resolve-module.ts b/src/compiler/sys/typescript/typescript-resolve-module.ts index 838b3b947dc..e9208d2229e 100644 --- a/src/compiler/sys/typescript/typescript-resolve-module.ts +++ b/src/compiler/sys/typescript/typescript-resolve-module.ts @@ -22,7 +22,7 @@ export const tsResolveModuleName = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, moduleName: string, - containingFile: string + containingFile: string, ) => { const resolveModuleName: typeof ts.resolveModuleName = (ts as any).__resolveModuleName || ts.resolveModuleName; @@ -41,7 +41,7 @@ export const tsResolveModuleNamePackageJsonPath = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, moduleName: string, - containingFile: string + containingFile: string, ) => { try { const resolvedModule = tsResolveModuleName(config, compilerCtx, moduleName, containingFile); @@ -71,7 +71,7 @@ export const patchedTsResolveModule = ( config: d.Config, inMemoryFs: InMemoryFileSystem, moduleName: string, - containingFile: string + containingFile: string, ): ts.ResolvedModuleWithFailedLookupLocations => { if (isLocalModule(moduleName)) { const containingDir = dirname(containingFile); @@ -128,7 +128,7 @@ export const tsResolveNodeModule = ( config: d.Config, inMemoryFs: InMemoryFileSystem, moduleId: string, - containingFile: string + containingFile: string, ): ts.ResolvedModuleWithFailedLookupLocations => { if (isStencilCoreImport(moduleId)) { const rtn: ts.ResolvedModuleWithFailedLookupLocations = { @@ -139,7 +139,7 @@ export const tsResolveNodeModule = ( rootDir: config.rootDir, moduleId: '@stencil/core', path: 'internal/index.d.ts', - }) + }), ), packageId: { name: moduleId, diff --git a/src/compiler/sys/typescript/typescript-sys.ts b/src/compiler/sys/typescript/typescript-sys.ts index de3bbf1cee9..d03a01d7e91 100644 --- a/src/compiler/sys/typescript/typescript-sys.ts +++ b/src/compiler/sys/typescript/typescript-sys.ts @@ -11,7 +11,7 @@ export const patchTsSystemFileSystem = ( config: d.ValidatedConfig, compilerSys: d.CompilerSystem, inMemoryFs: InMemoryFileSystem, - tsSys: ts.System + tsSys: ts.System, ): ts.System => { const realpath = (path: string) => { const rp = compilerSys.realpathSync(path); @@ -115,7 +115,7 @@ export const patchTsSystemFileSystem = ( cwd, depth, getAccessibleFileSystemEntries, - realpath + realpath, ); }; @@ -137,7 +137,7 @@ const patchTsSystemWatch = (compilerSystem: d.CompilerSystem, tsSys: ts.System) (filePath) => { cb(filePath); }, - recursive + recursive, ); return { close() { diff --git a/src/compiler/sys/worker/sys-worker.ts b/src/compiler/sys/worker/sys-worker.ts index c5d341195b6..079269e7687 100644 --- a/src/compiler/sys/worker/sys-worker.ts +++ b/src/compiler/sys/worker/sys-worker.ts @@ -19,7 +19,7 @@ export const createSysWorker = (config: ValidatedConfig) => { } config.logger.debug( - `no workers, maxConcurrentWorkers: ${config.maxConcurrentWorkers}, hardwareConcurrency: ${config.sys.hardwareConcurrency}` + `no workers, maxConcurrentWorkers: ${config.maxConcurrentWorkers}, hardwareConcurrency: ${config.sys.hardwareConcurrency}`, ); return createWorkerContext(config.sys); }; diff --git a/src/compiler/sys/worker/web-worker-main.ts b/src/compiler/sys/worker/web-worker-main.ts index a17144498ec..d2d8e30d810 100644 --- a/src/compiler/sys/worker/web-worker-main.ts +++ b/src/compiler/sys/worker/web-worker-main.ts @@ -4,7 +4,7 @@ import type * as d from '../../../declarations'; export const createWebWorkerMainController = ( sys: d.CompilerSystem, - maxConcurrentWorkers: number + maxConcurrentWorkers: number, ): d.WorkerMainController => { let msgIds = 0; let isDestroyed = false; diff --git a/src/compiler/transformers/add-component-meta-proxy.ts b/src/compiler/transformers/add-component-meta-proxy.ts index 4f34ff87cbb..a03f20ae465 100644 --- a/src/compiler/transformers/add-component-meta-proxy.ts +++ b/src/compiler/transformers/add-component-meta-proxy.ts @@ -39,8 +39,8 @@ const createComponentMetadataProxy = (compilerMeta: d.ComponentCompilerMeta): ts ts.factory.createCallExpression( ts.factory.createIdentifier(PROXY_CUSTOM_ELEMENT), [], - [literalCmpClassName, literalMeta] - ) + [literalCmpClassName, literalMeta], + ), ); }; @@ -65,7 +65,7 @@ const createComponentMetadataProxy = (compilerMeta: d.ComponentCompilerMeta): ts */ export const createClassMetadataProxy = ( compilerMeta: d.ComponentCompilerMeta, - clazz: ts.ClassExpression + clazz: ts.ClassExpression, ): ts.CallExpression => { const compactMeta: d.ComponentRuntimeMetaCompact = formatComponentRuntimeMeta(compilerMeta, true); const literalMeta = convertValueToLiteral(compactMeta); diff --git a/src/compiler/transformers/add-component-meta-static.ts b/src/compiler/transformers/add-component-meta-static.ts index 78a78adfbc7..d9f37c9475c 100644 --- a/src/compiler/transformers/add-component-meta-static.ts +++ b/src/compiler/transformers/add-component-meta-static.ts @@ -15,7 +15,7 @@ import { convertValueToLiteral, createStaticGetter, retrieveModifierLike } from */ export const addComponentMetaStatic = ( cmpNode: ts.ClassDeclaration, - cmpMeta: d.ComponentCompilerMeta + cmpMeta: d.ComponentCompilerMeta, ): ts.ClassDeclaration => { const publicCompilerMeta = getPublicCompilerMeta(cmpMeta); @@ -28,7 +28,7 @@ export const addComponentMetaStatic = ( cmpNode.name, cmpNode.typeParameters, cmpNode.heritageClauses, - classMembers + classMembers, ); }; diff --git a/src/compiler/transformers/add-imports.ts b/src/compiler/transformers/add-imports.ts index c57173883ed..d3ae0868013 100644 --- a/src/compiler/transformers/add-imports.ts +++ b/src/compiler/transformers/add-imports.ts @@ -23,7 +23,7 @@ export const addImports = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, importFnNames: string[], - importPath: string + importPath: string, ): ts.SourceFile => { if (importFnNames.length === 0) { return tsSourceFile; diff --git a/src/compiler/transformers/add-static-style.ts b/src/compiler/transformers/add-static-style.ts index dbbdba4663d..b7a08229472 100644 --- a/src/compiler/transformers/add-static-style.ts +++ b/src/compiler/transformers/add-static-style.ts @@ -21,7 +21,7 @@ import { createStaticGetter } from './transform-utils'; export const addStaticStyleGetterWithinClass = ( classMembers: ts.ClassElement[], cmp: d.ComponentCompilerMeta, - commentOriginalSelector: boolean + commentOriginalSelector: boolean, ): void => { const styleLiteral = getStyleLiteral(cmp, commentOriginalSelector); if (styleLiteral) { @@ -46,8 +46,8 @@ export const addStaticStylePropertyToClass = (styleStatements: ts.Statement[], c const statement = ts.factory.createExpressionStatement( ts.factory.createAssignment( ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(cmp.componentClassName), 'style'), - styleLiteral - ) + styleLiteral, + ), ); styleStatements.push(statement); } @@ -69,7 +69,7 @@ const getStyleLiteral = (cmp: d.ComponentCompilerMeta, commentOriginalSelector: const getMultipleModeStyle = ( cmp: d.ComponentCompilerMeta, styles: d.StyleCompiler[], - commentOriginalSelector: boolean + commentOriginalSelector: boolean, ) => { const styleModes: ts.ObjectLiteralElementLike[] = []; diff --git a/src/compiler/transformers/collections/add-external-import.ts b/src/compiler/transformers/collections/add-external-import.ts index d973cff3646..825860f51da 100644 --- a/src/compiler/transformers/collections/add-external-import.ts +++ b/src/compiler/transformers/collections/add-external-import.ts @@ -12,7 +12,7 @@ export const addExternalImport = ( moduleFile: d.Module, containingFile: string, moduleId: string, - resolveCollections: boolean + resolveCollections: boolean, ) => { if (!moduleFile.externalImports.includes(moduleId)) { moduleFile.externalImports.push(moduleId); @@ -74,7 +74,7 @@ export const addExternalImport = ( buildCtx, moduleId, parsedPkgJson.filePath, - parsedPkgJson.data + parsedPkgJson.data, ); if (!collection) { return; @@ -105,7 +105,7 @@ export const addExternalImport = ( moduleFile, resolveFromDir, dependencyModuleId, - resolveCollections + resolveCollections, ); }); } diff --git a/src/compiler/transformers/collections/parse-collection-components.ts b/src/compiler/transformers/collections/parse-collection-components.ts index 64a47964d27..91ad5b0d323 100644 --- a/src/compiler/transformers/collections/parse-collection-components.ts +++ b/src/compiler/transformers/collections/parse-collection-components.ts @@ -10,7 +10,7 @@ export const parseCollectionComponents = ( buildCtx: d.BuildCtx, collectionDir: string, collectionManifest: d.CollectionManifest, - collection: d.CollectionCompilerMeta + collection: d.CollectionCompilerMeta, ) => { if (collectionManifest.entries) { collectionManifest.entries.forEach((entryPath) => { @@ -25,7 +25,7 @@ export const transpileCollectionModule = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, collection: d.CollectionCompilerMeta, - inputFileName: string + inputFileName: string, ) => { const sourceText = compilerCtx.fs.readFileSync(inputFileName); const sourceFile = ts.createSourceFile(inputFileName, sourceText, ts.ScriptTarget.ES2017, true, ts.ScriptKind.JS); diff --git a/src/compiler/transformers/collections/parse-collection-manifest.ts b/src/compiler/transformers/collections/parse-collection-manifest.ts index 67206a1a64c..3d9d2e4da11 100644 --- a/src/compiler/transformers/collections/parse-collection-manifest.ts +++ b/src/compiler/transformers/collections/parse-collection-manifest.ts @@ -10,7 +10,7 @@ export const parseCollectionManifest = ( buildCtx: d.BuildCtx, collectionName: string, collectionDir: string, - collectionJsonStr: string + collectionJsonStr: string, ) => { const collectionManifest: d.CollectionManifest = JSON.parse(collectionJsonStr); @@ -45,7 +45,7 @@ export const parseGlobal = ( buildCtx: d.BuildCtx, collectionDir: string, collectionManifest: d.CollectionManifest, - collection: d.CollectionCompilerMeta + collection: d.CollectionCompilerMeta, ) => { if (typeof collectionManifest.global !== 'string') { return; diff --git a/src/compiler/transformers/collections/parse-collection-module.ts b/src/compiler/transformers/collections/parse-collection-module.ts index f3f3be13c50..1a4492bfb7d 100644 --- a/src/compiler/transformers/collections/parse-collection-module.ts +++ b/src/compiler/transformers/collections/parse-collection-module.ts @@ -10,7 +10,7 @@ export const parseCollection = ( buildCtx: d.BuildCtx, moduleId: string, pkgJsonFilePath: string, - pkgData: d.PackageJsonData + pkgData: d.PackageJsonData, ) => { // note this MUST be synchronous because this is used during transpile const collectionName = pkgData.name; diff --git a/src/compiler/transformers/component-hydrate/hydrate-component.ts b/src/compiler/transformers/component-hydrate/hydrate-component.ts index 5c40359005d..c8dd48f96ca 100644 --- a/src/compiler/transformers/component-hydrate/hydrate-component.ts +++ b/src/compiler/transformers/component-hydrate/hydrate-component.ts @@ -12,7 +12,7 @@ import { addHydrateRuntimeCmpMeta } from './hydrate-runtime-cmp-meta'; export const updateHydrateComponentClass = ( classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { return ts.factory.updateClassDeclaration( classNode, @@ -20,14 +20,14 @@ export const updateHydrateComponentClass = ( classNode.name, classNode.typeParameters, classNode.heritageClauses, - updateHydrateHostComponentMembers(classNode, moduleFile, cmp) + updateHydrateHostComponentMembers(classNode, moduleFile, cmp), ); }; const updateHydrateHostComponentMembers = ( classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { const classMembers = removeStaticMetaProperties(classNode); diff --git a/src/compiler/transformers/component-hydrate/tranform-to-hydrate-component.ts b/src/compiler/transformers/component-hydrate/tranform-to-hydrate-component.ts index 1f8fcd673aa..535e53a9179 100644 --- a/src/compiler/transformers/component-hydrate/tranform-to-hydrate-component.ts +++ b/src/compiler/transformers/component-hydrate/tranform-to-hydrate-component.ts @@ -9,7 +9,7 @@ import { updateHydrateComponentClass } from './hydrate-component'; export const hydrateComponentTransform = ( compilerCtx: d.CompilerCtx, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): ts.TransformerFactory => { return (transformCtx) => { return (tsSourceFile) => { diff --git a/src/compiler/transformers/component-lazy/lazy-component.ts b/src/compiler/transformers/component-lazy/lazy-component.ts index 892bfa9f8b1..c63d59b40df 100644 --- a/src/compiler/transformers/component-lazy/lazy-component.ts +++ b/src/compiler/transformers/component-lazy/lazy-component.ts @@ -14,7 +14,7 @@ export const updateLazyComponentClass = ( styleStatements: ts.Statement[], classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { const members = updateLazyComponentMembers(transformOpts, styleStatements, classNode, moduleFile, cmp); return updateComponentClass(transformOpts, classNode, classNode.heritageClauses, members, moduleFile); @@ -25,7 +25,7 @@ const updateLazyComponentMembers = ( styleStatements: ts.Statement[], classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { const classMembers = removeStaticMetaProperties(classNode); diff --git a/src/compiler/transformers/component-lazy/lazy-constructor.ts b/src/compiler/transformers/component-lazy/lazy-constructor.ts index 65c36022ff5..ec3502b7949 100644 --- a/src/compiler/transformers/component-lazy/lazy-constructor.ts +++ b/src/compiler/transformers/component-lazy/lazy-constructor.ts @@ -8,7 +8,7 @@ import { retrieveTsModifiers } from '../transform-utils'; export const updateLazyComponentConstructor = ( classMembers: ts.ClassElement[], moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { const cstrMethodArgs = [ ts.factory.createParameterDeclaration(undefined, undefined, ts.factory.createIdentifier(HOST_REF_ARG)), @@ -29,14 +29,14 @@ export const updateLazyComponentConstructor = ( cstrMethod, retrieveTsModifiers(cstrMethod), cstrMethodArgs, - body + body, ); } else { // create a constructor() const cstrMethod = ts.factory.createConstructorDeclaration( undefined, cstrMethodArgs, - ts.factory.createBlock([registerInstanceStatement(moduleFile), ...addCreateEvents(moduleFile, cmp)], true) + ts.factory.createBlock([registerInstanceStatement(moduleFile), ...addCreateEvents(moduleFile, cmp)], true), ); classMembers.unshift(cstrMethod); } @@ -49,7 +49,7 @@ const registerInstanceStatement = (moduleFile: d.Module) => { ts.factory.createCallExpression(ts.factory.createIdentifier(REGISTER_INSTANCE), undefined, [ ts.factory.createThis(), ts.factory.createIdentifier(HOST_REF_ARG), - ]) + ]), ); }; diff --git a/src/compiler/transformers/component-lazy/lazy-element-getter.ts b/src/compiler/transformers/component-lazy/lazy-element-getter.ts index 0e4b1158e6b..0a7ee43d47b 100644 --- a/src/compiler/transformers/component-lazy/lazy-element-getter.ts +++ b/src/compiler/transformers/component-lazy/lazy-element-getter.ts @@ -6,7 +6,7 @@ import { addCoreRuntimeApi, GET_ELEMENT, RUNTIME_APIS } from '../core-runtime-ap export const addLazyElementGetter = ( classMembers: ts.ClassElement[], moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ) => { // @Element() element; // is transformed into: @@ -24,16 +24,16 @@ export const addLazyElementGetter = ( ts.factory.createReturnStatement( ts.factory.createCallExpression(ts.factory.createIdentifier(GET_ELEMENT), undefined, [ ts.factory.createThis(), - ]) + ]), ), - ]) + ]), ); // Find the index in the class members array that correlates with the element // ref identifier we have const index = classMembers.findIndex( (member) => - member.kind === ts.SyntaxKind.PropertyDeclaration && (member.name as any)?.escapedText === cmp.elementRef + member.kind === ts.SyntaxKind.PropertyDeclaration && (member.name as any)?.escapedText === cmp.elementRef, ); // Index should never not be a valid integer, but we'll be safe just in case. diff --git a/src/compiler/transformers/component-lazy/transform-lazy-component.ts b/src/compiler/transformers/component-lazy/transform-lazy-component.ts index d0deb9edbd4..3e0fd227755 100644 --- a/src/compiler/transformers/component-lazy/transform-lazy-component.ts +++ b/src/compiler/transformers/component-lazy/transform-lazy-component.ts @@ -9,7 +9,7 @@ import { updateLazyComponentClass } from './lazy-component'; export const lazyComponentTransform = ( compilerCtx: d.CompilerCtx, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): ts.TransformerFactory => { return (transformCtx) => { return (tsSourceFile) => { diff --git a/src/compiler/transformers/component-native/add-define-custom-element-function.ts b/src/compiler/transformers/component-native/add-define-custom-element-function.ts index 1400714eddf..1d830e331cf 100644 --- a/src/compiler/transformers/component-native/add-define-custom-element-function.ts +++ b/src/compiler/transformers/component-native/add-define-custom-element-function.ts @@ -15,7 +15,7 @@ import { createImportStatement, getModuleFromSourceFile } from '../transform-uti export const addDefineCustomElementFunctions = ( compilerCtx: d.CompilerCtx, components: d.ComponentCompilerMeta[], - outputTarget: d.OutputTargetDistCustomElements + outputTarget: d.OutputTargetDistCustomElements, ): ts.TransformerFactory => { return () => { return (tsSourceFile: ts.SourceFile): ts.SourceFile => { @@ -32,11 +32,11 @@ export const addDefineCustomElementFunctions = ( const customElementsDefineCallExpression = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('customElements'), 'define'), undefined, - [ts.factory.createIdentifier('tagName'), ts.factory.createIdentifier(principalComponent.componentClassName)] + [ts.factory.createIdentifier('tagName'), ts.factory.createIdentifier(principalComponent.componentClassName)], ); // create a `case` block that defines the current component. We'll add them to our switch statement later. caseStatements.push( - createCustomElementsDefineCase(principalComponent.tagName, customElementsDefineCallExpression) + createCustomElementsDefineCase(principalComponent.tagName, customElementsDefineCallExpression), ); setupComponentDependencies(moduleFile, components, newStatements, caseStatements, tagNames); @@ -44,7 +44,7 @@ export const addDefineCustomElementFunctions = ( if (outputTarget.customElementsExportBehavior === 'auto-define-custom-elements') { const conditionalDefineCustomElementCall = createAutoDefinitionExpression( - principalComponent.componentClassName + principalComponent.componentClassName, ); newStatements.push(conditionalDefineCustomElementCall); } @@ -70,7 +70,7 @@ const setupComponentDependencies = ( components: d.ComponentCompilerMeta[], newStatements: ts.Statement[], caseStatements: ts.CaseClause[], - tagNames: string[] + tagNames: string[], ) => { moduleFile.cmps.forEach((cmp) => { cmp.dependencies.forEach((dCmp) => { @@ -114,10 +114,10 @@ const createCustomElementsDefineCase = (tagName: string, actionExpression: ts.Ex ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('customElements'), 'get'), undefined, - [ts.factory.createIdentifier('tagName')] - ) + [ts.factory.createIdentifier('tagName')], + ), ), - ts.factory.createBlock([ts.factory.createExpressionStatement(actionExpression)]) + ts.factory.createBlock([ts.factory.createExpressionStatement(actionExpression)]), ), ts.factory.createBreakStatement(), ]); @@ -151,7 +151,7 @@ const createCustomElementsDefineCase = (tagName: string, actionExpression: ts.Ex const addDefineCustomElementFunction = ( tagNames: string[], newStatements: ts.Statement[], - caseStatements: ts.CaseClause[] + caseStatements: ts.CaseClause[], ) => { const newExpression = ts.factory.createFunctionDeclaration( [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)], @@ -165,9 +165,9 @@ const addDefineCustomElementFunction = ( ts.factory.createIfStatement( ts.factory.createStrictEquality( ts.factory.createTypeOfExpression(ts.factory.createIdentifier('customElements')), - ts.factory.createStringLiteral('undefined') + ts.factory.createStringLiteral('undefined'), ), - ts.factory.createBlock([ts.factory.createReturnStatement()]) + ts.factory.createBlock([ts.factory.createReturnStatement()]), ), ts.factory.createVariableStatement( undefined, @@ -178,12 +178,12 @@ const addDefineCustomElementFunction = ( undefined, undefined, ts.factory.createArrayLiteralExpression( - tagNames.map((tagName) => ts.factory.createStringLiteral(tagName)) - ) + tagNames.map((tagName) => ts.factory.createStringLiteral(tagName)), + ), ), ], - ts.NodeFlags.Const - ) + ts.NodeFlags.Const, + ), ), ts.factory.createExpressionStatement( ts.factory.createCallExpression( @@ -199,7 +199,7 @@ const addDefineCustomElementFunction = ( undefined, ts.factory.createIdentifier('tagName'), undefined, - undefined + undefined, ), ], undefined, @@ -207,16 +207,16 @@ const addDefineCustomElementFunction = ( ts.factory.createBlock([ ts.factory.createSwitchStatement( ts.factory.createIdentifier('tagName'), - ts.factory.createCaseBlock(caseStatements) + ts.factory.createCaseBlock(caseStatements), ), - ]) + ]), ), - ] - ) + ], + ), ), ], - true - ) + true, + ), ); newStatements.push(newExpression); }; @@ -233,6 +233,6 @@ function createAutoDefinitionExpression(componentName: string): ts.ExpressionSta return ts.factory.createExpressionStatement( ts.factory.createCallExpression(ts.factory.createIdentifier('defineCustomElement'), undefined, [ ts.factory.createIdentifier(componentName), - ]) + ]), ); } diff --git a/src/compiler/transformers/component-native/native-component.ts b/src/compiler/transformers/component-native/native-component.ts index bdd1def6b7d..84efd330f05 100644 --- a/src/compiler/transformers/component-native/native-component.ts +++ b/src/compiler/transformers/component-native/native-component.ts @@ -17,7 +17,7 @@ export const updateNativeComponentClass = ( transformOpts: d.TransformOptions, classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ): ts.ClassDeclaration | ts.VariableStatement => { const heritageClauses = updateNativeHostComponentHeritageClauses(classNode, moduleFile); const members = updateNativeHostComponentMembers(transformOpts, classNode, moduleFile, cmp); @@ -32,7 +32,7 @@ export const updateNativeComponentClass = ( */ const updateNativeHostComponentHeritageClauses = ( classNode: ts.ClassDeclaration, - moduleFile: d.Module + moduleFile: d.Module, ): ts.NodeArray | [ts.HeritageClause] => { if (classNode.heritageClauses != null && classNode.heritageClauses.length > 0) { // the syntax tree has a heritage clause already, don't generate a new one @@ -55,7 +55,7 @@ const updateNativeHostComponentMembers = ( transformOpts: d.TransformOptions, classNode: ts.ClassDeclaration, moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ): ts.ClassElement[] => { const classMembers = removeStaticMetaProperties(classNode); diff --git a/src/compiler/transformers/component-native/native-connected-callback.ts b/src/compiler/transformers/component-native/native-connected-callback.ts index 87b721153a6..578c42b2977 100644 --- a/src/compiler/transformers/component-native/native-connected-callback.ts +++ b/src/compiler/transformers/component-native/native-connected-callback.ts @@ -13,9 +13,9 @@ export const addNativeConnectedCallback = (classMembers: ts.ClassElement[], cmp: ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createThis(), 'render'), undefined, - undefined - ) - ) + undefined, + ), + ), ); const connectedCallback = classMembers.find((classMember) => { return ts.isMethodDeclaration(classMember) && (classMember.name as any).escapedText === 'connectedCallback'; @@ -31,7 +31,7 @@ export const addNativeConnectedCallback = (classMembers: ts.ClassElement[], cmp: undefined, [], undefined, - ts.factory.createBlock([fnCall, ...connectedCallback.body.statements], true) + ts.factory.createBlock([fnCall, ...connectedCallback.body.statements], true), ); const index = classMembers.indexOf(connectedCallback); classMembers[index] = callbackMethod; @@ -45,7 +45,7 @@ export const addNativeConnectedCallback = (classMembers: ts.ClassElement[], cmp: undefined, [], undefined, - ts.factory.createBlock([fnCall], true) + ts.factory.createBlock([fnCall], true), ); classMembers.push(callbackMethod); } diff --git a/src/compiler/transformers/component-native/native-constructor.ts b/src/compiler/transformers/component-native/native-constructor.ts index 69211626ed9..33f1942bc4b 100644 --- a/src/compiler/transformers/component-native/native-constructor.ts +++ b/src/compiler/transformers/component-native/native-constructor.ts @@ -20,7 +20,7 @@ import { retrieveTsModifiers } from '../transform-utils'; export const updateNativeConstructor = ( classMembers: ts.ClassElement[], moduleFile: d.Module, - cmp: d.ComponentCompilerMeta + cmp: d.ComponentCompilerMeta, ): void => { if (cmp.isPlain) { return; @@ -44,7 +44,7 @@ export const updateNativeConstructor = ( cstrMethod, retrieveTsModifiers(cstrMethod), cstrMethod.parameters, - ts.factory.updateBlock(cstrMethod.body, statements) + ts.factory.updateBlock(cstrMethod.body, statements), ); } else { // create a constructor() @@ -83,8 +83,8 @@ const nativeRegisterHostStatement = (): ts.ExpressionStatement => { ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createIdentifier('__registerHost')), undefined, - undefined - ) + undefined, + ), ); }; @@ -98,8 +98,8 @@ const nativeAttachShadowStatement = (): ts.ExpressionStatement => { ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createIdentifier('__attachShadow')), undefined, - undefined - ) + undefined, + ), ); }; @@ -109,6 +109,6 @@ const nativeAttachShadowStatement = (): ts.ExpressionStatement => { */ const createNativeConstructorSuper = (): ts.ExpressionStatement => { return ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createSuper(), undefined, undefined) + ts.factory.createCallExpression(ts.factory.createSuper(), undefined, undefined), ); }; diff --git a/src/compiler/transformers/component-native/native-element-getter.ts b/src/compiler/transformers/component-native/native-element-getter.ts index 6117d40be43..cb8803940e3 100644 --- a/src/compiler/transformers/component-native/native-element-getter.ts +++ b/src/compiler/transformers/component-native/native-element-getter.ts @@ -13,7 +13,7 @@ export const addNativeElementGetter = (classMembers: ts.ClassElement[], cmp: d.C cmp.elementRef, [], undefined, - ts.factory.createBlock([ts.factory.createReturnStatement(ts.factory.createThis())]) + ts.factory.createBlock([ts.factory.createReturnStatement(ts.factory.createThis())]), ); ts.SyntaxKind.AmpersandToken; @@ -21,7 +21,7 @@ export const addNativeElementGetter = (classMembers: ts.ClassElement[], cmp: d.C // ref identifier we have const index = classMembers.findIndex( (member) => - member.kind === ts.SyntaxKind.PropertyDeclaration && (member.name as any)?.escapedText === cmp.elementRef + member.kind === ts.SyntaxKind.PropertyDeclaration && (member.name as any)?.escapedText === cmp.elementRef, ); // Index should never not be a valid integer, but we'll be safe just in case. diff --git a/src/compiler/transformers/component-native/native-static-style.ts b/src/compiler/transformers/component-native/native-static-style.ts index c6c52ebf914..b6d787630f0 100644 --- a/src/compiler/transformers/component-native/native-static-style.ts +++ b/src/compiler/transformers/component-native/native-static-style.ts @@ -21,7 +21,7 @@ export const addNativeStaticStyle = (classMembers: ts.ClassElement[], cmp: d.Com const addMultipleModeStyleGetter = ( classMembers: ts.ClassElement[], cmp: d.ComponentCompilerMeta, - styles: d.StyleCompiler[] + styles: d.StyleCompiler[], ) => { const styleModes: ts.ObjectLiteralElementLike[] = []; @@ -57,7 +57,7 @@ const addMultipleModeStyleGetter = ( const addSingleStyleGetter = ( classMembers: ts.ClassElement[], cmp: d.ComponentCompilerMeta, - style: d.StyleCompiler + style: d.StyleCompiler, ) => { if (typeof style.styleStr === 'string') { // inline the style string diff --git a/src/compiler/transformers/component-native/proxy-custom-element-function.ts b/src/compiler/transformers/component-native/proxy-custom-element-function.ts index 9b978c90aef..ff1b0d8b3bd 100644 --- a/src/compiler/transformers/component-native/proxy-custom-element-function.ts +++ b/src/compiler/transformers/component-native/proxy-custom-element-function.ts @@ -29,7 +29,7 @@ import { getModuleFromSourceFile } from '../transform-utils'; */ export const proxyCustomElement = ( compilerCtx: d.CompilerCtx, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): ts.TransformerFactory => { return () => { return (tsSourceFile: ts.SourceFile): ts.SourceFile => { @@ -58,7 +58,7 @@ export const proxyCustomElement = ( ts.factory.createIdentifier(principalComponent.componentClassName), declaration.initializer.typeParameters, declaration.initializer.heritageClauses, - declaration.initializer.members + declaration.initializer.members, ); // wrap the Stencil component's class declaration in a component proxy @@ -71,7 +71,7 @@ export const proxyCustomElement = ( declaration.name, declaration.exclamationToken, declaration.type, - proxyCreationCall + proxyCreationCall, ); // update the declaration list that contains the updated variable declaration @@ -85,7 +85,7 @@ export const proxyCustomElement = ( const updatedVariableStatement = ts.factory.updateVariableStatement( stmt, stmt.modifiers, - updatedDeclarationList + updatedDeclarationList, ); // update the source file's statements to use the new variable statement @@ -100,7 +100,7 @@ export const proxyCustomElement = ( transformOpts, tsSourceFile, [RUNTIME_APIS.proxyCustomElement], - transformOpts.coreImportPath + transformOpts.coreImportPath, ); return tsSourceFile; diff --git a/src/compiler/transformers/component-native/tranform-to-native-component.ts b/src/compiler/transformers/component-native/tranform-to-native-component.ts index 06cb7b2fb0b..347a792f7bd 100644 --- a/src/compiler/transformers/component-native/tranform-to-native-component.ts +++ b/src/compiler/transformers/component-native/tranform-to-native-component.ts @@ -19,7 +19,7 @@ import { updateNativeComponentClass } from './native-component'; */ export const nativeComponentTransform = ( compilerCtx: d.CompilerCtx, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): ts.TransformerFactory => { return (transformCtx: ts.TransformationContext) => { return (tsSourceFile: ts.SourceFile) => { diff --git a/src/compiler/transformers/core-runtime-apis.ts b/src/compiler/transformers/core-runtime-apis.ts index faab64d5247..27e65115bbe 100644 --- a/src/compiler/transformers/core-runtime-apis.ts +++ b/src/compiler/transformers/core-runtime-apis.ts @@ -48,7 +48,7 @@ export const addCoreRuntimeApi = (moduleFile: d.Module, coreRuntimeApi: string): export const addOutputTargetCoreRuntimeApi = ( moduleFile: d.Module, outputTarget: d.OutputTarget['type'], - coreRuntimeApi: string + coreRuntimeApi: string, ): void => { if (!moduleFile.outputTargetCoreRuntimeApis[outputTarget]) { // no such output target-specific collection exists, create the empty collection diff --git a/src/compiler/transformers/create-event.ts b/src/compiler/transformers/create-event.ts index 2d1fee2165f..3ace3bfdc13 100644 --- a/src/compiler/transformers/create-event.ts +++ b/src/compiler/transformers/create-event.ts @@ -23,8 +23,8 @@ export const addCreateEvents = (moduleFile: d.Module, cmp: d.ComponentCompilerMe ts.factory.createThis(), ts.factory.createStringLiteral(ev.name), ts.factory.createNumericLiteral(computeFlags(ev)), - ]) - ) + ]), + ), ); }); }; diff --git a/src/compiler/transformers/decorators-to-static/component-decorator.ts b/src/compiler/transformers/decorators-to-static/component-decorator.ts index f68971c0469..a143de00fcd 100644 --- a/src/compiler/transformers/decorators-to-static/component-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/component-decorator.ts @@ -12,7 +12,7 @@ export const componentDecoratorToStatic = ( diagnostics: d.Diagnostic[], cmpNode: ts.ClassDeclaration, newMembers: ts.ClassElement[], - componentDecorator: ts.Decorator + componentDecorator: ts.Decorator, ) => { const [componentOptions] = getDeclarationParameters(componentDecorator); if (!componentOptions) { @@ -52,7 +52,7 @@ const validateComponent = ( typeChecker: ts.TypeChecker, componentOptions: d.ComponentOptions, cmpNode: ts.ClassDeclaration, - componentDecorator: ts.Node + componentDecorator: ts.Node, ) => { const extendNode = cmpNode.heritageClauses && cmpNode.heritageClauses.find((c) => c.token === ts.SyntaxKind.ExtendsKeyword); diff --git a/src/compiler/transformers/decorators-to-static/convert-decorators.ts b/src/compiler/transformers/decorators-to-static/convert-decorators.ts index d78f98cb6d8..6c5af5988a9 100644 --- a/src/compiler/transformers/decorators-to-static/convert-decorators.ts +++ b/src/compiler/transformers/decorators-to-static/convert-decorators.ts @@ -28,7 +28,7 @@ export const convertDecoratorsToStatic = ( config: d.Config, diagnostics: d.Diagnostic[], typeChecker: ts.TypeChecker, - program: ts.Program + program: ts.Program, ): ts.TransformerFactory => { return (transformCtx) => { const visit = (node: ts.Node): ts.VisitResult => { @@ -49,7 +49,7 @@ const visitClassDeclaration = ( diagnostics: d.Diagnostic[], typeChecker: ts.TypeChecker, program: ts.Program, - classNode: ts.ClassDeclaration + classNode: ts.ClassDeclaration, ) => { const componentDecorator = retrieveTsDecorators(classNode)?.find(isDecoratorNamed('Component')); if (!componentDecorator) { @@ -81,7 +81,7 @@ const visitClassDeclaration = ( decoratedMembers, typeChecker, program, - filteredMethodsAndFields + filteredMethodsAndFields, ); elementDecoratorsToStatic(diagnostics, decoratedMembers, typeChecker, filteredMethodsAndFields); watchDecoratorsToStatic(config, diagnostics, decoratedMembers, watchable, filteredMethodsAndFields); @@ -92,7 +92,7 @@ const visitClassDeclaration = ( const hasStaticMembersWithInit = classMembers.some(hasStaticInitializerInClass); if (hasStaticMembersWithInit) { filteredMethodsAndFields.push( - createStaticGetter('stencilHasStaticMembersWithInit', convertValueToLiteral(hasStaticMembersWithInit)) + createStaticGetter('stencilHasStaticMembersWithInit', convertValueToLiteral(hasStaticMembersWithInit)), ); } @@ -113,7 +113,7 @@ const visitClassDeclaration = ( classNode.name, classNode.typeParameters, classNode.heritageClauses, - updatedClassFields + updatedClassFields, ); }; @@ -135,7 +135,7 @@ const visitClassDeclaration = ( */ const removeStencilMethodDecorators = ( classMembers: ts.ClassElement[], - diagnostics: d.Diagnostic[] + diagnostics: d.Diagnostic[], ): ts.ClassElement[] => { return classMembers.map((member) => { const currentDecorators = retrieveTsDecorators(member); @@ -152,7 +152,7 @@ const removeStencilMethodDecorators = ( member.typeParameters, member.parameters, member.type, - member.body + member.body, ); } else if (ts.isPropertyDeclaration(member)) { if (shouldInitializeInConstructor(member)) { @@ -171,7 +171,7 @@ const removeStencilMethodDecorators = ( member.name, member.questionToken, member.type, - member.initializer + member.initializer, ); } } else { @@ -195,7 +195,7 @@ const removeStencilMethodDecorators = ( */ export const filterDecorators = ( decorators: ReadonlyArray | undefined, - excludeList: ReadonlyArray + excludeList: ReadonlyArray, ): ReadonlyArray | undefined => { if (decorators) { const updatedDecoratorList = decorators.filter((dec) => { @@ -360,9 +360,9 @@ function handleClassFields(classNode: ts.ClassDeclaration, classMembers: ts.Clas ts.factory.createToken(ts.SyntaxKind.EqualsToken), // if the member has no initializer we should default to setting it to // just 'undefined' - member.initializer ?? ts.factory.createIdentifier('undefined') - ) - ) + member.initializer ?? ts.factory.createIdentifier('undefined'), + ), + ), ); } else { // if it's not a class field that is decorated with a Stencil decorator then @@ -395,7 +395,7 @@ function handleClassFields(classNode: ts.ClassDeclaration, classMembers: ts.Clas export const updateConstructor = ( classNode: ts.ClassDeclaration, classMembers: ts.ClassElement[], - statements: ts.Statement[] + statements: ts.Statement[], ): ts.ClassElement[] => { const constructorIndex = classMembers.findIndex((m) => m.kind === ts.SyntaxKind.Constructor); const constructorMethod = classMembers[constructorIndex]; @@ -425,7 +425,7 @@ export const updateConstructor = ( constructorMethod, retrieveTsModifiers(constructorMethod), constructorMethod.parameters, - ts.factory.updateBlock(constructorMethod?.body ?? ts.factory.createBlock([]), statements) + ts.factory.updateBlock(constructorMethod?.body ?? ts.factory.createBlock([]), statements), ); } else { // we don't seem to have a constructor, so let's create one and stick it @@ -472,7 +472,7 @@ const needsSuper = (classDeclaration: ts.ClassDeclaration): boolean => { */ const createConstructorBodyWithSuper = (): ts.ExpressionStatement => { return ts.factory.createExpressionStatement( - ts.factory.createCallExpression(ts.factory.createIdentifier('super'), undefined, undefined) + ts.factory.createCallExpression(ts.factory.createIdentifier('super'), undefined, undefined), ); }; diff --git a/src/compiler/transformers/decorators-to-static/element-decorator.ts b/src/compiler/transformers/decorators-to-static/element-decorator.ts index 10d789987f9..8a297ff777c 100644 --- a/src/compiler/transformers/decorators-to-static/element-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/element-decorator.ts @@ -9,7 +9,7 @@ export const elementDecoratorsToStatic = ( diagnostics: d.Diagnostic[], decoratedMembers: ts.ClassElement[], typeChecker: ts.TypeChecker, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const elementRefs = decoratedMembers .filter(ts.isPropertyDeclaration) @@ -28,7 +28,7 @@ export const elementDecoratorsToStatic = ( const parseElementDecorator = ( _diagnostics: d.Diagnostic[], _typeChecker: ts.TypeChecker, - prop: ts.PropertyDeclaration + prop: ts.PropertyDeclaration, ): string | null => { const elementDecorator = retrieveTsDecorators(prop)?.find(isDecoratorNamed('Element')); diff --git a/src/compiler/transformers/decorators-to-static/event-decorator.ts b/src/compiler/transformers/decorators-to-static/event-decorator.ts index d461bffc276..39d810abacf 100644 --- a/src/compiler/transformers/decorators-to-static/event-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/event-decorator.ts @@ -18,7 +18,7 @@ export const eventDecoratorsToStatic = ( decoratedProps: ts.ClassElement[], typeChecker: ts.TypeChecker, program: ts.Program, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const events = decoratedProps .filter(ts.isPropertyDeclaration) @@ -45,7 +45,7 @@ const parseEventDecorator = ( diagnostics: d.Diagnostic[], typeChecker: ts.TypeChecker, program: ts.Program, - prop: ts.PropertyDeclaration + prop: ts.PropertyDeclaration, ): d.ComponentCompilerStaticEvent | null => { const eventDecorator = retrieveTsDecorators(prop)?.find(isDecoratorNamed('Event')); @@ -95,7 +95,7 @@ export const getEventName = (eventOptions: d.EventOptions, memberName: string) = const getComplexType = ( typeChecker: ts.TypeChecker, program: ts.Program, - node: ts.PropertyDeclaration + node: ts.PropertyDeclaration, ): d.ComponentCompilerPropertyComplexType => { const sourceFile = node.getSourceFile(); const eventType = node.type ? getEventType(node.type) : null; @@ -425,5 +425,5 @@ const DOM_EVENT_NAMES: Set = new Set( 'vrdisplaypresentchange', 'waiting', 'wheel', - ].map((e) => e.toLowerCase()) + ].map((e) => e.toLowerCase()), ); diff --git a/src/compiler/transformers/decorators-to-static/listen-decorator.ts b/src/compiler/transformers/decorators-to-static/listen-decorator.ts index 18d8d810677..aee00d1a4ff 100644 --- a/src/compiler/transformers/decorators-to-static/listen-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/listen-decorator.ts @@ -8,7 +8,7 @@ import { getDeclarationParameters, isDecoratorNamed } from './decorator-utils'; export const listenDecoratorsToStatic = ( diagnostics: d.Diagnostic[], decoratedMembers: ts.ClassElement[], - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const listeners = decoratedMembers .filter(ts.isMethodDeclaration) @@ -22,7 +22,7 @@ export const listenDecoratorsToStatic = ( const parseListenDecorators = ( diagnostics: d.Diagnostic[], - method: ts.MethodDeclaration + method: ts.MethodDeclaration, ): d.ComponentCompilerListener[] => { const listenDecorators = (retrieveTsDecorators(method) ?? []).filter(isDecoratorNamed('Listen')); if (listenDecorators.length === 0) { diff --git a/src/compiler/transformers/decorators-to-static/method-decorator.ts b/src/compiler/transformers/decorators-to-static/method-decorator.ts index a2a3fa785de..512195ba5ba 100644 --- a/src/compiler/transformers/decorators-to-static/method-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/method-decorator.ts @@ -24,7 +24,7 @@ export const methodDecoratorsToStatic = ( decoratedProps: ts.ClassElement[], typeChecker: ts.TypeChecker, program: ts.Program, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const tsSourceFile = cmpNode.getSourceFile(); const methods = decoratedProps @@ -43,7 +43,7 @@ const parseMethodDecorator = ( tsSourceFile: ts.SourceFile, typeChecker: ts.TypeChecker, program: ts.Program, - method: ts.MethodDeclaration + method: ts.MethodDeclaration, ): ts.PropertyAssignment | null => { const methodDecorator = retrieveTsDecorators(method)?.find(isDecoratorNamed('Method')); if (methodDecorator == null) { @@ -57,7 +57,7 @@ const parseMethodDecorator = ( const returnTypeNode = typeChecker.typeToTypeNode( returnType, method, - ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction + ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction, ); let returnString = typeToString(typeChecker, returnType); let signatureString = typeChecker.signatureToString(signature, method, flags, ts.SignatureKind.Call); @@ -108,7 +108,7 @@ const parseMethodDecorator = ( const staticProp = ts.factory.createPropertyAssignment( ts.factory.createStringLiteral(methodName), - convertValueToLiteral(methodMeta) + convertValueToLiteral(methodMeta), ); return staticProp; diff --git a/src/compiler/transformers/decorators-to-static/prop-decorator.ts b/src/compiler/transformers/decorators-to-static/prop-decorator.ts index cb3b97c1758..91e60c76d49 100644 --- a/src/compiler/transformers/decorators-to-static/prop-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/prop-decorator.ts @@ -36,7 +36,7 @@ export const propDecoratorsToStatic = ( typeChecker: ts.TypeChecker, program: ts.Program, watchable: Set, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ): void => { const properties = decoratedProps .filter(ts.isPropertyDeclaration) @@ -63,7 +63,7 @@ const parsePropDecorator = ( typeChecker: ts.TypeChecker, program: ts.Program, prop: ts.PropertyDeclaration, - watchable: Set + watchable: Set, ): ts.PropertyAssignment | null => { const propDecorator = retrieveTsDecorators(prop)?.find(isDecoratorNamed('Prop')); if (propDecorator == null) { @@ -118,7 +118,7 @@ const parsePropDecorator = ( const staticProp = ts.factory.createPropertyAssignment( ts.factory.createStringLiteral(propName), - convertValueToLiteral(propMeta) + convertValueToLiteral(propMeta), ); watchable.add(propName); return staticProp; @@ -168,7 +168,7 @@ const getComplexType = ( typeChecker: ts.TypeChecker, node: ts.PropertyDeclaration, type: ts.Type, - program: ts.Program + program: ts.Program, ): d.ComponentCompilerPropertyComplexType => { const nodeType = node.type; return { diff --git a/src/compiler/transformers/decorators-to-static/state-decorator.ts b/src/compiler/transformers/decorators-to-static/state-decorator.ts index 43738171301..7c0a2d8c3dc 100644 --- a/src/compiler/transformers/decorators-to-static/state-decorator.ts +++ b/src/compiler/transformers/decorators-to-static/state-decorator.ts @@ -17,7 +17,7 @@ import { isDecoratorNamed } from './decorator-utils'; export const stateDecoratorsToStatic = ( decoratedProps: ts.ClassElement[], watchable: Set, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const states = decoratedProps .filter(ts.isPropertyDeclaration) @@ -52,6 +52,6 @@ const stateDecoratorToStatic = (prop: ts.PropertyDeclaration, watchable: Set, - newMembers: ts.ClassElement[] + newMembers: ts.ClassElement[], ) => { const watchers = decoratedProps .filter(ts.isMethodDeclaration) @@ -27,7 +27,7 @@ const parseWatchDecorator = ( config: d.Config, diagnostics: d.Diagnostic[], watchable: Set, - method: ts.MethodDeclaration + method: ts.MethodDeclaration, ): d.ComponentCompilerWatch[] => { const methodName = method.name.getText(); const decorators = retrieveTsDecorators(method) ?? []; diff --git a/src/compiler/transformers/define-custom-element.ts b/src/compiler/transformers/define-custom-element.ts index c3063d7c735..103c5bc6849 100644 --- a/src/compiler/transformers/define-custom-element.ts +++ b/src/compiler/transformers/define-custom-element.ts @@ -8,14 +8,14 @@ import { convertValueToLiteral } from './transform-utils'; export const defineCustomElement = ( tsSourceFile: ts.SourceFile, moduleFile: d.Module, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ) => { let statements = tsSourceFile.statements.slice(); statements.push( ...moduleFile.cmps.map((cmp) => { return addDefineCustomElement(moduleFile, cmp); - }) + }), ); if (transformOpts.module === 'cjs') { @@ -33,14 +33,14 @@ const addDefineCustomElement = (moduleFile: d.Module, compilerMeta: d.ComponentC ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier('customElements'), - ts.factory.createIdentifier('define') + ts.factory.createIdentifier('define'), ), [], [ ts.factory.createStringLiteral(compilerMeta.tagName), ts.factory.createIdentifier(compilerMeta.componentClassName), - ] - ) + ], + ), ); } @@ -54,8 +54,8 @@ const addDefineCustomElement = (moduleFile: d.Module, compilerMeta: d.ComponentC ts.factory.createCallExpression( ts.factory.createIdentifier(DEFINE_CUSTOM_ELEMENT), [], - [liternalCmpClassName, liternalMeta] - ) + [liternalCmpClassName, liternalMeta], + ), ); }; diff --git a/src/compiler/transformers/host-data-transform.ts b/src/compiler/transformers/host-data-transform.ts index 5153ae51aea..260eabd2cea 100644 --- a/src/compiler/transformers/host-data-transform.ts +++ b/src/compiler/transformers/host-data-transform.ts @@ -6,11 +6,11 @@ import { retrieveModifierLike } from './transform-utils'; export const transformHostData = (classElements: ts.ClassElement[], moduleFile: d.Module) => { const hasHostData = classElements.some( - (e) => ts.isMethodDeclaration(e) && (e.name as any).escapedText === 'hostData' + (e) => ts.isMethodDeclaration(e) && (e.name as any).escapedText === 'hostData', ); if (hasHostData) { const renderIndex = classElements.findIndex( - (e) => ts.isMethodDeclaration(e) && (e.name as any).escapedText === 'render' + (e) => ts.isMethodDeclaration(e) && (e.name as any).escapedText === 'render', ); if (renderIndex >= 0) { const renderMethod = classElements[renderIndex] as ts.MethodDeclaration; @@ -23,7 +23,7 @@ export const transformHostData = (classElements: ts.ClassElement[], moduleFile: renderMethod.typeParameters, renderMethod.parameters, renderMethod.type, - renderMethod.body + renderMethod.body, ); } classElements.push(syntheticRender(moduleFile, renderIndex >= 0)); @@ -41,7 +41,7 @@ const syntheticRender = (moduleFile: d.Module, hasRender: boolean) => { ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createThis(), 'hostData'), undefined, - undefined + undefined, ), ]; if (hasRender) { @@ -50,8 +50,8 @@ const syntheticRender = (moduleFile: d.Module, hasRender: boolean) => { ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression(ts.factory.createThis(), INTERNAL_RENDER), undefined, - undefined - ) + undefined, + ), ); } @@ -70,9 +70,9 @@ const syntheticRender = (moduleFile: d.Module, hasRender: boolean) => { undefined, ts.factory.createBlock([ ts.factory.createReturnStatement( - ts.factory.createCallExpression(ts.factory.createIdentifier(H), undefined, hArguments) + ts.factory.createCallExpression(ts.factory.createIdentifier(H), undefined, hArguments), ), - ]) + ]), ); }; diff --git a/src/compiler/transformers/map-imports-to-path-aliases.ts b/src/compiler/transformers/map-imports-to-path-aliases.ts index 2a1e73189c5..46b0e54fe05 100644 --- a/src/compiler/transformers/map-imports-to-path-aliases.ts +++ b/src/compiler/transformers/map-imports-to-path-aliases.ts @@ -21,7 +21,7 @@ import { retrieveTsModifiers } from './transform-utils'; export const mapImportsToPathAliases = ( config: d.ValidatedConfig, destinationFilePath: string, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ): ts.TransformerFactory => { return (transformCtx) => { const compilerHost = ts.createCompilerHost(config.tsCompilerOptions); @@ -61,18 +61,18 @@ export const mapImportsToPathAliases = ( const extensionRegex = new RegExp( Object.values(ts.Extension) .map((extension) => `${extension}$`) - .join('|') + .join('|'), ); // In order to make sure the relative path works when the destination depth is different than the source // file structure depth, we need to determine where the resolved file exists relative to the destination directory const resolvePathInDestination = module.resolvedModule.resolvedFileName.replace( config.srcDir, - outputTarget.collectionDir + outputTarget.collectionDir, ); importPath = normalizePath( - relative(dirname(destinationFilePath), resolvePathInDestination).replace(extensionRegex, '') + relative(dirname(destinationFilePath), resolvePathInDestination).replace(extensionRegex, ''), ); // if the importee is a sibling file of the importer then `relative` will // produce a somewhat confusing result. We use `dirname` to get the @@ -115,7 +115,7 @@ export const mapImportsToPathAliases = ( retrieveTsModifiers(node), node.importClause, transformCtx.factory.createStringLiteral(importPath), - node.assertClause + node.assertClause, ); } diff --git a/src/compiler/transformers/reserved-public-members.ts b/src/compiler/transformers/reserved-public-members.ts index 858af0157f0..de40de6c0ee 100644 --- a/src/compiler/transformers/reserved-public-members.ts +++ b/src/compiler/transformers/reserved-public-members.ts @@ -18,7 +18,7 @@ export const validatePublicName = ( memberName: string, decorator: string, memberType: string, - node: ts.Node + node: ts.Node, ): void => { if (RESERVED_PUBLIC_MEMBERS.has(memberName.toLowerCase())) { const warn = buildWarn(diagnostics); diff --git a/src/compiler/transformers/rewrite-aliased-paths.ts b/src/compiler/transformers/rewrite-aliased-paths.ts index 42c1e6e7d56..53f22b4d8dd 100644 --- a/src/compiler/transformers/rewrite-aliased-paths.ts +++ b/src/compiler/transformers/rewrite-aliased-paths.ts @@ -12,7 +12,7 @@ import { retrieveTsModifiers } from './transform-utils'; * @returns a TypeScript transformer */ export function rewriteAliasedDTSImportPaths( - transformCtx: ts.TransformationContext + transformCtx: ts.TransformationContext, ): ts.Transformer { const compilerHost = ts.createCompilerHost(transformCtx.getCompilerOptions()); @@ -33,7 +33,7 @@ export function rewriteAliasedDTSImportPaths( * @returns a TypeScript transformer */ export function rewriteAliasedSourceFileImportPaths( - transformCtx: ts.TransformationContext + transformCtx: ts.TransformationContext, ): ts.Transformer { const compilerHost = ts.createCompilerHost(transformCtx.getCompilerOptions()); @@ -125,7 +125,7 @@ function rewriteAliasedImport( compilerHost: ts.CompilerHost, transformCtx: ts.TransformationContext, sourceFilePath: string, - node: ts.ImportDeclaration + node: ts.ImportDeclaration, ): ts.ImportDeclaration { // this most likely won't be the case, but we'll leave it to TypeScript to // error in the case that the user does something like `import foo from 3;` @@ -162,7 +162,7 @@ function rewriteAliasedImport( // need to escape periods (`"."`) so that they are correctly interpreted as // literal characters instead of as wildcards. .map((extension) => `${extension}$`.replace('.', '\\.')) - .join('|') + .join('|'), ); const resolvePathInDestination = module.resolvedModule.resolvedFileName; @@ -206,8 +206,8 @@ function rewriteAliasedImport( // Note also that any relative paths as module specifiers which _don't_ // need to be transformed (e.g. `'./foo'`) have already been handled // above. - importPath.startsWith('.') ? importPath : './' + importPath + importPath.startsWith('.') ? importPath : './' + importPath, ), - node.assertClause + node.assertClause, ); } diff --git a/src/compiler/transformers/static-to-meta/call-expression.ts b/src/compiler/transformers/static-to-meta/call-expression.ts index 20fd4a6d6eb..ba7fe20588c 100644 --- a/src/compiler/transformers/static-to-meta/call-expression.ts +++ b/src/compiler/transformers/static-to-meta/call-expression.ts @@ -22,7 +22,7 @@ export const parseCallExpression = (m: d.Module | d.ComponentCompilerMeta, node: const visitCallExpressionArgs = ( m: d.Module | d.ComponentCompilerMeta, callExpressionName: ts.Identifier, - args: ts.NodeArray + args: ts.NodeArray, ) => { const fnName = callExpressionName.escapedText as string; diff --git a/src/compiler/transformers/static-to-meta/component.ts b/src/compiler/transformers/static-to-meta/component.ts index 284a2f8e17c..96e68373e15 100644 --- a/src/compiler/transformers/static-to-meta/component.ts +++ b/src/compiler/transformers/static-to-meta/component.ts @@ -39,7 +39,7 @@ export const parseStaticComponentMeta = ( typeChecker: ts.TypeChecker, cmpNode: ts.ClassDeclaration, moduleFile: d.Module, - transformOpts?: d.TransformOptions + transformOpts?: d.TransformOptions, ): ts.ClassDeclaration => { if (cmpNode.members == null) { return cmpNode; diff --git a/src/compiler/transformers/static-to-meta/import.ts b/src/compiler/transformers/static-to-meta/import.ts index 494fc0af2b2..dc903ec5a2d 100644 --- a/src/compiler/transformers/static-to-meta/import.ts +++ b/src/compiler/transformers/static-to-meta/import.ts @@ -12,7 +12,7 @@ export const parseModuleImport = ( moduleFile: d.Module, dirPath: string, importNode: ts.ImportDeclaration, - resolveCollections: boolean + resolveCollections: boolean, ) => { if (importNode.moduleSpecifier && ts.isStringLiteral(importNode.moduleSpecifier)) { let importPath = importNode.moduleSpecifier.text; @@ -38,7 +38,7 @@ export const parseModuleImport = ( moduleFile, moduleFile.sourceFilePath, importPath, - resolveCollections + resolveCollections, ); } } diff --git a/src/compiler/transformers/static-to-meta/parse-static.ts b/src/compiler/transformers/static-to-meta/parse-static.ts index c05c8f0e4fb..dc2eb1af4e3 100644 --- a/src/compiler/transformers/static-to-meta/parse-static.ts +++ b/src/compiler/transformers/static-to-meta/parse-static.ts @@ -17,7 +17,7 @@ export const updateModule = ( sourceFileText: string, emitFilePath: string, typeChecker: ts.TypeChecker, - collection: d.CollectionCompilerMeta + collection: d.CollectionCompilerMeta, ) => { const sourceFilePath = normalizePath(tsSourceFile.fileName); const prevModuleFile = getModule(compilerCtx, sourceFilePath); @@ -73,7 +73,7 @@ export const updateModule = ( sourceFileText, tsSourceFile.languageVersion, true, - ts.ScriptKind.JS + ts.ScriptKind.JS, ); } return moduleFile; diff --git a/src/compiler/transformers/static-to-meta/styles.ts b/src/compiler/transformers/static-to-meta/styles.ts index 0be6b1378c7..e4395868aed 100644 --- a/src/compiler/transformers/static-to-meta/styles.ts +++ b/src/compiler/transformers/static-to-meta/styles.ts @@ -10,7 +10,7 @@ export const parseStaticStyles = ( tagName: string, componentFilePath: string, isCollectionDependency: boolean, - staticMembers: ts.ClassElement[] + staticMembers: ts.ClassElement[], ) => { const styles: d.StyleCompiler[] = []; const styleUrlsProp = isCollectionDependency ? 'styleUrls' : 'originalStyleUrls'; diff --git a/src/compiler/transformers/static-to-meta/vdom.ts b/src/compiler/transformers/static-to-meta/vdom.ts index f39a085f277..9e8c5ab5621 100644 --- a/src/compiler/transformers/static-to-meta/vdom.ts +++ b/src/compiler/transformers/static-to-meta/vdom.ts @@ -58,7 +58,7 @@ export const gatherVdomMeta = (m: d.Module | d.ComponentCompilerMeta, args: ts.N ...prop.initializer.text .toLowerCase() .split(' ') - .filter((part) => part.length > 0) + .filter((part) => part.length > 0), ); } m.htmlAttrNames.push(attrName); diff --git a/src/compiler/transformers/static-to-meta/visitor.ts b/src/compiler/transformers/static-to-meta/visitor.ts index c9e262f7bfa..50ddb35adf5 100644 --- a/src/compiler/transformers/static-to-meta/visitor.ts +++ b/src/compiler/transformers/static-to-meta/visitor.ts @@ -14,7 +14,7 @@ export const convertStaticToMeta = ( buildCtx: d.BuildCtx, typeChecker: ts.TypeChecker, collection: d.CollectionCompilerMeta, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): ts.TransformerFactory => { return (transformCtx) => { let dirPath: string; diff --git a/src/compiler/transformers/style-imports.ts b/src/compiler/transformers/style-imports.ts index d6c63ef6eac..e5556444bdc 100644 --- a/src/compiler/transformers/style-imports.ts +++ b/src/compiler/transformers/style-imports.ts @@ -7,7 +7,7 @@ import { retrieveTsModifiers } from './transform-utils'; export const updateStyleImports = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, - moduleFile: d.Module + moduleFile: d.Module, ) => { // add style imports built from @Component() styleUrl option if (transformOpts.module === 'cjs') { @@ -20,7 +20,7 @@ export const updateStyleImports = ( const updateEsmStyleImports = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, - moduleFile: d.Module + moduleFile: d.Module, ) => { const styleImports: ts.Statement[] = []; let statements = tsSourceFile.statements.slice(); @@ -63,7 +63,7 @@ const updateEsmStyleImportPath = ( tsSourceFile: ts.SourceFile, statements: ts.Statement[], cmp: d.ComponentCompilerMeta, - style: d.StyleCompiler + style: d.StyleCompiler, ): ts.Statement[] => { for (let i = 0; i < statements.length; i++) { const n = statements[i]; @@ -77,7 +77,7 @@ const updateEsmStyleImportPath = ( retrieveTsModifiers(n), n.importClause, ts.factory.createStringLiteral(importPath), - undefined + undefined, ); break; } @@ -90,7 +90,7 @@ const createEsmStyleImport = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, cmp: d.ComponentCompilerMeta, - style: d.StyleCompiler + style: d.StyleCompiler, ) => { const importName = ts.factory.createIdentifier(style.styleIdentifier); const importPath = getStyleImportPath(transformOpts, tsSourceFile, cmp, style, style.externalStyles[0].absolutePath); @@ -98,14 +98,14 @@ const createEsmStyleImport = ( return ts.factory.createImportDeclaration( undefined, ts.factory.createImportClause(false, importName, undefined), - ts.factory.createStringLiteral(importPath) + ts.factory.createStringLiteral(importPath), ); }; const updateCjsStyleRequires = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, - moduleFile: d.Module + moduleFile: d.Module, ) => { const styleRequires: ts.Statement[] = []; @@ -129,7 +129,7 @@ const createCjsStyleRequire = ( transformOpts: d.TransformOptions, tsSourceFile: ts.SourceFile, cmp: d.ComponentCompilerMeta, - style: d.StyleCompiler + style: d.StyleCompiler, ) => { const importName = ts.factory.createIdentifier(style.styleIdentifier); const importPath = getStyleImportPath(transformOpts, tsSourceFile, cmp, style, style.externalStyles[0].absolutePath); @@ -145,12 +145,12 @@ const createCjsStyleRequire = ( ts.factory.createCallExpression( ts.factory.createIdentifier('require'), [], - [ts.factory.createStringLiteral(importPath)] - ) + [ts.factory.createStringLiteral(importPath)], + ), ), ], - ts.NodeFlags.Const - ) + ts.NodeFlags.Const, + ), ); }; @@ -159,7 +159,7 @@ const getStyleImportPath = ( tsSourceFile: ts.SourceFile, cmp: d.ComponentCompilerMeta, style: d.StyleCompiler, - importPath: string + importPath: string, ) => { const importData: d.SerializeImportData = { importeePath: importPath, diff --git a/src/compiler/transformers/test/add-component-meta-proxy.spec.ts b/src/compiler/transformers/test/add-component-meta-proxy.spec.ts index 8f6228456c0..1dadbd534a1 100644 --- a/src/compiler/transformers/test/add-component-meta-proxy.spec.ts +++ b/src/compiler/transformers/test/add-component-meta-proxy.spec.ts @@ -32,13 +32,13 @@ describe('add-component-meta-proxy', () => { 'MyComponent', undefined, [htmlElementHeritageClause], - [] + [], ); literalMetadata = ts.factory.createStringLiteral('MyComponent'); formatComponentRuntimeMetaSpy = jest.spyOn(FormatComponentRuntimeMeta, 'formatComponentRuntimeMeta'); formatComponentRuntimeMetaSpy.mockImplementation( - (_compilerMeta: d.ComponentCompilerMeta, _includeMethods: boolean) => [0, 'tag-name'] + (_compilerMeta: d.ComponentCompilerMeta, _includeMethods: boolean) => [0, 'tag-name'], ); convertValueToLiteralSpy = jest.spyOn(TransformUtils, 'convertValueToLiteral'); diff --git a/src/compiler/transformers/test/convert-decorators.spec.ts b/src/compiler/transformers/test/convert-decorators.spec.ts index 4c0147f7362..9d3bfcde523 100644 --- a/src/compiler/transformers/test/convert-decorators.spec.ts +++ b/src/compiler/transformers/test/convert-decorators.spec.ts @@ -52,7 +52,7 @@ describe('convert-decorators', () => { "defaultValue": "\\"initial value\\"" } }; - }}` + }}`, ); }); @@ -70,7 +70,7 @@ describe('convert-decorators', () => { expect(await formatCode(t.outputText)).toContain( ` constructor() { this.val = undefined; - }` + }`, ); }); @@ -95,7 +95,7 @@ describe('convert-decorators', () => { } static get states() { return { "count": {}}; - }}` + }}`, ); }); @@ -113,7 +113,7 @@ describe('convert-decorators', () => { await c`export class CmpA { static get is() { return "cmp-a"; - }}` + }}`, ); }); @@ -123,7 +123,7 @@ describe('convert-decorators', () => { export class CmpA extends Foobar { @State() count: number = 0; } - ` + `, ); expect(await formatCode(t.outputText)).toBe( @@ -134,7 +134,7 @@ describe('convert-decorators', () => { } static get states() { return { "count": {} }; - }}` + }}`, ); }); @@ -156,7 +156,7 @@ describe('convert-decorators', () => { } static get is() { return "my-component"; - }}` + }}`, ); }); @@ -177,7 +177,7 @@ describe('convert-decorators', () => { ` constructor() { this.count = undefined; console.log('boop'); - }` + }`, ); }); @@ -192,7 +192,7 @@ describe('convert-decorators', () => { constructor() { this.count = 3; } - }` + }`, ); // the initialization we do to `undefined` (since no value is present) @@ -202,7 +202,7 @@ describe('convert-decorators', () => { ` constructor() { this.count = undefined; this.count = 3; - }` + }`, ); }); @@ -223,7 +223,7 @@ describe('convert-decorators', () => { await c`export class Example { constructor() { this.classProps = ["variant", "theme"]; - }}` + }}`, ); }); @@ -245,7 +245,7 @@ describe('convert-decorators', () => { super(); this.foo = 'bar'; console.log('hello!'); - }` + }`, ); }); @@ -267,7 +267,7 @@ describe('convert-decorators', () => { } static get states() { return { "count": {} }; - }}` + }}`, ); }); @@ -303,7 +303,7 @@ describe('convert-decorators', () => { "docs": { "tags": [], "text": "" }, "complexType": { "original": "{ mph: number }", "resolved": "{ mph: number; }", "references": {} } }]; - }}` + }}`, ); }); @@ -314,7 +314,7 @@ describe('convert-decorators', () => { const filteredDecorators = filterDecorators(undefined, excludeList); expect(filteredDecorators).toBeUndefined(); - } + }, ); it.each>>([[[]], [['ExcludedDecorator']]])( @@ -323,7 +323,7 @@ describe('convert-decorators', () => { const filteredDecorators = filterDecorators([], excludeList); expect(filteredDecorators).toBeUndefined(); - } + }, ); it('returns a decorator if it is not a call expression', () => { @@ -340,11 +340,11 @@ describe('convert-decorators', () => { it("doesn't return any decorators when all decorators in the exclude list", () => { // create a '@CustomProp()' decorator const customDecorator = ts.factory.createDecorator( - ts.factory.createCallExpression(ts.factory.createIdentifier('CustomProp'), undefined, []) + ts.factory.createCallExpression(ts.factory.createIdentifier('CustomProp'), undefined, []), ); // create '@Prop()' decorator const decorator = ts.factory.createDecorator( - ts.factory.createCallExpression(ts.factory.createIdentifier('Prop'), undefined, []) + ts.factory.createCallExpression(ts.factory.createIdentifier('Prop'), undefined, []), ); const filteredDecorators = filterDecorators([customDecorator, decorator], ['Prop', 'CustomProp']); @@ -355,11 +355,11 @@ describe('convert-decorators', () => { it('returns any decorators not in the exclude list', () => { // create a '@CustomProp()' decorator const customDecorator = ts.factory.createDecorator( - ts.factory.createCallExpression(ts.factory.createIdentifier('CustomProp'), undefined, []) + ts.factory.createCallExpression(ts.factory.createIdentifier('CustomProp'), undefined, []), ); // create '@Prop()' decorator const decorator = ts.factory.createDecorator( - ts.factory.createCallExpression(ts.factory.createIdentifier('Prop'), undefined, []) + ts.factory.createCallExpression(ts.factory.createIdentifier('Prop'), undefined, []), ); const filteredDecorators = filterDecorators([customDecorator, decorator], ['Prop']); diff --git a/src/compiler/transformers/test/convert-static-members.spec.ts b/src/compiler/transformers/test/convert-static-members.spec.ts index 130605c5abe..e81b3f1c098 100644 --- a/src/compiler/transformers/test/convert-static-members.spec.ts +++ b/src/compiler/transformers/test/convert-static-members.spec.ts @@ -16,9 +16,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(true); }); @@ -35,9 +35,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(true); }); @@ -55,17 +55,17 @@ describe('convert-static-members', () => { ts.factory.createCallExpression( ts.factory.createIdentifier('SomeDecorator'), // Imaginary decorator undefined, - [] - ) + [], + ), ), ts.factory.createToken(ts.SyntaxKind.StaticKeyword), ], ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(true); }); @@ -85,20 +85,20 @@ describe('convert-static-members', () => { ts.factory.createCallExpression( ts.factory.createIdentifier(decoratorName), // Stencil decorator undefined, - [] - ) + [], + ), ), ts.factory.createToken(ts.SyntaxKind.StaticKeyword), ], ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); - } + }, ); it('returns true for a static property with an initializer with multiple members', () => { @@ -113,16 +113,16 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('nonStaticProperty'), undefined, undefined, - ts.factory.createStringLiteral('some value') + ts.factory.createStringLiteral('some value'), ), ts.factory.createPropertyDeclaration( [ts.factory.createToken(ts.SyntaxKind.StaticKeyword)], ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(true); }); @@ -133,7 +133,7 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('ClassWithNoMembers'), undefined, undefined, - [] // no members for this class + [], // no members for this class ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); }); @@ -150,9 +150,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - undefined // the initializer is false + undefined, // the initializer is false ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); }); @@ -169,9 +169,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - undefined // the initializer is false + undefined, // the initializer is false ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); }); @@ -188,9 +188,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); }); @@ -207,9 +207,9 @@ describe('convert-static-members', () => { ts.factory.createIdentifier('propertyName'), undefined, undefined, - ts.factory.createStringLiteral('initial value') + ts.factory.createStringLiteral('initial value'), ), - ] + ], ); expect(classWithStaticMembers.members.some(hasStaticInitializerInClass)).toBe(false); }); diff --git a/src/compiler/transformers/test/core-runtime-apis.spec.ts b/src/compiler/transformers/test/core-runtime-apis.spec.ts index eb098fee806..59b8ac16200 100644 --- a/src/compiler/transformers/test/core-runtime-apis.spec.ts +++ b/src/compiler/transformers/test/core-runtime-apis.spec.ts @@ -13,7 +13,7 @@ describe('addCoreRuntimeApi()', () => { mockModule = createModule( ts.createSourceFile('mock-file.ts', sourceText, ts.ScriptTarget.ES5), sourceText, - 'mock-file.js' + 'mock-file.js', ); }); @@ -49,7 +49,7 @@ describe('addOutputTargetCoreRuntimeApi()', () => { mockModule = createModule( ts.createSourceFile('mock-file.ts', sourceText, ts.ScriptTarget.ES5), sourceText, - 'mock-file.js' + 'mock-file.js', ); }); @@ -87,7 +87,7 @@ describe('addLegacyApis()', () => { mockModule = createModule( ts.createSourceFile('mock-file.ts', sourceText, ts.ScriptTarget.ES5), sourceText, - 'mock-file.js' + 'mock-file.js', ); }); diff --git a/src/compiler/transformers/test/map-imports-to-path-aliases.spec.ts b/src/compiler/transformers/test/map-imports-to-path-aliases.spec.ts index 4d656d6c3f8..75e55829b23 100644 --- a/src/compiler/transformers/test/map-imports-to-path-aliases.spec.ts +++ b/src/compiler/transformers/test/map-imports-to-path-aliases.spec.ts @@ -146,7 +146,7 @@ describe('mapImportsToPathAliases', () => { config, null, [], - [mapImportsToPathAliases(config, '/dist/collection/test.js', outputTarget)] + [mapImportsToPathAliases(config, '/dist/collection/test.js', outputTarget)], ); expect(module.outputText).toContain(`import { utils } from "../../some-compiled-dir/utils/utils";`); @@ -173,7 +173,7 @@ describe('mapImportsToPathAliases', () => { config, null, [], - [mapImportsToPathAliases(config, 'dist/collection/test.js', outputTarget)] + [mapImportsToPathAliases(config, 'dist/collection/test.js', outputTarget)], ); expect(module.outputText).toContain(`import { utils } from "./utils/utils";`); diff --git a/src/compiler/transformers/test/native-constructor.spec.ts b/src/compiler/transformers/test/native-constructor.spec.ts index f366316bcd3..99b3ad8b671 100644 --- a/src/compiler/transformers/test/native-constructor.spec.ts +++ b/src/compiler/transformers/test/native-constructor.spec.ts @@ -38,7 +38,7 @@ describe('nativeComponentTransform', () => { const transpiledModule = transpileModule(code, null, compilerCtx, [], [transformer]); expect(transpiledModule.outputText).toContain( - `import { defineCustomElement as __stencil_defineCustomElement, HTMLElement } from "@stencil/core";` + `import { defineCustomElement as __stencil_defineCustomElement, HTMLElement } from "@stencil/core";`, ); expect(transpiledModule.outputText).toContain(`this.__attachShadow()`); }); @@ -63,7 +63,7 @@ describe('nativeComponentTransform', () => { const transpiledModule = transpileModule(code, null, compilerCtx, [], [transformer]); expect(transpiledModule.outputText).toContain( - `import { defineCustomElement as __stencil_defineCustomElement, HTMLElement } from "@stencil/core";` + `import { defineCustomElement as __stencil_defineCustomElement, HTMLElement } from "@stencil/core";`, ); expect(transpiledModule.outputText).toContain(`this.__attachShadow()`); }); diff --git a/src/compiler/transformers/test/parse-import-path.spec.ts b/src/compiler/transformers/test/parse-import-path.spec.ts index 853e9768a2b..0d45acdc80c 100644 --- a/src/compiler/transformers/test/parse-import-path.spec.ts +++ b/src/compiler/transformers/test/parse-import-path.spec.ts @@ -7,7 +7,7 @@ describe('stencil-import-path', () => { importeePath: '/path/to/some-file.css', importerPath: '/path/to/some-file.js', }, - undefined + undefined, ); expect(s).toBe('./some-file.css'); const p = parseImportPath(s); @@ -23,7 +23,7 @@ describe('stencil-import-path', () => { importeePath: './some-file', tag: 'my-tag', }, - undefined + undefined, ); expect(s).toBe('./some-file?tag=my-tag'); const p = parseImportPath(s); @@ -41,7 +41,7 @@ describe('stencil-import-path', () => { encapsulation: 'none', mode: '$', }, - undefined + undefined, ); expect(s).toBe('./some-file.CSS?tag=my-tag'); const p = parseImportPath(s); @@ -61,7 +61,7 @@ describe('stencil-import-path', () => { encapsulation: 'scoped', mode: 'ios', }, - 'queryparams' + 'queryparams', ); expect(s).toBe('./some-file.CSS?tag=my-tag&mode=ios&encapsulation=scoped'); const p = parseImportPath(s); @@ -81,7 +81,7 @@ describe('stencil-import-path', () => { encapsulation: 'scoped', mode: 'ios', }, - null + null, ); expect(s).toBe('./some-file.CSS'); const p = parseImportPath(s); @@ -96,7 +96,7 @@ describe('stencil-import-path', () => { { importeePath: './some-file.d.ts', }, - undefined + undefined, ); expect(s).toBe('./some-file.d.ts'); const p = parseImportPath(s); diff --git a/src/compiler/transformers/test/parse-styles.spec.ts b/src/compiler/transformers/test/parse-styles.spec.ts index 44b6f5c5fda..674dc3f8de4 100644 --- a/src/compiler/transformers/test/parse-styles.spec.ts +++ b/src/compiler/transformers/test/parse-styles.spec.ts @@ -52,8 +52,8 @@ describe('parse styles', () => { `); expect(await formatCode(t.outputText)).toEqual( await formatCode( - `const md = 'p{color:red}';const ios = 'p{color:black}';export class CmpA { static get is() { return "cmp-a"; } static get styles() { return { "md": md, "ios": ios }; }}` - ) + `const md = 'p{color:red}';const ios = 'p{color:black}';export class CmpA { static get is() { return "cmp-a"; } static get styles() { return { "md": md, "ios": ios }; }}`, + ), ); }); @@ -86,8 +86,8 @@ describe('parse styles', () => { `); expect(await formatCode(t.outputText)).toEqual( await formatCode( - `const styles = 'p{color:red}';export class CmpA { static get is() { return "cmp-a"; } static get styles() { return styles; }}` - ) + `const styles = 'p{color:red}';export class CmpA { static get is() { return "cmp-a"; } static get styles() { return styles; }}`, + ), ); }); }); diff --git a/src/compiler/transformers/test/proxy-custom-element-function.spec.ts b/src/compiler/transformers/test/proxy-custom-element-function.spec.ts index 1851ba0bb76..552a5c4eb8f 100644 --- a/src/compiler/transformers/test/proxy-custom-element-function.spec.ts +++ b/src/compiler/transformers/test/proxy-custom-element-function.spec.ts @@ -53,8 +53,8 @@ describe('proxy-custom-element-function', () => { ts.factory.createCallExpression( ts.factory.createIdentifier(PROXY_CUSTOM_ELEMENT), [], - [clazz, ts.factory.createTrue()] - ) + [clazz, ts.factory.createTrue()], + ), ); }); @@ -71,7 +71,7 @@ describe('proxy-custom-element-function', () => { const transpiledModule = transpileModule(code, null, compilerCtx, [], [transformer]); expect(transpiledModule.outputText).toContain( - `import { proxyCustomElement as __stencil_proxyCustomElement } from "@stencil/core";` + `import { proxyCustomElement as __stencil_proxyCustomElement } from "@stencil/core";`, ); }); @@ -83,8 +83,8 @@ describe('proxy-custom-element-function', () => { expect(await formatCode(transpiledModule.outputText)).toContain( await formatCode( - `const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);` - ) + `const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);`, + ), ); }); @@ -96,8 +96,8 @@ describe('proxy-custom-element-function', () => { expect(await formatCode(transpiledModule.outputText)).toContain( await formatCode( - `export const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);` - ) + `export const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);`, + ), ); }); @@ -110,8 +110,8 @@ describe('proxy-custom-element-function', () => { expect(await formatCode(transpiledModule.outputText)).toContain( await formatCode( - `const foo = 'hello world!', ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);` - ) + `const foo = 'hello world!', ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true);`, + ), ); }); @@ -123,8 +123,8 @@ describe('proxy-custom-element-function', () => { expect(await formatCode(transpiledModule.outputText)).toContain( await formatCode( - `const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true), foo = 'hello world!';` - ) + `const ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true), foo = 'hello world!';`, + ), ); }); @@ -136,8 +136,8 @@ describe('proxy-custom-element-function', () => { expect(await formatCode(transpiledModule.outputText)).toContain( await formatCode( - `const foo = 'hello world!', ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true), bar = 'goodbye?';` - ) + `const foo = 'hello world!', ${componentClassName} = /*@__PURE__*/ __stencil_proxyCustomElement(class ${componentClassName} extends HTMLElement {}, true), bar = 'goodbye?';`, + ), ); }); }); diff --git a/src/compiler/transformers/test/rewrite-aliased-paths.spec.ts b/src/compiler/transformers/test/rewrite-aliased-paths.spec.ts index 0dfffda0c88..dc1d3129a5b 100644 --- a/src/compiler/transformers/test/rewrite-aliased-paths.spec.ts +++ b/src/compiler/transformers/test/rewrite-aliased-paths.spec.ts @@ -41,7 +41,7 @@ async function pathTransformTranspile(component: string, inputFileName = 'module await compilerContext.fs.writeFile(path.join(config.rootDir, 'name/space/subdir.ts'), 'export const bar = x => x;'); await compilerContext.fs.writeFile( path.join(config.rootDir, 'name/space/keyboard.ts'), - 'export const keyboard = "keyboard"' + 'export const keyboard = "keyboard"', ); return transpileModule( @@ -52,7 +52,7 @@ async function pathTransformTranspile(component: string, inputFileName = 'module [], [rewriteAliasedDTSImportPaths], mockPathsConfig, - normalizePath(path.join(config.rootDir, inputFileName)) + normalizePath(path.join(config.rootDir, inputFileName)), ); } @@ -69,8 +69,8 @@ describe('rewrite alias module paths transform', () => { expect(await formatCode(t.outputText)).toBe( await formatCode( - 'import { foo } from "./name/space";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}' - ) + 'import { foo } from "./name/space";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}', + ), ); }); @@ -86,8 +86,8 @@ describe('rewrite alias module paths transform', () => { expect(await formatCode(t.outputText)).toBe( await formatCode( - 'import { foo } from "./name/space/subdir";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}' - ) + 'import { foo } from "./name/space/subdir";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}', + ), ); }); @@ -106,7 +106,7 @@ describe('rewrite alias module paths transform', () => { `); expect(await formatCode(t.declarationOutputText)).toBe( - await formatCode('import { Foo } from "./name/space";export declare class CmpA { field: Foo; render(): any;}') + await formatCode('import { Foo } from "./name/space";export declare class CmpA { field: Foo; render(): any;}'), ); }); @@ -120,7 +120,7 @@ describe('rewrite alias module paths transform', () => { `); expect(await formatCode(t.declarationOutputText)).toBe( - await formatCode('import { Foo } from "./name/space/subdir";export declare function fooUtil(foo: Foo): Foo;') + await formatCode('import { Foo } from "./name/space/subdir";export declare function fooUtil(foo: Foo): Foo;'), ); }); @@ -136,8 +136,8 @@ describe('rewrite alias module paths transform', () => { expect(await formatCode(t.declarationOutputText)).toBe( await formatCode( - 'import { Foo } from "./name/space/subdir";import { Bar } from "./name/space";export declare function fooUtil(foo: Foo): Bar;' - ) + 'import { Foo } from "./name/space/subdir";import { Bar } from "./name/space";export declare function fooUtil(foo: Foo): Bar;', + ), ); }); @@ -153,8 +153,8 @@ describe('rewrite alias module paths transform', () => { expect(await formatCode(t.declarationOutputText)).toBe( await formatCode( - 'import { Foo } from "./name/space/subdir";import { Bar } from "./name/space";export declare function fooUtil(foo: Foo): Bar;' - ) + 'import { Foo } from "./name/space/subdir";import { Bar } from "./name/space";export declare function fooUtil(foo: Foo): Bar;', + ), ); }); @@ -168,7 +168,7 @@ describe('rewrite alias module paths transform', () => { } } `, - 'name/component.tsx' + 'name/component.tsx', ); // with the import filename passed to `pathTransformTranspile` the file @@ -184,8 +184,8 @@ describe('rewrite alias module paths transform', () => { // `name/space.ts` is resolved correctly as `'./space'`. expect(await formatCode(t.outputText)).toBe( await formatCode( - 'import { foo } from "./space";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}' - ) + 'import { foo } from "./space";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}', + ), ); }); @@ -199,7 +199,7 @@ describe('rewrite alias module paths transform', () => { } } `, - 'name/component.tsx' + 'name/component.tsx', ); // with the import filename passed to `pathTransformTranspile` the file @@ -221,8 +221,8 @@ describe('rewrite alias module paths transform', () => { render() { return h("some-cmp", null, foo("bar")); } - }` - ) + }`, + ), ); }); @@ -240,8 +240,8 @@ describe('rewrite alias module paths transform', () => { expect(await formatCode(t.outputText)).toBe( await formatCode( - 'import { foo } from "./name/space/keyboard";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}' - ) + 'import { foo } from "./name/space/keyboard";export class CmpA { render() { return h("some-cmp", null, foo("bar")); }}', + ), ); }); }); diff --git a/src/compiler/transformers/test/transform-utils.spec.ts b/src/compiler/transformers/test/transform-utils.spec.ts index 5fc39074125..5350f3ea4b3 100644 --- a/src/compiler/transformers/test/transform-utils.spec.ts +++ b/src/compiler/transformers/test/transform-utils.spec.ts @@ -61,7 +61,7 @@ describe('transform-utils', () => { * @returns a new empty method */ const createMemberWithModifiers = ( - modifiers: ReadonlyArray | undefined = undefined + modifiers: ReadonlyArray | undefined = undefined, ): ts.MethodDeclaration => { return ts.factory.createMethodDeclaration( modifiers, @@ -71,7 +71,7 @@ describe('transform-utils', () => { undefined, [], undefined, - ts.factory.createBlock([], false) + ts.factory.createBlock([], false), ); }; diff --git a/src/compiler/transformers/test/transpile.ts b/src/compiler/transformers/test/transpile.ts index 984faeb6042..97adedaad36 100644 --- a/src/compiler/transformers/test/transpile.ts +++ b/src/compiler/transformers/test/transpile.ts @@ -29,7 +29,7 @@ export function transpileModule( afterTransformers: ts.TransformerFactory[] = [], afterDeclarations: ts.TransformerFactory[] = [], tsConfig: ts.CompilerOptions = {}, - inputFileName = 'module.tsx' + inputFileName = 'module.tsx', ) { const options: ts.CompilerOptions = { ...ts.getDefaultCompilerOptions(), diff --git a/src/compiler/transformers/test/type-library.spec.ts b/src/compiler/transformers/test/type-library.spec.ts index 67381a8538b..337b03e101d 100644 --- a/src/compiler/transformers/test/type-library.spec.ts +++ b/src/compiler/transformers/test/type-library.spec.ts @@ -42,7 +42,7 @@ describe('type library', () => { config.logger = logger; addFileToLibrary(config, 'fixtures/not-found.ts'); expect(warnMock).toHaveBeenCalledWith( - 'docs-json: unable to gather type information from "fixtures/not-found.ts". Please double check this path exists relative to your project root.' + 'docs-json: unable to gather type information from "fixtures/not-found.ts". Please double check this path exists relative to your project root.', ); teardownConsoleMocks(); }); diff --git a/src/compiler/transformers/transform-utils.ts b/src/compiler/transformers/transform-utils.ts index 68a30e8142b..ac8b2a17155 100644 --- a/src/compiler/transformers/transform-utils.ts +++ b/src/compiler/transformers/transform-utils.ts @@ -17,7 +17,7 @@ export const getScriptTarget = () => { */ export const isMemberPrivate = (member: ts.ClassElement): boolean => { return !!retrieveTsModifiers(member)?.some( - (m) => m.kind === ts.SyntaxKind.PrivateKeyword || m.kind === ts.SyntaxKind.ProtectedKeyword + (m) => m.kind === ts.SyntaxKind.PrivateKeyword || m.kind === ts.SyntaxKind.ProtectedKeyword, ); }; @@ -40,7 +40,7 @@ export const isMemberPrivate = (member: ts.ClassElement): boolean => { */ export const convertValueToLiteral = ( val: any, - refs: WeakSet = null + refs: WeakSet = null, ): | ts.Identifier | ts.StringLiteral @@ -140,7 +140,7 @@ const objectToObjectLiteral = (obj: { [key: string]: any }, refs: WeakSet): const newProperties: ts.ObjectLiteralElementLike[] = Object.keys(obj).map((key) => { const prop = ts.factory.createPropertyAssignment( ts.factory.createStringLiteral(key), - convertValueToLiteral(obj[key], refs) as ts.Expression + convertValueToLiteral(obj[key], refs) as ts.Expression, ); return prop; }); @@ -162,7 +162,7 @@ export const createStaticGetter = (propName: string, returnExpression: ts.Expres propName, [], undefined, - ts.factory.createBlock([ts.factory.createReturnStatement(returnExpression)]) + ts.factory.createBlock([ts.factory.createReturnStatement(returnExpression)]), ); }; @@ -175,14 +175,14 @@ export const createStaticGetter = (propName: string, returnExpression: ts.Expres */ export const getStaticValue = (staticMembers: ts.ClassElement[], staticName: string): any => { const staticMember: ts.GetAccessorDeclaration = staticMembers.find( - (member) => (member.name as any).escapedText === staticName + (member) => (member.name as any).escapedText === staticName, ) as any; if (!staticMember || !staticMember.body || !staticMember.body.statements) { return null; } const rtnStatement: ts.ReturnStatement = staticMember.body.statements.find( - (s) => s.kind === ts.SyntaxKind.ReturnStatement + (s) => s.kind === ts.SyntaxKind.ReturnStatement, ) as any; if (!rtnStatement || !rtnStatement.expression) { return null; @@ -380,7 +380,7 @@ export const getAttributeTypeInfo = ( baseNode: ts.Node, sourceFile: ts.SourceFile, checker: ts.TypeChecker, - program: ts.Program + program: ts.Program, ): d.ComponentCompilerTypeReferences => { const allReferences: d.ComponentCompilerTypeReferences = {}; getAllTypeReferences(checker, baseNode).forEach((typeInfo) => { @@ -457,7 +457,7 @@ export const getAllTypeReferences = (checker: ts.TypeChecker, node: ts.Node): Re export const validateReferences = ( diagnostics: d.Diagnostic[], references: d.ComponentCompilerTypeReferences, - node: ts.Node + node: ts.Node, ) => { Object.keys(references).forEach((refName) => { const ref = references[refName]; @@ -492,7 +492,7 @@ const getTypeReferenceLocation = ( type: ts.Type, sourceFile: ts.SourceFile, checker: ts.TypeChecker, - program: ts.Program + program: ts.Program, ): d.ComponentCompilerTypeReference => { // Loop through all top level imports to find any reference to the type for 'import' reference location const importTypeDeclaration = sourceFile.statements.find((st) => { @@ -691,7 +691,7 @@ export const parseDocsType = (checker: ts.TypeChecker, type: ts.Type, parts: Set */ export const getModuleFromSourceFile = ( compilerCtx: d.CompilerCtx, - tsSourceFile: ts.SourceFile + tsSourceFile: ts.SourceFile, ): d.Module | undefined => { const sourceFilePath = normalizePath(tsSourceFile.fileName); const moduleFile = compilerCtx.moduleMap.get(sourceFilePath); @@ -717,7 +717,7 @@ export const getModuleFromSourceFile = ( export const getComponentMeta = ( compilerCtx: d.CompilerCtx, tsSourceFile: ts.SourceFile, - node: ts.ClassDeclaration + node: ts.ClassDeclaration, ): d.ComponentCompilerMeta | undefined => { const meta = compilerCtx.nodeMap.get(node); if (meta) { @@ -845,14 +845,14 @@ export const createImportStatement = (importFnNames: string[], importPath: strin typeof importFnName === 'string' && importFnName !== importAs ? ts.factory.createIdentifier(importFnName) : undefined, - ts.factory.createIdentifier(importAs) + ts.factory.createIdentifier(importAs), ); }); return ts.factory.createImportDeclaration( undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports(importSpecifiers)), - ts.factory.createStringLiteral(importPath) + ts.factory.createStringLiteral(importPath), ); }; @@ -871,7 +871,7 @@ export const createRequireStatement = (importFnNames: string[], importPath: stri importFnName = splt[0]; } return ts.factory.createBindingElement(undefined, importFnName, importAs); - }) + }), ); return ts.factory.createVariableStatement( @@ -885,12 +885,12 @@ export const createRequireStatement = (importFnNames: string[], importPath: stri ts.factory.createCallExpression( ts.factory.createIdentifier('require'), [], - [ts.factory.createStringLiteral(importPath)] - ) + [ts.factory.createStringLiteral(importPath)], + ), ), ], - ts.NodeFlags.Const - ) + ts.NodeFlags.Const, + ), ); }; diff --git a/src/compiler/transformers/type-library.ts b/src/compiler/transformers/type-library.ts index 1472bbfb408..849f65a5436 100644 --- a/src/compiler/transformers/type-library.ts +++ b/src/compiler/transformers/type-library.ts @@ -27,7 +27,7 @@ export function addToLibrary( type: ts.Type, typeName: string, checker: ts.TypeChecker, - pathToTypeModule: string + pathToTypeModule: string, ): string { pathToTypeModule = relative(process.cwd(), pathToTypeModule); @@ -87,7 +87,7 @@ export function addFileToLibrary(config: ValidatedConfig, filePath: string): voi if (!sourceFile) { config.logger.warn( - `docs-json: unable to gather type information from "${filePath}". Please double check this path exists relative to your project root.` + `docs-json: unable to gather type information from "${filePath}". Please double check this path exists relative to your project root.`, ); return; } @@ -98,7 +98,7 @@ export function addFileToLibrary(config: ValidatedConfig, filePath: string): voi // the scope of the outer `addFileToLibrary` function. function exportedTypesInSourceFile( sourceFile: ts.SourceFile, - exportedTypeNodes: TypeDeclLike[] = [] + exportedTypeNodes: TypeDeclLike[] = [], ): TypeDeclLike[] { ts.forEachChild(sourceFile, (node) => { if (isTypeDeclLike(node) && isExported(node) && isNotPrivate(node)) { @@ -183,7 +183,7 @@ export function getHomeModule( importPath: string, options: ts.CompilerOptions, compilerHost: ts.CompilerHost, - program: ts.Program + program: ts.Program, ): ts.SourceFile | undefined { const module = ts.resolveModuleName(importPath, importer.fileName, options, compilerHost); const resolvedFileName = module?.resolvedModule?.resolvedFileName; diff --git a/src/compiler/transformers/update-component-class.ts b/src/compiler/transformers/update-component-class.ts index 3519fc15669..bf52c59b005 100644 --- a/src/compiler/transformers/update-component-class.ts +++ b/src/compiler/transformers/update-component-class.ts @@ -22,7 +22,7 @@ export const updateComponentClass = ( classNode: ts.ClassDeclaration, heritageClauses: ts.HeritageClause[] | ts.NodeArray, members: ts.ClassElement[], - moduleFile: d.Module + moduleFile: d.Module, ): ts.ClassDeclaration | ts.VariableStatement => { let classModifiers = retrieveTsModifiers(classNode)?.slice() ?? []; @@ -42,7 +42,7 @@ export const updateComponentClass = ( classNode.name, classNode.typeParameters, heritageClauses, - members + members, ); } @@ -73,7 +73,7 @@ const createConstClass = ( classNode: ts.ClassDeclaration, heritageClauses: ts.HeritageClause[] | ts.NodeArray, members: ts.ClassElement[], - moduleFile: d.Module + moduleFile: d.Module, ): ts.VariableStatement => { const className = classNode.name; @@ -105,11 +105,11 @@ const createConstClass = ( undefined, classNode.typeParameters, heritageClauses, - members - ) + members, + ), ), ], - ts.NodeFlags.Const - ) + ts.NodeFlags.Const, + ), ); }; diff --git a/src/compiler/transformers/update-stencil-core-import.ts b/src/compiler/transformers/update-stencil-core-import.ts index 26b322feef4..ba4494388dc 100644 --- a/src/compiler/transformers/update-stencil-core-import.ts +++ b/src/compiler/transformers/update-stencil-core-import.ts @@ -34,12 +34,12 @@ export const updateStencilCoreImports = (updatedCoreImportPath: string): ts.Tran undefined, ts.factory.createNamedImports( keepImports.map((name) => - ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(name)) - ) - ) + ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(name)), + ), + ), ), ts.factory.createStringLiteral(updatedCoreImportPath), - undefined + undefined, ); newStatements.push(newImport); } @@ -60,7 +60,7 @@ export const updateStencilCoreImports = (updatedCoreImportPath: string): ts.Tran tsSourceFile.referencedFiles, tsSourceFile.typeReferenceDirectives, tsSourceFile.hasNoDefaultLib, - tsSourceFile.libReferenceDirectives + tsSourceFile.libReferenceDirectives, ); } diff --git a/src/compiler/transpile.ts b/src/compiler/transpile.ts index 758311af189..f8c5d661a6b 100644 --- a/src/compiler/transpile.ts +++ b/src/compiler/transpile.ts @@ -96,7 +96,7 @@ const transpileCode = ( config: ValidatedConfig, transpileOpts: TranspileOptions, transformOpts: TransformOptions, - results: TranspileResults + results: TranspileResults, ) => { const transpileResults = transpileModule(config, results.code, transformOpts); diff --git a/src/compiler/transpile/create-build-program.ts b/src/compiler/transpile/create-build-program.ts index a4ee6377f42..d9e663e1912 100644 --- a/src/compiler/transpile/create-build-program.ts +++ b/src/compiler/transpile/create-build-program.ts @@ -12,7 +12,7 @@ import { getTsOptionsToExtend } from './ts-config'; */ export const createTsBuildProgram = async ( config: d.ValidatedConfig, - buildCallback: (tsBuilder: ts.BuilderProgram) => Promise + buildCallback: (tsBuilder: ts.BuilderProgram) => Promise, ): Promise> => { let isBuildRunning = false; let currentBuildTimeoutId: any; @@ -102,7 +102,7 @@ export const createTsBuildProgram = async ( }, (reportWatchStatus) => { config.logger.debug(reportWatchStatus.messageText); - } + }, ); /** diff --git a/src/compiler/transpile/create-watch-program.ts b/src/compiler/transpile/create-watch-program.ts index 804b99bc32f..4f9da3bef7f 100644 --- a/src/compiler/transpile/create-watch-program.ts +++ b/src/compiler/transpile/create-watch-program.ts @@ -19,7 +19,7 @@ import { getTsOptionsToExtend } from './ts-config'; */ export const createTsWatchProgram = async ( config: d.ValidatedConfig, - buildCallback: (tsBuilder: ts.BuilderProgram) => Promise + buildCallback: (tsBuilder: ts.BuilderProgram) => Promise, ) => { let isRunning = false; let lastTsBuilder: any; @@ -81,7 +81,7 @@ export const createTsWatchProgram = async ( // Add a callback to log out statuses of the the watch program (reportWatchStatus) => { config.logger.debug(reportWatchStatus.messageText); - } + }, ); // Add a callback that will execute whenever a new instance diff --git a/src/compiler/transpile/run-program.ts b/src/compiler/transpile/run-program.ts index b092d0811ff..791b6e7a50c 100644 --- a/src/compiler/transpile/run-program.ts +++ b/src/compiler/transpile/run-program.ts @@ -23,7 +23,7 @@ export const runTsProgram = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - tsBuilder: ts.BuilderProgram + tsBuilder: ts.BuilderProgram, ): Promise => { const tsSyntactic = loadTypeScriptDiagnostics(tsBuilder.getSyntacticDiagnostics()); const tsGlobal = loadTypeScriptDiagnostics(tsBuilder.getGlobalDiagnostics()); @@ -129,7 +129,7 @@ export const runTsProgram = async ( let dtsContent = await compilerCtx.fs.readFile(srcRootDtsFilePath); dtsContent = updateStencilTypesImports(o.typesDir, distPath, dtsContent); await compilerCtx.fs.writeFile(distPath, dtsContent); - }) + }), ); }); diff --git a/src/compiler/transpile/test/run-program.spec.ts b/src/compiler/transpile/test/run-program.spec.ts index 0227247338c..2d4280a660d 100644 --- a/src/compiler/transpile/test/run-program.spec.ts +++ b/src/compiler/transpile/test/run-program.spec.ts @@ -9,7 +9,7 @@ describe('run-program.ts', () => { const foo = getRelativeDts( config, '/Testuser/stencil-project/src/index.ts', - '/Testuser/stencil-project/.stencil/index.d.ts' + '/Testuser/stencil-project/.stencil/index.d.ts', ); expect(foo).toBe('index.d.ts'); }); @@ -19,7 +19,7 @@ describe('run-program.ts', () => { const foo = getRelativeDts( config, '/Testuser/stencil-project/src/components/index.ts', - '/Testuser/stencil-project/.stencil/components/index.d.ts' + '/Testuser/stencil-project/.stencil/components/index.d.ts', ); expect(foo).toBe('./components/index.d.ts'); }); @@ -29,7 +29,7 @@ describe('run-program.ts', () => { const foo = getRelativeDts( config, 'C:/Testuser/stencil-project/src/index.ts', - 'C:/Testuser/stencil-project/.stencil/index.d.ts' + 'C:/Testuser/stencil-project/.stencil/index.d.ts', ); expect(foo).toBe('index.d.ts'); }); @@ -39,7 +39,7 @@ describe('run-program.ts', () => { const foo = getRelativeDts( config, 'C:/Testuser/stencil-project/src/components/index.ts', - 'C:/Testuser/stencil-project/.stencil/components/index.d.ts' + 'C:/Testuser/stencil-project/.stencil/components/index.d.ts', ); expect(foo).toBe('./components/index.d.ts'); }); diff --git a/src/compiler/transpile/transpile-module.ts b/src/compiler/transpile/transpile-module.ts index d97fed7131b..d58c19e3d4d 100644 --- a/src/compiler/transpile/transpile-module.ts +++ b/src/compiler/transpile/transpile-module.ts @@ -25,7 +25,7 @@ import { updateStencilCoreImports } from '../transformers/update-stencil-core-im export const transpileModule = ( config: d.ValidatedConfig, input: string, - transformOpts: d.TransformOptions + transformOpts: d.TransformOptions, ): d.TranspileModuleResults => { if (!config.logger) { config = { diff --git a/src/compiler/transpile/transpiled-module.ts b/src/compiler/transpile/transpiled-module.ts index 2b106a4d1e7..b5d59e89577 100644 --- a/src/compiler/transpile/transpiled-module.ts +++ b/src/compiler/transpile/transpiled-module.ts @@ -24,7 +24,7 @@ export const getModule = (compilerCtx: d.CompilerCtx, filePath: string): d.Modul export const createModule = ( staticSourceFile: ts.SourceFile, // this may NOT be the original staticSourceFileText: string, - emitFilepath: string + emitFilepath: string, ): d.Module => ({ sourceFilePath: normalizePath(staticSourceFile.fileName), jsFilePath: emitFilepath, diff --git a/src/compiler/types/generate-app-types.ts b/src/compiler/types/generate-app-types.ts index 52c766e5b59..41d5add2d18 100644 --- a/src/compiler/types/generate-app-types.ts +++ b/src/compiler/types/generate-app-types.ts @@ -21,7 +21,7 @@ export const generateAppTypes = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - destination: string + destination: string, ): Promise => { // only gather components that are still root ts files we've found and have component metadata // the compilerCtx cache may still have files that may have been deleted/renamed @@ -39,7 +39,7 @@ export const generateAppTypes = async ( componentTypesFileContent = updateStencilTypesImports( destination, componentsDtsFilePath, - componentTypesFileContent + componentTypesFileContent, ); } @@ -137,7 +137,7 @@ const generateComponentTypesFile = (config: d.Config, buildCtx: d.BuildCtx, areT ...modules.map((m) => { const docs = components.find((c) => c.tagName === m.tagName).docs; return addDocBlock(` ${m.jsx}`, docs, 4); - }) + }), ); c.push(` interface IntrinsicElements {`); @@ -158,9 +158,9 @@ const generateComponentTypesFile = (config: d.Config, buildCtx: d.BuildCtx, areT return addDocBlock( ` "${m.tagName}": LocalJSX.${m.tagNameAsPascal} & JSXBase.HTMLAttributes<${m.htmlElementName}>;`, docs, - 12 + 12, ); - }) + }), ); c.push(` }`); c.push(` }`); diff --git a/src/compiler/types/generate-component-types.ts b/src/compiler/types/generate-component-types.ts index 9e582625dc5..3bb3e30494d 100644 --- a/src/compiler/types/generate-component-types.ts +++ b/src/compiler/types/generate-component-types.ts @@ -15,7 +15,7 @@ import { generatePropTypes } from './generate-prop-types'; export const generateComponentTypes = ( cmp: d.ComponentCompilerMeta, typeImportData: d.TypesImportData, - areTypesInternal: boolean + areTypesInternal: boolean, ): d.TypesModule => { const tagName = cmp.tagName.toLowerCase(); const tagNameAsPascal = dashToPascalCase(tagName); @@ -28,7 +28,7 @@ export const generateComponentTypes = ( const componentAttributes = attributesToMultiLineString( [...propAttributes, ...methodAttributes], false, - areTypesInternal + areTypesInternal, ); const isDep = cmp.isCollectionDependency; const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal); @@ -37,7 +37,7 @@ export const generateComponentTypes = ( addDocBlock( ` interface ${htmlElementName} extends Components.${tagNameAsPascal}, HTMLStencilElement {`, cmp.docs, - 4 + 4, ), ` }`, ` var ${htmlElementName}: {`, diff --git a/src/compiler/types/generate-event-types.ts b/src/compiler/types/generate-event-types.ts index a8e537afd6d..6eb633292aa 100644 --- a/src/compiler/types/generate-event-types.ts +++ b/src/compiler/types/generate-event-types.ts @@ -13,7 +13,7 @@ import { updateTypeIdentifierNames } from './stencil-types'; export const generateEventTypes = ( cmpMeta: d.ComponentCompilerMeta, typeImportData: d.TypesImportData, - cmpClassName: string + cmpClassName: string, ): d.TypeInfo => { return cmpMeta.events.map((cmpEvent) => { const name = `on${toTitleCase(cmpEvent.name)}`; @@ -44,7 +44,7 @@ const getEventType = ( cmpEvent: d.ComponentCompilerEvent, cmpEventDetailInterface: string, typeImportData: d.TypesImportData, - componentSourcePath: string + componentSourcePath: string, ): string => { if (!cmpEvent.complexType.original) { return 'CustomEvent'; @@ -53,7 +53,7 @@ const getEventType = ( cmpEvent.complexType.references, typeImportData, componentSourcePath, - cmpEvent.complexType.original + cmpEvent.complexType.original, ); return `(event: ${cmpEventDetailInterface}<${updatedTypeName}>) => void`; }; diff --git a/src/compiler/types/generate-method-types.ts b/src/compiler/types/generate-method-types.ts index 796437fec59..07ff7f6d298 100644 --- a/src/compiler/types/generate-method-types.ts +++ b/src/compiler/types/generate-method-types.ts @@ -11,7 +11,7 @@ import { updateTypeIdentifierNames } from './stencil-types'; */ export const generateMethodTypes = ( cmpMeta: d.ComponentCompilerMeta, - typeImportData: d.TypesImportData + typeImportData: d.TypesImportData, ): d.TypeInfo => { return cmpMeta.methods.map((cmpMethod) => ({ name: cmpMethod.name, @@ -33,12 +33,12 @@ export const generateMethodTypes = ( function getType( cmpMethod: d.ComponentCompilerMethod, typeImportData: d.TypesImportData, - componentSourcePath: string + componentSourcePath: string, ): string { return updateTypeIdentifierNames( cmpMethod.complexType.references, typeImportData, componentSourcePath, - cmpMethod.complexType.signature + cmpMethod.complexType.signature, ); } diff --git a/src/compiler/types/generate-prop-types.ts b/src/compiler/types/generate-prop-types.ts index f169462ce32..67ac9c0fda7 100644 --- a/src/compiler/types/generate-prop-types.ts +++ b/src/compiler/types/generate-prop-types.ts @@ -40,12 +40,12 @@ export const generatePropTypes = (cmpMeta: d.ComponentCompilerMeta, typeImportDa function getType( cmpProp: d.ComponentCompilerProperty, typeImportData: d.TypesImportData, - componentSourcePath: string + componentSourcePath: string, ): string { return updateTypeIdentifierNames( cmpProp.complexType.references, typeImportData, componentSourcePath, - cmpProp.complexType.original + cmpProp.complexType.original, ); } diff --git a/src/compiler/types/generate-types.ts b/src/compiler/types/generate-types.ts index e81abcbbd38..3419219c293 100644 --- a/src/compiler/types/generate-types.ts +++ b/src/compiler/types/generate-types.ts @@ -17,7 +17,7 @@ export const generateTypes = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistTypes + outputTarget: d.OutputTargetDistTypes, ): Promise => { if (!buildCtx.hasError) { await generateTypesOutput(config, compilerCtx, buildCtx, outputTarget); @@ -36,7 +36,7 @@ const generateTypesOutput = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistTypes + outputTarget: d.OutputTargetDistTypes, ): Promise => { // get all type declaration files in a project's src/ directory const srcDirItems = await compilerCtx.fs.readdir(config.srcDir, { recursive: false }); @@ -54,7 +54,7 @@ const generateTypesOutput = async ( await compilerCtx.fs.writeFile(distPath, distDtsContent); return distPath; - }) + }), ); const distDtsFilePath = copiedDTSFilePaths.slice(-1)[0]; diff --git a/src/compiler/types/package-json-log-utils.ts b/src/compiler/types/package-json-log-utils.ts index 08754628ee8..e9013fe7e37 100644 --- a/src/compiler/types/package-json-log-utils.ts +++ b/src/compiler/types/package-json-log-utils.ts @@ -19,7 +19,7 @@ export const packageJsonError = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, msg: string, - jsonField: string + jsonField: string, ): d.Diagnostic => { const err = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField); err.header = `Package Json`; @@ -43,7 +43,7 @@ export const packageJsonWarn = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, msg: string, - jsonField: string + jsonField: string, ): d.Diagnostic => { const warn = buildJsonFileError(compilerCtx, buildCtx.diagnostics, config.packageJsonFilePath, msg, jsonField); warn.header = `Package Json`; diff --git a/src/compiler/types/stencil-types.ts b/src/compiler/types/stencil-types.ts index 9dde24a06f9..2b7773446fd 100644 --- a/src/compiler/types/stencil-types.ts +++ b/src/compiler/types/stencil-types.ts @@ -45,7 +45,7 @@ export const updateTypeIdentifierNames = ( typeReferences: d.ComponentCompilerTypeReferences, typeImportData: d.TypesImportData, sourceFilePath: string, - initialType: string + initialType: string, ): string => { let currentTypeName = initialType; @@ -114,7 +114,7 @@ const updateTypeName = (currentTypeName: string, typeAlias: d.TypesMemberNameDat */ export const copyStencilCoreDts = async ( config: d.ValidatedConfig, - compilerCtx: d.CompilerCtx + compilerCtx: d.CompilerCtx, ): Promise> => { const typesOutputTargets = config.outputTargets.filter(isOutputTargetDistTypes).filter((o) => o.typesDir); @@ -125,7 +125,7 @@ export const copyStencilCoreDts = async ( typesOutputTargets.map((o) => { const coreDtsFilePath = join(o.typesDir, CORE_DTS); return compilerCtx.fs.writeFile(coreDtsFilePath, srcStencilCoreDts, { outputTargetType: o.type }); - }) + }), ); }; diff --git a/src/compiler/types/tests/ComponentCompilerEvent.stub.ts b/src/compiler/types/tests/ComponentCompilerEvent.stub.ts index 88d973cb83b..639aef8e302 100644 --- a/src/compiler/types/tests/ComponentCompilerEvent.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerEvent.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerEvent` */ export const stubComponentCompilerEvent = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerEvent => { const defaults: d.ComponentCompilerEvent = { bubbles: true, diff --git a/src/compiler/types/tests/ComponentCompilerMeta.stub.ts b/src/compiler/types/tests/ComponentCompilerMeta.stub.ts index 4af1dd47032..4e059d5d8ac 100644 --- a/src/compiler/types/tests/ComponentCompilerMeta.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerMeta.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerMeta` */ export const stubComponentCompilerMeta = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerMeta => ({ assetsDirs: [], componentClassName: 'StubCmp', diff --git a/src/compiler/types/tests/ComponentCompilerMethod.stub.ts b/src/compiler/types/tests/ComponentCompilerMethod.stub.ts index 06f1736148a..5aaab54f072 100644 --- a/src/compiler/types/tests/ComponentCompilerMethod.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerMethod.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerMethod` */ export const stubComponentCompilerMethod = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerMethod => { const defaults: d.ComponentCompilerMethod = { name: 'myMethod', diff --git a/src/compiler/types/tests/ComponentCompilerProperty.stub.ts b/src/compiler/types/tests/ComponentCompilerProperty.stub.ts index bed37b6966b..8f4ce27445d 100644 --- a/src/compiler/types/tests/ComponentCompilerProperty.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerProperty.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerProperty` */ export const stubComponentCompilerProperty = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerProperty => { const defaults: d.ComponentCompilerProperty = { attribute: 'my-cmp', diff --git a/src/compiler/types/tests/ComponentCompilerTypeReference.stub.ts b/src/compiler/types/tests/ComponentCompilerTypeReference.stub.ts index 6e322e2a2ba..2ee23324663 100644 --- a/src/compiler/types/tests/ComponentCompilerTypeReference.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerTypeReference.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerTypeReference` */ export const stubComponentCompilerTypeReference = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerTypeReference => { const defaults: d.ComponentCompilerTypeReference = { location: 'global', diff --git a/src/compiler/types/tests/ComponentCompilerVirtualProperty.stub.ts b/src/compiler/types/tests/ComponentCompilerVirtualProperty.stub.ts index ab2c4d21647..8a9fe5ae489 100644 --- a/src/compiler/types/tests/ComponentCompilerVirtualProperty.stub.ts +++ b/src/compiler/types/tests/ComponentCompilerVirtualProperty.stub.ts @@ -8,7 +8,7 @@ import * as d from '@stencil/core/declarations'; * @returns the stubbed `ComponentCompilerVirtualProperty` */ export const stubComponentCompilerVirtualProperty = ( - overrides: Partial = {} + overrides: Partial = {}, ): d.ComponentCompilerVirtualProperty => { const defaults: d.ComponentCompilerVirtualProperty = { docs: 'this is a doc string', diff --git a/src/compiler/types/tests/generate-app-types.spec.ts b/src/compiler/types/tests/generate-app-types.spec.ts index d79b22493c3..e8040362e4b 100644 --- a/src/compiler/types/tests/generate-app-types.spec.ts +++ b/src/compiler/types/tests/generate-app-types.spec.ts @@ -99,7 +99,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -176,7 +176,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -270,7 +270,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -413,7 +413,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -561,7 +561,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -709,7 +709,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); }); @@ -799,7 +799,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -903,7 +903,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -1042,7 +1042,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -1186,7 +1186,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -1330,7 +1330,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); }); @@ -1429,7 +1429,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -1531,7 +1531,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); @@ -1623,7 +1623,7 @@ declare module "@stencil/core" { `, { immediateWrite: true, - } + }, ); }); }); diff --git a/src/compiler/types/tests/generate-event-types.spec.ts b/src/compiler/types/tests/generate-event-types.spec.ts index 9b3ca5980df..77ba05152a9 100644 --- a/src/compiler/types/tests/generate-event-types.spec.ts +++ b/src/compiler/types/tests/generate-event-types.spec.ts @@ -26,8 +26,8 @@ describe('generate-event-types', () => { _typeReferences: d.ComponentCompilerTypeReferences, _typeImportData: d.TypesImportData, _sourceFilePath: string, - initialType: string - ) => initialType + initialType: string, + ) => initialType, ); getTextDocsSpy = jest.spyOn(Util, 'getTextDocs'); diff --git a/src/compiler/types/tests/generate-method-types.spec.ts b/src/compiler/types/tests/generate-method-types.spec.ts index d6d01285bea..e2e44fe3701 100644 --- a/src/compiler/types/tests/generate-method-types.spec.ts +++ b/src/compiler/types/tests/generate-method-types.spec.ts @@ -21,8 +21,8 @@ describe('generate-method-types', () => { _typeReferences: d.ComponentCompilerTypeReferences, _typeImportData: d.TypesImportData, _sourceFilePath: string, - initialType: string - ) => initialType + initialType: string, + ) => initialType, ); getTextDocsSpy = jest.spyOn(Util, 'getTextDocs'); diff --git a/src/compiler/types/tests/generate-prop-types.spec.ts b/src/compiler/types/tests/generate-prop-types.spec.ts index 5a86d333a4c..f6b51bed41d 100644 --- a/src/compiler/types/tests/generate-prop-types.spec.ts +++ b/src/compiler/types/tests/generate-prop-types.spec.ts @@ -22,8 +22,8 @@ describe('generate-prop-types', () => { _typeReferences: d.ComponentCompilerTypeReferences, _typeImportData: d.TypesImportData, _sourceFilePath: string, - initialType: string - ) => initialType + initialType: string, + ) => initialType, ); getTextDocsSpy = jest.spyOn(Util, 'getTextDocs'); diff --git a/src/compiler/types/tests/stencil-types.spec.ts b/src/compiler/types/tests/stencil-types.spec.ts index 5f9ce02de4c..994f7ecdc5f 100644 --- a/src/compiler/types/tests/stencil-types.spec.ts +++ b/src/compiler/types/tests/stencil-types.spec.ts @@ -32,7 +32,7 @@ describe('stencil-types', () => { {}, {}, stubComponentCompilerMeta().sourceFilePath, - expectedTypeName + expectedTypeName, ); expect(actualTypeName).toBe(expectedTypeName); @@ -48,7 +48,7 @@ describe('stencil-types', () => { typeReferences, {}, stubComponentCompilerMeta().sourceFilePath, - expectedTypeName + expectedTypeName, ); expect(actualTypeName).toBe(expectedTypeName); @@ -65,7 +65,7 @@ describe('stencil-types', () => { typeReferences, {}, stubComponentCompilerMeta().sourceFilePath, - expectedTypeName + expectedTypeName, ); expect(actualTypeName).toBe(expectedTypeName); @@ -94,7 +94,7 @@ describe('stencil-types', () => { typeReferences, typeImports, componentCompilerMeta.sourceFilePath, - initialType + initialType, ); expect(actualTypeName).toBe(initialType); @@ -160,7 +160,7 @@ describe('stencil-types', () => { typeReferences, typeImports, componentCompilerMeta.sourceFilePath, - initialType + initialType, ); expect(actualTypeName).toBe(expectedType); @@ -271,7 +271,7 @@ describe('stencil-types', () => { const expectTypeIsTransformed = ( initialType: string, expectedType: string, - typeMemberNames: d.TypesMemberNameData[] + typeMemberNames: d.TypesMemberNameData[], ) => { const basePath = '~/some/stubbed/path'; @@ -290,7 +290,7 @@ describe('stencil-types', () => { typeReferences, typeImports, componentCompilerMeta.sourceFilePath, - initialType + initialType, ); expect(actualTypeName).toBe(expectedType); diff --git a/src/compiler/types/tests/validate-package-json.spec.ts b/src/compiler/types/tests/validate-package-json.spec.ts index 9d9b2c8abb0..5f6e14ed42c 100644 --- a/src/compiler/types/tests/validate-package-json.spec.ts +++ b/src/compiler/types/tests/validate-package-json.spec.ts @@ -115,8 +115,8 @@ describe('validate-package-json', () => { expect(buildCtx.diagnostics[0].messageText).toBe( `package.json "collection" property is required when generating a distribution and must be set to: ${normalizePath( 'dist/collection/collection-manifest.json', - false - )}` + false, + )}`, ); expect(buildCtx.diagnostics[0].level).toBe('warn'); }); diff --git a/src/compiler/types/tests/validate-primary-package-output-target.spec.ts b/src/compiler/types/tests/validate-primary-package-output-target.spec.ts index cd6908c7208..1b5aa16bfb7 100644 --- a/src/compiler/types/tests/validate-primary-package-output-target.spec.ts +++ b/src/compiler/types/tests/validate-primary-package-output-target.spec.ts @@ -44,7 +44,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - 'Your Stencil project has designated a primary package output target without enabling primary package validation for your project. Either set `validatePrimaryPackageOutputTarget: true` in your Stencil config or remove `isPrimaryPackageOutputTarget: true` from all output targets. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation' + 'Your Stencil project has designated a primary package output target without enabling primary package validation for your project. Either set `validatePrimaryPackageOutputTarget: true` in your Stencil config or remove `isPrimaryPackageOutputTarget: true` from all output targets. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation', ); }); @@ -61,7 +61,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `Your Stencil project has assigned one or more ineligible output targets as the primary package output target. No validation will take place. Please remove the 'isPrimaryPackageOutputTarget' flag from the following output targets in your Stencil config: copy. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + `Your Stencil project has assigned one or more ineligible output targets as the primary package output target. No validation will take place. Please remove the 'isPrimaryPackageOutputTarget' flag from the following output targets in your Stencil config: copy. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); }); @@ -77,7 +77,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `Your Stencil project has not assigned a primary package output target. Stencil recommends that you assign a primary output target so it can validate values for fields in your project's 'package.json'. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + `Your Stencil project has not assigned a primary package output target. Stencil recommends that you assign a primary output target so it can validate values for fields in your project's 'package.json'. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); }); @@ -95,7 +95,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `Your Stencil config has multiple output targets with 'isPrimaryPackageOutputTarget: true'. Stencil does not support validating 'package.json' fields for multiple output targets. Please remove the 'isPrimaryPackageOutputTarget' flag from all but one of the following output targets: dist, dist-custom-elements. For now, Stencil will use the first primary target it finds. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + `Your Stencil config has multiple output targets with 'isPrimaryPackageOutputTarget: true'. Stencil does not support validating 'package.json' fields for multiple output targets. Please remove the 'isPrimaryPackageOutputTarget' flag from all but one of the following output targets: dist, dist-custom-elements. For now, Stencil will use the first primary target it finds. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); }); }); @@ -115,7 +115,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "module" property is required when generating a distribution. It's recommended to set the "module" property to: ./dist/index.js` + `package.json "module" property is required when generating a distribution. It's recommended to set the "module" property to: ./dist/index.js`, ); }); @@ -154,13 +154,13 @@ describe('validatePrimaryPackageOutputTarget', () => { compilerCtx, buildCtx, PRIMARY_PACKAGE_TARGET_CONFIGS[outputTarget.type], - outputTarget + outputTarget, ); expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "module" property is set to "${buildCtx.packageJson.module}". It's recommended to set the "module" property to: ${recommendedPath}` + `package.json "module" property is set to "${buildCtx.packageJson.module}". It's recommended to set the "module" property to: ${recommendedPath}`, ); }); @@ -172,7 +172,7 @@ describe('validatePrimaryPackageOutputTarget', () => { compilerCtx, buildCtx, PRIMARY_PACKAGE_TARGET_CONFIGS[outputTarget.type], - outputTarget + outputTarget, ); expect(buildCtx.diagnostics.length).toBe(0); @@ -201,7 +201,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "types" property is required when generating a distribution. It's recommended to set the "types" property to: ./dist/types/index.d.ts` + `package.json "types" property is required when generating a distribution. It's recommended to set the "types" property to: ./dist/types/index.d.ts`, ); }); @@ -213,7 +213,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "types" file must have a ".d.ts" extension. The "types" property is currently set to: /dist/types/index.ts` + `package.json "types" file must have a ".d.ts" extension. The "types" property is currently set to: /dist/types/index.ts`, ); }); @@ -225,7 +225,7 @@ describe('validatePrimaryPackageOutputTarget', () => { expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('error'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "types" property is set to "dist/types/index.d.ts" but cannot be found.` + `package.json "types" property is set to "dist/types/index.d.ts" but cannot be found.`, ); }); @@ -266,13 +266,13 @@ describe('validatePrimaryPackageOutputTarget', () => { compilerCtx, buildCtx, PRIMARY_PACKAGE_TARGET_CONFIGS[outputTarget.type], - outputTarget + outputTarget, ); expect(buildCtx.diagnostics.length).toBe(1); expect(buildCtx.diagnostics[0].level).toEqual('warn'); expect(buildCtx.diagnostics[0].messageText).toEqual( - `package.json "types" property is set to "${buildCtx.packageJson.types}". It's recommended to set the "types" property to: ${recommendedPath}` + `package.json "types" property is set to "${buildCtx.packageJson.types}". It's recommended to set the "types" property to: ${recommendedPath}`, ); }); @@ -284,7 +284,7 @@ describe('validatePrimaryPackageOutputTarget', () => { compilerCtx, buildCtx, PRIMARY_PACKAGE_TARGET_CONFIGS[outputTarget.type], - targetToValidate + targetToValidate, ); expect(buildCtx.diagnostics.length).toBe(0); diff --git a/src/compiler/types/update-import-refs.ts b/src/compiler/types/update-import-refs.ts index fac7080a2a8..79e50113e07 100644 --- a/src/compiler/types/update-import-refs.ts +++ b/src/compiler/types/update-import-refs.ts @@ -17,14 +17,14 @@ export const updateReferenceTypeImports = ( typeCounts: Map, cmp: d.ComponentCompilerMeta, filePath: string, - config: d.Config + config: d.Config, ): d.TypesImportData => { const updateImportReferences = updateImportReferenceFactory(typeCounts, filePath, config); return [...cmp.properties, ...cmp.events, ...cmp.methods] .filter( (cmpProp: d.ComponentCompilerProperty | d.ComponentCompilerEvent | d.ComponentCompilerMethod) => - cmpProp.complexType && cmpProp.complexType.references + cmpProp.complexType && cmpProp.complexType.references, ) .reduce((typesImportData: d.TypesImportData, cmpProp) => { return updateImportReferences(typesImportData, cmpProp.complexType.references); @@ -40,7 +40,7 @@ export const updateReferenceTypeImports = ( */ type ImportReferenceUpdater = ( existingTypeImportData: d.TypesImportData, - typeReferences: { [key: string]: d.ComponentCompilerTypeReference } + typeReferences: { [key: string]: d.ComponentCompilerTypeReference }, ) => d.TypesImportData; /** @@ -53,7 +53,7 @@ type ImportReferenceUpdater = ( const updateImportReferenceFactory = ( typeCounts: Map, filePath: string, - config: d.Config + config: d.Config, ): ImportReferenceUpdater => { /** * Determines the number of times that a type identifier (name) has been used. If an identifier has been used before, @@ -73,7 +73,7 @@ const updateImportReferenceFactory = ( return ( existingTypeImportData: d.TypesImportData, - typeReferences: { [key: string]: d.ComponentCompilerTypeReference } + typeReferences: { [key: string]: d.ComponentCompilerTypeReference }, ): d.TypesImportData => { Object.keys(typeReferences) .map<[string, d.ComponentCompilerTypeReference]>((typeName) => { @@ -101,7 +101,7 @@ const updateImportReferenceFactory = ( typeReference.path!, filePath, config.tsCompilerOptions, - ts.createCompilerHost(config.tsCompilerOptions) + ts.createCompilerHost(config.tsCompilerOptions), ); if (resolvedModule && !resolvedModule.isExternalLibraryImport && resolvedModule.resolvedFileName) { diff --git a/src/compiler/types/validate-build-package-json.ts b/src/compiler/types/validate-build-package-json.ts index 8e5da1de67f..f2257404509 100644 --- a/src/compiler/types/validate-build-package-json.ts +++ b/src/compiler/types/validate-build-package-json.ts @@ -17,7 +17,7 @@ import { validatePrimaryPackageOutputTarget } from './validate-primary-package-o export const validateBuildPackageJson = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ): Promise => { if (config.watch || buildCtx.packageJson == null) { return; @@ -30,8 +30,8 @@ export const validateBuildPackageJson = async ( const distCollectionOutputTargets = config.outputTargets.filter(isOutputTargetDistCollection); await Promise.all( distCollectionOutputTargets.map((distCollectionOT) => - validateDistCollectionPkgJson(config, compilerCtx, buildCtx, distCollectionOT) - ) + validateDistCollectionPkgJson(config, compilerCtx, buildCtx, distCollectionOT), + ), ); }; @@ -49,7 +49,7 @@ const validateDistCollectionPkgJson = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ) => { await Promise.all([ validatePackageFiles(config, compilerCtx, buildCtx, outputTarget), @@ -72,7 +72,7 @@ export const validatePackageFiles = async ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ) => { if (!config.devMode && Array.isArray(buildCtx.packageJson.files)) { const actualDistDir = normalizePath(relative(config.rootDir, outputTarget.dir)); @@ -80,7 +80,7 @@ export const validatePackageFiles = async ( const validPaths = [`${actualDistDir}`, `${actualDistDir}/`, `./${actualDistDir}`, `./${actualDistDir}/`]; const containsDistDir = buildCtx.packageJson.files.some((userPath) => - validPaths.some((validPath) => normalizePath(userPath) === validPath) + validPaths.some((validPath) => normalizePath(userPath) === validPath), ); if (!containsDistDir) { @@ -101,7 +101,7 @@ export const validatePackageFiles = async ( packageJsonError(config, compilerCtx, buildCtx, msg, `"${pkgFile}"`); } } - }) + }), ); } }; @@ -119,7 +119,7 @@ export const validateMain = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ) => { const mainAbs = join(outputTarget.dir, 'index.cjs.js'); const mainRel = relative(config.rootDir, mainAbs); @@ -146,12 +146,12 @@ export const validateCollection = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - outputTarget: d.OutputTargetDistCollection + outputTarget: d.OutputTargetDistCollection, ) => { if (outputTarget.collectionDir) { const collectionRel = normalizePath( join(relative(config.rootDir, outputTarget.collectionDir), COLLECTION_MANIFEST_FILE_NAME), - false + false, ); if (!buildCtx.packageJson.collection || normalizePath(buildCtx.packageJson.collection, false) !== collectionRel) { const msg = `package.json "collection" property is required when generating a distribution and must be set to: ${collectionRel}`; diff --git a/src/compiler/types/validate-primary-package-output-target.ts b/src/compiler/types/validate-primary-package-output-target.ts index d851951f4ed..8c2196ad6c7 100644 --- a/src/compiler/types/validate-primary-package-output-target.ts +++ b/src/compiler/types/validate-primary-package-output-target.ts @@ -73,7 +73,7 @@ export const PRIMARY_PACKAGE_TARGET_CONFIGS = { export const validatePrimaryPackageOutputTarget = ( config: d.ValidatedConfig, compilerCtx: d.CompilerCtx, - buildCtx: d.BuildCtx + buildCtx: d.BuildCtx, ) => { if (config.validatePrimaryPackageOutputTarget) { const eligiblePrimaryTargets: d.EligiblePrimaryPackageOutputTarget[] = []; @@ -106,8 +106,8 @@ export const validatePrimaryPackageOutputTarget = ( `Your Stencil config has multiple output targets with 'isPrimaryPackageOutputTarget: true'. Stencil does not support validating 'package.json' fields for multiple output targets. Please remove the 'isPrimaryPackageOutputTarget' flag from all but one of the following output targets: ${targetsMarkedToValidate .map((ref) => ref.type) .join( - ', ' - )}. For now, Stencil will use the first primary target it finds. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + ', ', + )}. For now, Stencil will use the first primary target it finds. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); } @@ -123,7 +123,7 @@ export const validatePrimaryPackageOutputTarget = ( } else { logValidationWarning( buildCtx, - `Your Stencil project has not assigned a primary package output target. Stencil recommends that you assign a primary output target so it can validate values for fields in your project's 'package.json'. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + `Your Stencil project has not assigned a primary package output target. Stencil recommends that you assign a primary output target so it can validate values for fields in your project's 'package.json'. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); } } @@ -136,15 +136,15 @@ export const validatePrimaryPackageOutputTarget = ( .filter((ref: any) => ref.isPrimaryPackageOutputTarget === true) .map((ref) => ref.type) .join( - ', ' - )}. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation` + ', ', + )}. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation`, ); } } else { if (config.outputTargets.some((ref: any) => ref.isPrimaryPackageOutputTarget)) { logValidationWarning( buildCtx, - 'Your Stencil project has designated a primary package output target without enabling primary package validation for your project. Either set `validatePrimaryPackageOutputTarget: true` in your Stencil config or remove `isPrimaryPackageOutputTarget: true` from all output targets. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation' + 'Your Stencil project has designated a primary package output target without enabling primary package validation for your project. Either set `validatePrimaryPackageOutputTarget: true` in your Stencil config or remove `isPrimaryPackageOutputTarget: true` from all output targets. You can read more about primary package output targets in the Stencil docs: https://stenciljs.com/docs/output-targets#primary-package-output-target-validation', ); } } @@ -171,7 +171,7 @@ export const validateModulePath = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, recommendedOutputTargetConfig: PrimaryPackageOutputTargetRecommendedConfig, - targetToValidate: d.EligiblePrimaryPackageOutputTarget + targetToValidate: d.EligiblePrimaryPackageOutputTarget, ) => { const currentModulePath = buildCtx.packageJson.module; const recommendedModulePath = recommendedOutputTargetConfig.getModulePath @@ -215,7 +215,7 @@ export const validateTypesPath = ( compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, recommendedOutputTargetConfig: PrimaryPackageOutputTargetRecommendedConfig, - targetToValidate: d.EligiblePrimaryPackageOutputTarget + targetToValidate: d.EligiblePrimaryPackageOutputTarget, ) => { const currentTypesPath = buildCtx.packageJson.types; const recommendedTypesPath = recommendedOutputTargetConfig.getTypesPath diff --git a/src/declarations/stencil-private.ts b/src/declarations/stencil-private.ts index 3fa5c583076..2e2b1164731 100644 --- a/src/declarations/stencil-private.ts +++ b/src/declarations/stencil-private.ts @@ -1470,7 +1470,7 @@ export interface Plugin { transform?: ( sourceText: string, id: string, - context: PluginCtx + context: PluginCtx, ) => Promise | PluginTransformResults | string; } @@ -1753,13 +1753,13 @@ export interface PlatformRuntime { el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; rel: ( el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; ce: (eventName: string, opts?: any) => CustomEvent; } @@ -1783,7 +1783,7 @@ export interface ScreenshotConnector { getScreenshotCache(): Promise; updateScreenshotCache( screenshotCache: ScreenshotCache, - buildResults: ScreenshotBuildResults + buildResults: ScreenshotBuildResults, ): Promise; generateJsonpDataUris(build: ScreenshotBuild): Promise; sortScreenshots(screenshots: Screenshot[]): Screenshot[]; @@ -2543,7 +2543,7 @@ export interface CompilerWorkerContext { input: string, minifyOpts: any, transpile: boolean, - inlineHelpers: boolean + inlineHelpers: boolean, ): Promise<{ output: string; diagnostics: Diagnostic[]; sourceMap?: SourceMap }>; prerenderWorker(prerenderRequest: PrerenderUrlRequest): Promise; transformCssToEsm(input: TransformCssToEsmInput): Promise; diff --git a/src/declarations/stencil-public-runtime.ts b/src/declarations/stencil-public-runtime.ts index 8df1fc3b1b4..aabea6c6163 100644 --- a/src/declarations/stencil-public-runtime.ts +++ b/src/declarations/stencil-public-runtime.ts @@ -1,7 +1,7 @@ declare type CustomMethodDecorator = ( target: Object, propertyKey: string | symbol, - descriptor: TypedPropertyDescriptor + descriptor: TypedPropertyDescriptor, ) => TypedPropertyDescriptor | void; export interface ComponentDecorator { @@ -1823,13 +1823,13 @@ export interface CustomElementsDefineOptions { el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; rel?: ( el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; ce?: (eventName: string, opts?: any) => CustomEvent; } diff --git a/src/dev-server/client/app-error.ts b/src/dev-server/client/app-error.ts index ac2b7873dc5..ef03ca38a66 100644 --- a/src/dev-server/client/app-error.ts +++ b/src/dev-server/client/app-error.ts @@ -22,7 +22,7 @@ export const appError = (data: AppErrorData): AppErrorResults => { if (data && data.window && Array.isArray(data.buildResults.diagnostics)) { const diagnostics = (data.buildResults as CompilerBuildResults).diagnostics.filter( - (diagnostic) => diagnostic.level === 'error' + (diagnostic) => diagnostic.level === 'error', ); if (diagnostics.length > 0) { @@ -44,7 +44,7 @@ const appendDiagnostic = ( doc: Document, openInEditor: OpenInEditorCallback | undefined, modal: HTMLElement, - diagnostic: Diagnostic + diagnostic: Diagnostic, ) => { const card = doc.createElement('div'); card.className = 'dev-server-diagnostic'; @@ -101,7 +101,7 @@ const appendDiagnostic = ( fileHeader, diagnostic.absFilePath, diagnostic.lineNumber, - diagnostic.columnNumber + diagnostic.columnNumber, ); } } @@ -169,7 +169,7 @@ const addOpenInEditor = ( elm: HTMLElement, file: string, line: number | undefined, - column: number | undefined + column: number | undefined, ) => { if (elm.tagName === 'A') { (elm as HTMLAnchorElement).href = '#open-in-editor'; diff --git a/src/dev-server/client/hmr-images.ts b/src/dev-server/client/hmr-images.ts index eec6954d31f..8cc13f5afc1 100644 --- a/src/dev-server/client/hmr-images.ts +++ b/src/dev-server/client/hmr-images.ts @@ -34,7 +34,7 @@ const hmrStyleSheetImages = ( cssImageProps: string[], styleSheet: CSSStyleSheet, versionId: string, - imageFileNames: string[] + imageFileNames: string[], ) => { try { const cssRules = styleSheet.cssRules; @@ -64,7 +64,7 @@ const hmrStyleSheetRuleImages = ( cssImageProps: string[], cssRule: CSSStyleRule, versionId: string, - imageFileNames: string[] + imageFileNames: string[], ) => { cssImageProps.forEach((cssImageProp) => { imageFileNames.forEach((imageFileName) => { diff --git a/src/dev-server/dev-server-client/app-update.ts b/src/dev-server/dev-server-client/app-update.ts index b72eb015a1e..981a069afbd 100644 --- a/src/dev-server/dev-server-client/app-update.ts +++ b/src/dev-server/dev-server-client/app-update.ts @@ -119,7 +119,7 @@ const appHmr = (win: Window, hmr: d.HotModuleReplacement) => { if (results.updatedComponents.length > 0) { logBuild( - `Updated component${results.updatedComponents.length > 1 ? 's' : ''}: ${results.updatedComponents.join(', ')}` + `Updated component${results.updatedComponents.length > 1 ? 's' : ''}: ${results.updatedComponents.join(', ')}`, ); } diff --git a/src/dev-server/index.ts b/src/dev-server/index.ts index 3b3f3dbbd37..451f8a1efe6 100644 --- a/src/dev-server/index.ts +++ b/src/dev-server/index.ts @@ -49,7 +49,7 @@ function startServer( watcher: CompilerWatcher, initServerProcess: InitServerProcess, resolve: (devServer: DevServer) => void, - reject: (err: any) => void + reject: (err: any) => void, ) { const timespan = logger.createTimeSpan(`starting dev server`, true); @@ -136,11 +136,11 @@ function startServer( logger.info(logger.red(`${msg.requestLog.method} ${msg.requestLog.url} (${msg.requestLog.status})`)); } else if (msg.requestLog.status >= 400) { logger.info( - logger.dim(logger.red(`${msg.requestLog.method} ${msg.requestLog.url} (${msg.requestLog.status})`)) + logger.dim(logger.red(`${msg.requestLog.method} ${msg.requestLog.url} (${msg.requestLog.status})`)), ); } else if (msg.requestLog.status >= 300) { logger.info( - logger.dim(logger.magenta(`${msg.requestLog.method} ${msg.requestLog.url} (${msg.requestLog.status})`)) + logger.dim(logger.magenta(`${msg.requestLog.method} ${msg.requestLog.url} (${msg.requestLog.status})`)), ); } else { logger.info(logger.dim(`${logger.cyan(msg.requestLog.method)} ${msg.requestLog.url}`)); diff --git a/src/dev-server/open-in-editor.ts b/src/dev-server/open-in-editor.ts index 460b5677c93..18b874f2fa4 100644 --- a/src/dev-server/open-in-editor.ts +++ b/src/dev-server/open-in-editor.ts @@ -28,7 +28,7 @@ export async function serveOpenInEditor(serverCtx: d.DevServerContext, req: d.Ht status, responseHeaders({ 'content-type': 'application/json; charset=utf-8', - }) + }), ); res.write(JSON.stringify(data, null, 2)); @@ -39,7 +39,7 @@ async function parseData( editors: d.DevServerEditor[], sys: d.CompilerSystem, req: d.HttpRequest, - data: d.OpenInEditorData + data: d.OpenInEditorData, ) { const qs = req.searchParams; @@ -122,7 +122,7 @@ export function getEditors() { priority: EDITOR_PRIORITY[editorId], supported: isSupported, }); - }) + }), ); } catch (e) {} @@ -139,7 +139,7 @@ export function getEditors() { id: e.id, name: EDITORS[e.id], } as d.DevServerEditor; - }) + }), ); }); } diff --git a/src/dev-server/request-handler.ts b/src/dev-server/request-handler.ts index 7a6a05eb3f2..27f18c0d2a9 100644 --- a/src/dev-server/request-handler.ts +++ b/src/dev-server/request-handler.ts @@ -39,7 +39,7 @@ export function createRequestHandler(devServerConfig: d.DevServerConfig, serverC req, res, `invalid basePath`, - `404 File Not Found, base path: ${devServerConfig.basePath}` + `404 File Not Found, base path: ${devServerConfig.basePath}`, ); } diff --git a/src/dev-server/serve-dev-client.ts b/src/dev-server/serve-dev-client.ts index 24026f220db..7253c019035 100644 --- a/src/dev-server/serve-dev-client.ts +++ b/src/dev-server/serve-dev-client.ts @@ -11,7 +11,7 @@ export async function serveDevClient( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { try { if (isOpenInEditor(req.pathname)) { @@ -47,7 +47,7 @@ async function serveDevClientScript( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { try { if (serverCtx.connectorHtml == null) { @@ -66,7 +66,7 @@ async function serveDevClientScript( serverCtx.connectorHtml = serverCtx.connectorHtml.replace( 'window.__DEV_CLIENT_CONFIG__', - JSON.stringify(devClientConfig) + JSON.stringify(devClientConfig), ); } @@ -74,7 +74,7 @@ async function serveDevClientScript( 200, responseHeaders({ 'content-type': 'text/html; charset=utf-8', - }) + }), ); res.write(serverCtx.connectorHtml); res.end(); diff --git a/src/dev-server/serve-directory-index.ts b/src/dev-server/serve-directory-index.ts index 9ee786abfbe..4635ccf8340 100644 --- a/src/dev-server/serve-directory-index.ts +++ b/src/dev-server/serve-directory-index.ts @@ -9,7 +9,7 @@ export async function serveDirectoryIndex( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { const indexFilePath = path.join(req.filePath, 'index.html'); req.stats = await serverCtx.sys.stat(indexFilePath); @@ -44,7 +44,7 @@ export async function serveDirectoryIndex( responseHeaders({ 'content-type': 'text/html; charset=utf-8', 'x-directory-index': req.pathname, - }) + }), ); res.write(templateHtml); @@ -95,7 +95,7 @@ async function getDirectoryItems(sys: d.CompilerSystem, baseUrl: URL, dirFilePat }; return item; - }) + }), ); return items; } diff --git a/src/dev-server/serve-file.ts b/src/dev-server/serve-file.ts index 56e934a0106..0e68a5a1e6b 100644 --- a/src/dev-server/serve-file.ts +++ b/src/dev-server/serve-file.ts @@ -12,7 +12,7 @@ export async function serveFile( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { try { if (util.isSimpleText(req.filePath)) { @@ -34,7 +34,7 @@ export async function serveFile( 'content-type': util.getContentType(req.filePath) + '; charset=utf-8', 'content-encoding': 'gzip', vary: 'Accept-Encoding', - }) + }), ); zlib.gzip(content, { level: 9 }, (_, data) => { @@ -47,7 +47,7 @@ export async function serveFile( util.responseHeaders({ 'content-type': util.getContentType(req.filePath) + '; charset=utf-8', 'content-length': Buffer.byteLength(content, 'utf8'), - }) + }), ); res.write(content); res.end(); @@ -60,7 +60,7 @@ export async function serveFile( util.responseHeaders({ 'content-type': util.getContentType(req.filePath), 'content-length': req.stats.size, - }) + }), ); fs.createReadStream(req.filePath).pipe(res); } @@ -110,7 +110,7 @@ export function appendDevServerClientScript(devServerConfig: d.DevServerConfig, const devServerClientUrl = util.getDevServerClientUrl( devServerConfig, req.headers?.['x-forwarded-host'] ?? req.host, - req.headers?.['x-forwarded-proto'] + req.headers?.['x-forwarded-proto'], ); const iframe = ``; return appendDevServerClientIframe(content, iframe); diff --git a/src/dev-server/server-context.ts b/src/dev-server/server-context.ts index a784ae29177..17f78ddfc4e 100644 --- a/src/dev-server/server-context.ts +++ b/src/dev-server/server-context.ts @@ -10,7 +10,7 @@ export function createServerContext( sendMsg: d.DevServerSendMessage, devServerConfig: d.DevServerConfig, buildResultsResolves: BuildRequestResolve[], - compilerRequestResolves: CompilerRequestResolve[] + compilerRequestResolves: CompilerRequestResolve[], ) { const logRequest = (req: d.HttpRequest, status: number) => { if (devServerConfig) { @@ -31,7 +31,7 @@ export function createServerContext( responseHeaders({ 'content-type': 'text/plain; charset=utf-8', 'x-source': xSource, - }) + }), ); res.write(util.inspect(error)); res.end(); @@ -50,7 +50,7 @@ export function createServerContext( responseHeaders({ 'content-type': 'image/x-icon', 'x-source': `favicon: ${xSource}`, - }) + }), ); const rs = fs.createReadStream(defaultFavicon); rs.on('error', (err) => { @@ -59,7 +59,7 @@ export function createServerContext( responseHeaders({ 'content-type': 'text/plain; charset=utf-8', 'x-source': `createReadStream error: ${err}, ${xSource}`, - }) + }), ); res.write(util.inspect(err)); res.end(); @@ -76,7 +76,7 @@ export function createServerContext( responseHeaders({ 'content-type': 'text/plain; charset=utf-8', 'x-source': xSource, - }) + }), ); res.write(content); res.end(); diff --git a/src/dev-server/server-process.ts b/src/dev-server/server-process.ts index 567fba25da6..9012bd0a02d 100644 --- a/src/dev-server/server-process.ts +++ b/src/dev-server/server-process.ts @@ -26,7 +26,7 @@ export function initServerProcess(sendMsg: d.DevServerSendMessage) { devServerConfig.address, devServerConfig.port, devServerConfig.basePath, - '/' + '/', ); devServerConfig.root = normalizePath(devServerConfig.root); @@ -45,7 +45,7 @@ export function initServerProcess(sendMsg: d.DevServerSendMessage) { devServerConfig.address, devServerConfig.port, devServerConfig.basePath, - devServerConfig.initialLoadUrl || DEV_SERVER_INIT_URL + devServerConfig.initialLoadUrl || DEV_SERVER_INIT_URL, ); openInBrowser({ url: initialLoadUrl }); } @@ -80,7 +80,7 @@ export function initServerProcess(sendMsg: d.DevServerSendMessage) { } resolve(); }); - }) + }), ); } Promise.all(promises).finally(() => { diff --git a/src/dev-server/server-web-socket.ts b/src/dev-server/server-web-socket.ts index 5f0ef05b1c5..35343292c62 100644 --- a/src/dev-server/server-web-socket.ts +++ b/src/dev-server/server-web-socket.ts @@ -6,7 +6,7 @@ import type * as d from '../declarations'; export function createWebSocket( httpServer: Server, - onMessageFromClient: (msg: d.DevServerMessage) => void + onMessageFromClient: (msg: d.DevServerMessage) => void, ): DevWebSocket { const wsConfig: ws.ServerOptions = { server: httpServer, diff --git a/src/dev-server/server-worker-thread.js b/src/dev-server/server-worker-thread.js index 554f7821e68..9050b1e3cbd 100644 --- a/src/dev-server/server-worker-thread.js +++ b/src/dev-server/server-worker-thread.js @@ -34,6 +34,6 @@ process.on('unhandledRejection', (e) => { { error: { message: 'unhandledRejection: ' + e, stack: typeof e.stack === 'string' ? e.stack : null }, }, - sendHandle + sendHandle, ); }); diff --git a/src/dev-server/ssr-request.ts b/src/dev-server/ssr-request.ts index 79d30fa33a3..022e65d432f 100644 --- a/src/dev-server/ssr-request.ts +++ b/src/dev-server/ssr-request.ts @@ -10,7 +10,7 @@ export async function ssrPageRequest( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { try { let status = 500; @@ -48,7 +48,7 @@ export async function ssrPageRequest( responseHeaders({ 'content-type': 'text/html; charset=utf-8', 'content-length': Buffer.byteLength(content, 'utf8'), - }) + }), ); res.write(content); res.end(); @@ -61,7 +61,7 @@ export async function ssrStaticDataRequest( devServerConfig: d.DevServerConfig, serverCtx: d.DevServerContext, req: d.HttpRequest, - res: ServerResponse + res: ServerResponse, ) { try { const data: any = {}; @@ -109,8 +109,8 @@ export async function ssrStaticDataRequest( 'content-type': 'application/json; charset=utf-8', 'content-length': Buffer.byteLength(content, 'utf8'), }, - httpCache && status === 200 - ) + httpCache && status === 200, + ), ); res.write(content); res.end(); @@ -232,7 +232,7 @@ function getSsrErrorContent(diagnostics: d.Diagnostic[]) {

${diagnostic.messageText}

- ` + `, )} `; diff --git a/src/hydrate/platform/hydrate-app.ts b/src/hydrate/platform/hydrate-app.ts index e283cc5c61f..d6dbd8b1c4a 100644 --- a/src/hydrate/platform/hydrate-app.ts +++ b/src/hydrate/platform/hydrate-app.ts @@ -13,9 +13,9 @@ export function hydrateApp( win: Window, opts: d.HydrateFactoryOptions, results: d.HydrateResults, - resolve: (results: d.HydrateResults) => void + resolve: (results: d.HydrateResults) => void, ) => void, - resolve: (results: d.HydrateResults) => void + resolve: (results: d.HydrateResults) => void, ) { const connectedElements = new Set(); const createdElements = new Set(); @@ -79,7 +79,7 @@ export function hydrateApp( $tagName$: elm.nodeName.toLowerCase(), $flags$: null, }, - null + null, ) as d.ComponentConstructor; if (Cstr != null && Cstr.cmpMeta != null) { @@ -167,7 +167,7 @@ async function hydrateComponent( results: d.HydrateResults, tagName: string, elm: d.HostElement, - waitingElements: Set + waitingElements: Set, ) { tagName = tagName.toLowerCase(); const Cstr = loadModule( @@ -175,7 +175,7 @@ async function hydrateComponent( $tagName$: tagName, $flags$: null, }, - null + null, ) as d.ComponentConstructor; if (Cstr != null) { diff --git a/src/hydrate/runner/hydrate-factory.ts b/src/hydrate/runner/hydrate-factory.ts index b3de18db3c1..eee724980de 100644 --- a/src/hydrate/runner/hydrate-factory.ts +++ b/src/hydrate/runner/hydrate-factory.ts @@ -8,9 +8,9 @@ export function hydrateFactory( win: Window, opts: DocOptions, results: d.HydrateResults, - resolve: (results: d.HydrateResults) => void + resolve: (results: d.HydrateResults) => void, ) => void, - resolve: (results: d.HydrateResults) => void + resolve: (results: d.HydrateResults) => void, ) { win; opts; diff --git a/src/hydrate/runner/render-utils.ts b/src/hydrate/runner/render-utils.ts index 48d7e3fda84..162224b7cde 100644 --- a/src/hydrate/runner/render-utils.ts +++ b/src/hydrate/runner/render-utils.ts @@ -7,7 +7,7 @@ export function normalizeHydrateOptions(inputOpts: d.HydrateDocumentOptions) { destroyWindow: false, destroyDocument: false, }, - inputOpts || {} + inputOpts || {}, ); if (typeof outputOpts.clientHydrateAnnotations !== 'boolean') { @@ -120,7 +120,7 @@ export function renderBuildDiagnostic( results: d.HydrateResults, level: 'error' | 'warn' | 'info' | 'log' | 'debug', header: string, - msg: string + msg: string, ) { const diagnostic: d.Diagnostic = { level: level, diff --git a/src/hydrate/runner/render.ts b/src/hydrate/runner/render.ts index cdf9fee8fc5..74e9576e74a 100644 --- a/src/hydrate/runner/render.ts +++ b/src/hydrate/runner/render.ts @@ -108,7 +108,7 @@ function render( win: Window & typeof globalThis, opts: HydrateFactoryOptions, results: HydrateResults, - resolve: (results: HydrateResults) => void + resolve: (results: HydrateResults) => void, ) { if (!(process as any).__stencilErrors) { (process as any).__stencilErrors = true; @@ -143,7 +143,7 @@ function afterHydrate( win: Window, opts: HydrateFactoryOptions, results: HydrateResults, - resolve: (results: HydrateResults) => void + resolve: (results: HydrateResults) => void, ) { if (typeof opts.afterHydrate === 'function') { try { @@ -169,7 +169,7 @@ function finalizeHydrate( doc: Document, opts: HydrateFactoryOptions, results: HydrateResults, - resolve: (results: HydrateResults) => void + resolve: (results: HydrateResults) => void, ) { try { inspectElement(results, doc.documentElement, 0); diff --git a/src/hydrate/runner/runtime-log.ts b/src/hydrate/runner/runtime-log.ts index 494d4ee1146..ea189f13235 100644 --- a/src/hydrate/runner/runtime-log.ts +++ b/src/hydrate/runner/runtime-log.ts @@ -4,7 +4,7 @@ import { renderBuildDiagnostic, renderCatchError } from './render-utils'; export function runtimeLogging( win: Window & typeof globalThis, opts: d.HydrateDocumentOptions, - results: d.HydrateResults + results: d.HydrateResults, ) { try { const pathname = win.location.pathname; diff --git a/src/hydrate/runner/window-initialize.ts b/src/hydrate/runner/window-initialize.ts index aa1e67e5e80..099632ef4c4 100644 --- a/src/hydrate/runner/window-initialize.ts +++ b/src/hydrate/runner/window-initialize.ts @@ -8,7 +8,7 @@ export function initializeWindow( win: Window & typeof globalThis, doc: Document, opts: d.HydrateDocumentOptions, - results: d.HydrateResults + results: d.HydrateResults, ) { try { win.location.href = opts.url; diff --git a/src/mock-doc/class-list.ts b/src/mock-doc/class-list.ts index b53a5aee6aa..3a4575b4202 100644 --- a/src/mock-doc/class-list.ts +++ b/src/mock-doc/class-list.ts @@ -67,7 +67,7 @@ function validateClass(className: string) { } if (/\s/.test(className)) { throw new Error( - `The token provided ('${className}') contains HTML space characters, which are not valid in tokens.` + `The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`, ); } } diff --git a/src/mock-doc/custom-element-registry.ts b/src/mock-doc/custom-element-registry.ts index 233f50fe413..3c0430f2680 100644 --- a/src/mock-doc/custom-element-registry.ts +++ b/src/mock-doc/custom-element-registry.ts @@ -10,7 +10,7 @@ export class MockCustomElementRegistry implements CustomElementRegistry { define(tagName: string, cstr: any, options?: any) { if (tagName.toLowerCase() !== tagName) { throw new Error( - `Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name` + `Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`, ); } @@ -143,7 +143,7 @@ export function createCustomElement(customElements: MockCustomElementRegistry, o } return false; }, - } + }, ); const elm = new MockHTMLElement(ownerDocument, tagName); diff --git a/src/mock-doc/element.ts b/src/mock-doc/element.ts index cc4924288d1..2a9a633d7d9 100644 --- a/src/mock-doc/element.ts +++ b/src/mock-doc/element.ts @@ -120,7 +120,7 @@ patchPropAttributes( }, { type: 'submit', - } + }, ); export class MockImageElement extends MockHTMLElement { @@ -198,7 +198,7 @@ patchPropAttributes( }, { type: 'text', - } + }, ); export class MockFormElement extends MockHTMLElement { diff --git a/src/mock-doc/node.ts b/src/mock-doc/node.ts index da44b55eb06..e39e70234fa 100644 --- a/src/mock-doc/node.ts +++ b/src/mock-doc/node.ts @@ -249,7 +249,7 @@ export class MockElement extends MockNode { blur() { dispatchEvent( this, - new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }) + new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }), ); } @@ -341,7 +341,7 @@ export class MockElement extends MockNode { focus(_options?: { preventScroll?: boolean }) { dispatchEvent( this, - new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }) + new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }), ); } diff --git a/src/mock-doc/test/attribute.spec.ts b/src/mock-doc/test/attribute.spec.ts index 6233f5f0935..57d363399ef 100644 --- a/src/mock-doc/test/attribute.spec.ts +++ b/src/mock-doc/test/attribute.spec.ts @@ -78,7 +78,7 @@ describe('attributes', () => { expect(element.getAttribute('prop6')).toBe(''); expect(element).toEqualHtml( - `
` + `
`, ); }); @@ -99,7 +99,7 @@ describe('attributes', () => { expect(element.getAttribute('prop6')).toBe(''); expect(element).toEqualHtml( - `
` + `
`, ); }); diff --git a/src/mock-doc/test/custom-elements.spec.ts b/src/mock-doc/test/custom-elements.spec.ts index d75f7cd509f..58e8ef131cb 100644 --- a/src/mock-doc/test/custom-elements.spec.ts +++ b/src/mock-doc/test/custom-elements.spec.ts @@ -19,7 +19,7 @@ describe('customElements', () => { static get observedAttributes() { return ['attr-a', 'attr-b']; } - } + }, ); const cmpA = document.createElement('CMP-a'); @@ -56,7 +56,7 @@ describe('customElements', () => { static get observedAttributes() { return ['attr-a', 'attr-b']; } - } + }, ); const cmpA = document.createElement('cmp-a'); @@ -102,7 +102,7 @@ describe('customElements', () => { disconnectedCallback() { disconnectedInc++; } - } + }, ); expect(connectedInc).toBe(0); @@ -140,7 +140,7 @@ describe('customElements', () => { connectedCallback() { connectedInc++; } - } + }, ); expect(connectedInc).toBe(0); @@ -168,7 +168,7 @@ describe('customElements', () => { connectedCallback() { connectedInc++; } - } + }, ); expect(connectedInc).toBe(0); @@ -188,7 +188,7 @@ describe('customElements', () => { connectedCallback() { connectedInc++; } - } + }, ); expect(connectedInc).toBe(0); @@ -214,7 +214,7 @@ describe('customElements', () => { disconnectedCallback() { disconnectedInc++; } - } + }, ); expect(connectedInc).toBe(0); diff --git a/src/runtime/bootstrap-lazy.ts b/src/runtime/bootstrap-lazy.ts index 0aa4f820ce6..4c86aa7e5ef 100644 --- a/src/runtime/bootstrap-lazy.ts +++ b/src/runtime/bootstrap-lazy.ts @@ -159,7 +159,7 @@ export const bootstrapLazy = (lazyBundles: d.LazyBundlesRuntimeData, options: d. cmpTags.push(tagName); customElements.define( tagName, - proxyComponent(HostElement as any, cmpMeta, PROXY_FLAGS.isElementConstructor) as any + proxyComponent(HostElement as any, cmpMeta, PROXY_FLAGS.isElementConstructor) as any, ); } }); diff --git a/src/runtime/client-hydrate.ts b/src/runtime/client-hydrate.ts index c0d948adcd5..46d5a7f6b16 100644 --- a/src/runtime/client-hydrate.ts +++ b/src/runtime/client-hydrate.ts @@ -18,7 +18,7 @@ export const initializeClientHydrate = ( hostElm: d.HostElement, tagName: string, hostId: string, - hostRef: d.HostRef + hostRef: d.HostRef, ) => { const endHydrate = createTime('hydrateClient', tagName); const shadowRoot = hostElm.shadowRoot; @@ -74,7 +74,7 @@ const clientHydrate = ( shadowRootNodes: d.RenderNode[], hostElm: d.HostElement, node: d.RenderNode, - hostId: string + hostId: string, ) => { let childNodeType: string; let childIdSplt: string[]; @@ -134,7 +134,7 @@ const clientHydrate = ( shadowRootNodes, hostElm, node.childNodes[i] as any, - hostId + hostId, ); } @@ -148,7 +148,7 @@ const clientHydrate = ( shadowRootNodes, hostElm, node.shadowRoot.childNodes[i] as any, - hostId + hostId, ); } } diff --git a/src/runtime/connected-callback.ts b/src/runtime/connected-callback.ts index 8fa484d90f6..84839f636b5 100644 --- a/src/runtime/connected-callback.ts +++ b/src/runtime/connected-callback.ts @@ -121,7 +121,7 @@ const setContentReference = (elm: d.HostElement) => { // create a node to represent where the original // content was first placed, which is useful later on const contentRefElm = (elm['s-cr'] = doc.createComment( - BUILD.isDebug ? `content-ref (host=${elm.localName})` : '' + BUILD.isDebug ? `content-ref (host=${elm.localName})` : '', ) as any); contentRefElm['s-cn'] = true; elm.insertBefore(contentRefElm, elm.firstChild); diff --git a/src/runtime/host-listener.ts b/src/runtime/host-listener.ts index d8fd67dae41..e7b27f1cab8 100644 --- a/src/runtime/host-listener.ts +++ b/src/runtime/host-listener.ts @@ -8,7 +8,7 @@ export const addHostEventListeners = ( elm: d.HostElement, hostRef: d.HostRef, listeners: d.ComponentRuntimeHostListener[], - attachParentListeners: boolean + attachParentListeners: boolean, ) => { if (BUILD.hostListener && listeners) { // this is called immediately within the element's constructor diff --git a/src/runtime/initialize-component.ts b/src/runtime/initialize-component.ts index 5a9a0e47603..348998ac6fa 100644 --- a/src/runtime/initialize-component.ts +++ b/src/runtime/initialize-component.ts @@ -15,7 +15,7 @@ export const initializeComponent = async ( hostRef: d.HostRef, cmpMeta: d.ComponentRuntimeMeta, hmrVersionId?: string, - Cstr?: any + Cstr?: any, ) => { // initializeComponent if ((hostRef.$flags$ & HOST_FLAGS.hasInitializedComponent) === 0) { @@ -31,7 +31,7 @@ export const initializeComponent = async ( // Await creates a micro-task avoid if possible const endLoad = uniqueTime( `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, - `[Stencil] Load module for <${cmpMeta.$tagName$}>` + `[Stencil] Load module for <${cmpMeta.$tagName$}>`, ); Cstr = await Cstr; endLoad(); diff --git a/src/runtime/platform-options.ts b/src/runtime/platform-options.ts index cf64ab8fc09..42e550464cd 100644 --- a/src/runtime/platform-options.ts +++ b/src/runtime/platform-options.ts @@ -6,13 +6,13 @@ interface SetPlatformOptions { el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; rel?: ( el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, - options: boolean | AddEventListenerOptions + options: boolean | AddEventListenerOptions, ) => void; ce?: (eventName: string, opts?: any) => CustomEvent; } diff --git a/src/runtime/proxy-component.ts b/src/runtime/proxy-component.ts index 064804e4e0b..86048a42659 100644 --- a/src/runtime/proxy-component.ts +++ b/src/runtime/proxy-component.ts @@ -19,7 +19,7 @@ import { getValue, setValue } from './set-value'; export const proxyComponent = ( Cstr: d.ComponentConstructor, cmpMeta: d.ComponentRuntimeMeta, - flags: number + flags: number, ): d.ComponentConstructor => { if (BUILD.member && cmpMeta.$members$) { if (BUILD.watchCallback && Cstr.watchers) { @@ -56,7 +56,7 @@ export const proxyComponent = ( (memberFlags & MEMBER_FLAGS.Mutable) === 0 ) { consoleDevWarn( - `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability` + `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`, ); } } diff --git a/src/runtime/set-value.ts b/src/runtime/set-value.ts index 1d8a6c94d85..dbcb9d14de5 100644 --- a/src/runtime/set-value.ts +++ b/src/runtime/set-value.ts @@ -34,7 +34,7 @@ export const setValue = (ref: d.RuntimeRef, propName: string, newVal: any, cmpMe '\nNew value', newVal, '\nOld value', - oldVal + oldVal, ); } else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) { consoleDevWarn( @@ -44,7 +44,7 @@ export const setValue = (ref: d.RuntimeRef, propName: string, newVal: any, cmpMe '\nNew value', newVal, '\nOld value', - oldVal + oldVal, ); } } diff --git a/src/runtime/styles.ts b/src/runtime/styles.ts index d0471230d0d..01684b6b9c8 100644 --- a/src/runtime/styles.ts +++ b/src/runtime/styles.ts @@ -86,7 +86,7 @@ export const attachStyles = (hostRef: d.HostRef) => { const scopeId = addStyle( BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, - hostRef.$modeName$ + hostRef.$modeName$, ); if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) { diff --git a/src/runtime/test/before-each.spec.tsx b/src/runtime/test/before-each.spec.tsx index d12aa569005..a1094348556 100644 --- a/src/runtime/test/before-each.spec.tsx +++ b/src/runtime/test/before-each.spec.tsx @@ -65,7 +65,7 @@ describe('newSpecPage, spec testing', () => { (ev: CustomEvent) => { expect(ev.detail.init).toBeTruthy(); }, - false + false, ); root.init(); await page.waitForChanges(); diff --git a/src/runtime/test/lifecycle-async.spec.tsx b/src/runtime/test/lifecycle-async.spec.tsx index 2f633ea37ff..d123520f665 100644 --- a/src/runtime/test/lifecycle-async.spec.tsx +++ b/src/runtime/test/lifecycle-async.spec.tsx @@ -94,7 +94,7 @@ describe('lifecycle async', () => { expect(root.textContent).toBe('connectedCallback componentWillLoad componentWillRender render'); expect(log.trim()).toEqual( - 'connectedCallback componentWillLoad componentWillRender render componentDidRender componentDidLoad' + 'connectedCallback componentWillLoad componentWillRender render componentDidRender componentDidLoad', ); log = ''; @@ -102,7 +102,7 @@ describe('lifecycle async', () => { await waitForChanges(); expect(log.trim()).toBe( - 'propDidChange componentWillUpdate componentWillRender render componentDidRender componentDidUpdate' + 'propDidChange componentWillUpdate componentWillRender render componentDidRender componentDidUpdate', ); }); diff --git a/src/runtime/test/lifecycle-sync.spec.tsx b/src/runtime/test/lifecycle-sync.spec.tsx index 0c28d2deb7b..8df0a3173d0 100644 --- a/src/runtime/test/lifecycle-sync.spec.tsx +++ b/src/runtime/test/lifecycle-sync.spec.tsx @@ -134,7 +134,7 @@ describe('lifecycle sync', () => { expect(root.textContent).toBe('connectedCallback componentWillLoad componentWillRender render'); expect(log.trim()).toEqual( - 'connectedCallback componentWillLoad componentWillRender render componentDidRender componentDidLoad' + 'connectedCallback componentWillLoad componentWillRender render componentDidRender componentDidLoad', ); log = ''; @@ -144,7 +144,7 @@ describe('lifecycle sync', () => { expect(root.textContent).toBe('propDidChange componentWillUpdate componentWillRender render'); expect(log.trim()).toBe( - 'propDidChange componentWillUpdate componentWillRender render componentDidRender componentDidUpdate' + 'propDidChange componentWillUpdate componentWillRender render componentDidRender componentDidUpdate', ); }); diff --git a/src/runtime/test/listen.spec.tsx b/src/runtime/test/listen.spec.tsx index a2b5b2ff744..4de1e3600a9 100644 --- a/src/runtime/test/listen.spec.tsx +++ b/src/runtime/test/listen.spec.tsx @@ -176,17 +176,17 @@ describe('listen', () => { a.dispatchEvent( new CustomEvent('event', { detail: getEventDetail(), - }) + }), ); a.dispatchEvent( new CustomEvent('event', { detail: getEventDetail(), - }) + }), ); a.dispatchEvent( new CustomEvent('event', { detail: getEventDetail(), - }) + }), ); await Promise.resolve(); @@ -195,7 +195,7 @@ describe('listen', () => { await waitForChanges(); expect(log).toEqual( - `connectedCallback event0 event1 event2 event3 event4 event5 componentWillLoad event6 componentDidLoad ` + `connectedCallback event0 event1 event2 event3 event4 event5 componentWillLoad event6 componentDidLoad `, ); expect(a).toEqualHtml(`1 7`); await waitForChanges(); diff --git a/src/runtime/test/render-vdom.spec.tsx b/src/runtime/test/render-vdom.spec.tsx index 81b4284d57b..c340d0b0a85 100644 --- a/src/runtime/test/render-vdom.spec.tsx +++ b/src/runtime/test/render-vdom.spec.tsx @@ -406,7 +406,7 @@ describe('render-vdom', () => { newSpecPage({ components: [CmpA], html: ``, - }) + }), ); expect(root).toEqualHtml(` @@ -434,7 +434,7 @@ describe('render-vdom', () => { newSpecPage({ components: [CmpA], html: ``, - }) + }), ); expect(root).toEqualHtml(` diff --git a/src/runtime/test/style.spec.tsx b/src/runtime/test/style.spec.tsx index 4916e7746ba..e7f1a723f2f 100644 --- a/src/runtime/test/style.spec.tsx +++ b/src/runtime/test/style.spec.tsx @@ -44,7 +44,7 @@ describe('style', () => { }); expect(doc.head.innerHTML).toEqual( - '' + '', ); }); diff --git a/src/runtime/test/watch.spec.tsx b/src/runtime/test/watch.spec.tsx index 2b6dfa07a1e..5a9d61aeea1 100644 --- a/src/runtime/test/watch.spec.tsx +++ b/src/runtime/test/watch.spec.tsx @@ -100,7 +100,7 @@ describe('watch', () => { newSpecPage({ components: [CmpA], html: ``, - }) + }), ); expect(rootInstance.watchCalled).toBe(6); @@ -162,7 +162,7 @@ describe('watch', () => { newSpecPage({ components: [CmpA], html: ``, - }) + }), ); expect(root).toEqualHtml(`2 4 4`); diff --git a/src/runtime/vdom/h.ts b/src/runtime/vdom/h.ts index c5c1f4b6d16..40faa9e137a 100644 --- a/src/runtime/vdom/h.ts +++ b/src/runtime/vdom/h.ts @@ -83,7 +83,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.` return (nodeName as d.FunctionalComponent)( vnodeData === null ? {} : vnodeData, vNodeChildren, - vdomFnUtils + vdomFnUtils, ) as any; } diff --git a/src/runtime/vdom/set-accessor.ts b/src/runtime/vdom/set-accessor.ts index 7428764808e..4728895d49c 100644 --- a/src/runtime/vdom/set-accessor.ts +++ b/src/runtime/vdom/set-accessor.ts @@ -19,7 +19,7 @@ export const setAccessor = ( oldValue: any, newValue: any, isSvg: boolean, - flags: number + flags: number, ) => { if (oldValue !== newValue) { let isProp = isMemberInElement(elm, memberName); diff --git a/src/runtime/vdom/test/attributes.spec.ts b/src/runtime/vdom/test/attributes.spec.ts index 7ae82ebacd0..1aa6a15e432 100755 --- a/src/runtime/vdom/test/attributes.spec.ts +++ b/src/runtime/vdom/test/attributes.spec.ts @@ -85,7 +85,7 @@ describe('attributes', () => { {}, h('div', { 'xlink:href': testUrl, - }) + }), ); hostElm = document.createElementNS(SVG_NS, 'svg') as any; diff --git a/src/runtime/vdom/test/event-listeners.spec.ts b/src/runtime/vdom/test/event-listeners.spec.ts index 7a395be1088..60763b6ffab 100644 --- a/src/runtime/vdom/test/event-listeners.spec.ts +++ b/src/runtime/vdom/test/event-listeners.spec.ts @@ -37,7 +37,7 @@ describe('event listeners', () => { result.push(1); }, }, - h('a', null, 'Click my parent') + h('a', null, 'Click my parent'), ); const vnode2 = h( @@ -47,7 +47,7 @@ describe('event listeners', () => { result.push(2); }, }, - h('a', null, 'Click my parent') + h('a', null, 'Click my parent'), ); patch(vnode0, vnode1); diff --git a/src/runtime/vdom/test/patch-svg.spec.ts b/src/runtime/vdom/test/patch-svg.spec.ts index 74ed81f3776..0d32ee6f735 100644 --- a/src/runtime/vdom/test/patch-svg.spec.ts +++ b/src/runtime/vdom/test/patch-svg.spec.ts @@ -26,7 +26,12 @@ describe('renderer', () => { const vnode1 = toVNode(svgElm); patch( vnode1, - h('svg', null, h('foreignObject', null, h('div', null, 'I am HTML embedded in SVG')), h('feGaussianBlur', null)) + h( + 'svg', + null, + h('foreignObject', null, h('div', null, 'I am HTML embedded in SVG')), + h('feGaussianBlur', null), + ), ); expect(svgElm.namespaceURI).toEqual(SVG_NS); @@ -47,7 +52,7 @@ describe('renderer', () => { it('should not affect subsequence element', () => { patch( vnode0, - h('div', null, [h('svg', null, [h('title', null, 'Title'), h('circle', null)] as any), h('div', null)] as any) + h('div', null, [h('svg', null, [h('title', null, 'Title'), h('circle', null)] as any), h('div', null)] as any), ); expect(hostElm.tagName).toEqual('DIV'); diff --git a/src/runtime/vdom/test/patch.spec.ts b/src/runtime/vdom/test/patch.spec.ts index 5183410cd9b..dfe40b05bee 100755 --- a/src/runtime/vdom/test/patch.spec.ts +++ b/src/runtime/vdom/test/patch.spec.ts @@ -599,7 +599,7 @@ describe('renderer', () => { null, ...arr.map(function (n) { return spanNumWithOpacity(n, '1'); - }) + }), ); const shufArr = shuffleArray(arr.slice(0)); @@ -618,7 +618,7 @@ describe('renderer', () => { null, ...arr.map(function (n) { return spanNumWithOpacity(shufArr[n], opacities[n]); - }) + }), ); patch(vnode1, vnode2); @@ -679,7 +679,7 @@ describe('renderer', () => { expect(map(inner, hostElm.children)).toEqual( arr.filter(function (x) { return x != null; - }) + }), ); } }); diff --git a/src/runtime/vdom/test/scoped-slot.spec.tsx b/src/runtime/vdom/test/scoped-slot.spec.tsx index 411fa469888..9b14332d597 100644 --- a/src/runtime/vdom/test/scoped-slot.spec.tsx +++ b/src/runtime/vdom/test/scoped-slot.spec.tsx @@ -282,10 +282,10 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('CAMEL'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('OWL'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName, ).toBe('DINGO'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent, ).toBe('parent message'); forceUpdate(root); @@ -296,10 +296,10 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('CAMEL'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('OWL'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName, ).toBe('DINGO'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent, ).toBe('parent message'); }); @@ -398,7 +398,7 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('CHIPMUNK'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('BEAR'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent).toBe( - 'parent message' + 'parent message', ); root.msg = 'change 1'; @@ -658,10 +658,10 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('TEST-2'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('GOOSE'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName, ).toBe('GOAT'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent, ).toBe('1'); forceUpdate(root); @@ -672,10 +672,10 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('TEST-2'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('GOOSE'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName, ).toBe('GOAT'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent, ).toBe('2'); forceUpdate(root); @@ -686,10 +686,10 @@ describe('scoped slot', () => { expect(root.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('TEST-2'); expect(root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName).toBe('GOOSE'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.nodeName, ).toBe('GOAT'); expect( - root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent + root.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild.textContent, ).toBe('3'); }); diff --git a/src/runtime/vdom/test/set-accessor.spec.ts b/src/runtime/vdom/test/set-accessor.spec.ts index ce79e133fb7..de44d032027 100644 --- a/src/runtime/vdom/test/set-accessor.spec.ts +++ b/src/runtime/vdom/test/set-accessor.spec.ts @@ -687,7 +687,7 @@ describe('setAccessor for standard html elements', () => { class2 class3 `, false, - 0 + 0, ); expect(elm).toHaveClasses(['class1', 'class2', 'class3']); }); @@ -724,7 +724,7 @@ describe('setAccessor for standard html elements', () => { ion-color`, 'icon2', false, - 0 + 0, ); expect(elm).toHaveClasses(['icon2']); }); @@ -775,7 +775,7 @@ describe('setAccessor for standard html elements', () => { marginRight: '55px', }, false, - 0 + 0, ); expect(elm.style.cssText).toEqual('font-size: 12px; margin-right: 55px;'); @@ -791,7 +791,7 @@ describe('setAccessor for standard html elements', () => { 'font-size': '20px', }, false, - 0 + 0, ); expect(elm.style.cssText).toEqual('font-size: 20px;'); @@ -808,7 +808,7 @@ describe('setAccessor for standard html elements', () => { { color: 'blue', 'font-size': '12px', paddingLeft: '88px' }, { color: 'blue', 'font-size': '12px', paddingLeft: '88px' }, false, - 0 + 0, ); expect(elm.style.cssText).toEqual(''); @@ -827,7 +827,7 @@ describe('setAccessor for standard html elements', () => { { color: 'blue', padding: '20px', marginRight: '88px' }, { color: 'blue', padding: '30px', marginRight: '55px' }, false, - 0 + 0, ); expect(elm.style.cssText).toEqual('color: black; padding: 30px; margin-right: 55px;'); diff --git a/src/runtime/vdom/update-element.ts b/src/runtime/vdom/update-element.ts index 7b7ed5939e6..dbc26c882ac 100644 --- a/src/runtime/vdom/update-element.ts +++ b/src/runtime/vdom/update-element.ts @@ -9,7 +9,7 @@ export const updateElement = ( oldVnode: d.VNode | null, newVnode: d.VNode, isSvgMode: boolean, - memberName?: string + memberName?: string, ): void => { // if the element passed in is a shadow root, which is a document fragment // then we want to be adding attrs/props to the shadow root's "host" element diff --git a/src/runtime/vdom/vdom-annotations.ts b/src/runtime/vdom/vdom-annotations.ts index 51e9514e312..a4bae72c636 100644 --- a/src/runtime/vdom/vdom-annotations.ts +++ b/src/runtime/vdom/vdom-annotations.ts @@ -80,7 +80,7 @@ const parseVNodeAnnotations = ( doc: Document, node: d.RenderNode, docData: DocData, - orgLocationNodes: d.RenderNode[] + orgLocationNodes: d.RenderNode[], ) => { if (node == null) { return; @@ -110,7 +110,7 @@ const insertVNodeAnnotations = ( hostElm: d.HostElement, vnode: d.VNode, docData: DocData, - cmpData: CmpData + cmpData: CmpData, ) => { if (vnode != null) { const hostId = ++docData.hostIds; @@ -133,13 +133,13 @@ const insertVNodeAnnotations = ( if (parent && parent.childNodes) { const parentChildNodes: ChildNode[] = Array.from(parent.childNodes); const comment: d.RenderNode | undefined = parentChildNodes.find( - (node) => node.nodeType === NODE_TYPE.CommentNode && (node as d.RenderNode)['s-sr'] + (node) => node.nodeType === NODE_TYPE.CommentNode && (node as d.RenderNode)['s-sr'], ) as d.RenderNode | undefined; if (comment) { const index: number = parentChildNodes.indexOf(hostElm) - 1; (vnode.$elm$ as d.RenderNode).setAttribute( HYDRATE_CHILD_ID, - `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}` + `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`, ); } } @@ -153,7 +153,7 @@ const insertChildVNodeAnnotations = ( cmpData: CmpData, hostId: number, depth: number, - index: number + index: number, ) => { const childElm = vnodeChild.$elm$ as d.RenderNode; if (childElm == null) { diff --git a/src/runtime/vdom/vdom-render.ts b/src/runtime/vdom/vdom-render.ts index a4e6fe77d8a..fd8a8203a06 100644 --- a/src/runtime/vdom/vdom-render.ts +++ b/src/runtime/vdom/vdom-render.ts @@ -66,7 +66,7 @@ const createElm = (oldParentVNode: d.VNode, newParentVNode: d.VNode, childIndex: consoleDevError( `The JSX ${ newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element` - } node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes` + } node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`, ); } @@ -88,12 +88,12 @@ const createElm = (oldParentVNode: d.VNode, newParentVNode: d.VNode, childIndex: isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? 'slot-fb' - : (newVNode.$tag$ as string) + : (newVNode.$tag$ as string), ) : doc.createElement( BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? 'slot-fb' - : (newVNode.$tag$ as string) + : (newVNode.$tag$ as string), ) ) as any; @@ -213,7 +213,7 @@ const addVnodes = ( parentVNode: d.VNode, vnodes: d.VNode[], startIdx: number, - endIdx: number + endIdx: number, ) => { let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm) as any; let childNode: Node; @@ -511,7 +511,7 @@ const updateChildren = (parentElm: d.RenderNode, oldCh: d.VNode[], newVNode: d.V newVNode, newCh, newStartIdx, - newEndIdx + newEndIdx, ); } else if (BUILD.updatable && newStartIdx > newEndIdx) { // there are nodes in the `oldCh` array which no longer correspond to nodes @@ -836,7 +836,7 @@ render() { if (BUILD.reflect && cmpMeta.$attrsToReflect$) { rootVnode.$attrs$ = rootVnode.$attrs$ || {}; cmpMeta.$attrsToReflect$.map( - ([propName, attribute]) => (rootVnode.$attrs$[attribute] = (hostElm as any)[propName]) + ([propName, attribute]) => (rootVnode.$attrs$[attribute] = (hostElm as any)[propName]), ); } @@ -957,7 +957,7 @@ render() { // otherwise these nodes are text nodes w/out content const slotReferenceDebugNode = (slotVNode: d.VNode) => doc.createComment( - ` (host=${hostTagName.toLowerCase()})` + ` (host=${hostTagName.toLowerCase()})`, ); const originalLocationDebugNode = (nodeToRelocate: d.RenderNode): any => @@ -965,5 +965,5 @@ const originalLocationDebugNode = (nodeToRelocate: d.RenderNode): any => `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` - : `[${nodeToRelocate.textContent}]`) + : `[${nodeToRelocate.textContent}]`), ); diff --git a/src/screenshot/connector-base.ts b/src/screenshot/connector-base.ts index 3b44d36eecd..d736cc7f448 100644 --- a/src/screenshot/connector-base.ts +++ b/src/screenshot/connector-base.ts @@ -77,7 +77,7 @@ export class ScreenshotConnector implements d.ScreenshotConnector { this.logger.debug(`screenshot build: ${this.buildId}, ${this.buildMessage}, updateMaster: ${this.updateMaster}`); this.logger.debug( - `screenshot, allowableMismatchedPixels: ${this.allowableMismatchedPixels}, allowableMismatchedRatio: ${this.allowableMismatchedRatio}, pixelmatchThreshold: ${this.pixelmatchThreshold}` + `screenshot, allowableMismatchedPixels: ${this.allowableMismatchedPixels}, allowableMismatchedRatio: ${this.allowableMismatchedRatio}, pixelmatchThreshold: ${this.pixelmatchThreshold}`, ); if (typeof opts.screenshotDirName === 'string') { @@ -216,7 +216,7 @@ export class ScreenshotConnector implements d.ScreenshotConnector { const imageFilePath = join(this.imagesDir, screenshot.image); const imageBuf = await readFileBuffer(imageFilePath); const jsonpContent = `loadScreenshot("${screenshot.image}","data:image/png;base64,${imageBuf.toString( - 'base64' + 'base64', )}");`; await writeFile(jsonFilePath, jsonpContent); } diff --git a/src/screenshot/connector-local.ts b/src/screenshot/connector-local.ts index d0dda4e19b6..6ab6e99be59 100644 --- a/src/screenshot/connector-local.ts +++ b/src/screenshot/connector-local.ts @@ -44,7 +44,7 @@ export class ScreenshotLocalConnector extends ScreenshotConnector { imagesUrl, jsonpUrl, results.masterBuild, - results.currentBuild + results.currentBuild, ); const compareAppFileName = 'compare.html'; @@ -90,7 +90,7 @@ function createLocalCompareApp( imagesUrl: string, jsonpUrl: string, a: d.ScreenshotBuild, - b: d.ScreenshotBuild + b: d.ScreenshotBuild, ) { return ` diff --git a/src/screenshot/screenshot-compare.ts b/src/screenshot/screenshot-compare.ts index 7daf32cfe12..1ce67c15903 100644 --- a/src/screenshot/screenshot-compare.ts +++ b/src/screenshot/screenshot-compare.ts @@ -14,7 +14,7 @@ export async function compareScreenshot( width: number, height: number, testPath: string, - pixelmatchThreshold: number + pixelmatchThreshold: number, ) { const currentImageHash = createHash('md5').update(currentScreenshotBuf).digest('hex'); const currentImageName = `${currentImageHash}.png`; @@ -118,7 +118,7 @@ export async function compareScreenshot( screenshot.diff.mismatchedPixels = await getMismatchedPixels( screenshotBuildData.pixelmatchModulePath, - pixelMatchInput + pixelMatchInput, ); } } diff --git a/src/sys/node/node-copy-tasks.ts b/src/sys/node/node-copy-tasks.ts index 83a83a465c1..2c4c3438f41 100644 --- a/src/sys/node/node-copy-tasks.ts +++ b/src/sys/node/node-copy-tasks.ts @@ -127,7 +127,7 @@ async function processCopyTaskDirectory(results: d.CopyResults, allCopyTasks: d. }; await processCopyTask(results, allCopyTasks, subCopyTask); - }) + }), ); } catch (e: any) { catchError(results.diagnostics, e); diff --git a/src/sys/node/node-lazy-require.ts b/src/sys/node/node-lazy-require.ts index 22470b58db5..5ffaf23f5e2 100644 --- a/src/sys/node/node-lazy-require.ts +++ b/src/sys/node/node-lazy-require.ts @@ -46,7 +46,7 @@ export class NodeLazyRequire implements d.LazyRequire { */ constructor( private nodeResolveModule: NodeResolveModule, - private lazyDependencies: LazyDependencies + private lazyDependencies: LazyDependencies, ) {} /** diff --git a/src/sys/node/node-resolve-module.ts b/src/sys/node/node-resolve-module.ts index e65701e8a2a..1f0e6045522 100644 --- a/src/sys/node/node-resolve-module.ts +++ b/src/sys/node/node-resolve-module.ts @@ -33,7 +33,7 @@ export class NodeResolveModule { id: fromFile, filename: fromFile, paths: Module._nodeModulePaths(fromDir), - }) + }), ); const root = normalizePath(path.parse(fromDir).root); diff --git a/src/sys/node/node-stencil-version-checker.ts b/src/sys/node/node-stencil-version-checker.ts index ee2e825d12a..3fe6999dac5 100644 --- a/src/sys/node/node-stencil-version-checker.ts +++ b/src/sys/node/node-stencil-version-checker.ts @@ -19,7 +19,7 @@ export async function checkVersion(logger: Logger, currentVersion: string): Prom printUpdateMessage(logger, currentVersion, latestVersion); } else { console.debug( - `${logger.cyan('@stencil/core')} version ${logger.green(currentVersion)} is the latest version` + `${logger.cyan('@stencil/core')} version ${logger.green(currentVersion)} is the latest version`, ); } }; diff --git a/src/sys/node/node-sys.ts b/src/sys/node/node-sys.ts index 05cc98eb848..d0e8c63ddca 100644 --- a/src/sys/node/node-sys.ts +++ b/src/sys/node/node-sys.ts @@ -272,7 +272,7 @@ export function createNodeSys(c: { process?: any; logger?: Logger } = {}): Compi resolve( files.map((f) => { return normalizePath(path.join(p, f)); - }) + }), ); } }); @@ -461,7 +461,7 @@ export function createNodeSys(c: { process?: any; logger?: Logger } = {}): Compi logger?.debug(`NODE_SYS_DEBUG::watchDir:callback dir=${p} changedPath=${fileName}`); callback(normalizePath(fileName), 'fileUpdate'); }, - recursive + recursive, ); const close = () => { @@ -541,7 +541,7 @@ export function createNodeSys(c: { process?: any; logger?: Logger } = {}): Compi watchFile: ts.WatchFileKind.FixedPollingInterval, // set fallbackPolling so that directories are given the correct watcher variant fallbackPolling: ts.PollingWatchKind.FixedInterval, - } + }, ); const close = () => { diff --git a/src/sys/node/node-worker-controller.ts b/src/sys/node/node-worker-controller.ts index 22b31217976..747de0d677d 100755 --- a/src/sys/node/node-worker-controller.ts +++ b/src/sys/node/node-worker-controller.ts @@ -17,7 +17,7 @@ export class NodeWorkerController extends EventEmitter implements d.WorkerMainCo constructor( public forkModulePath: string, - maxConcurrentWorkers: number + maxConcurrentWorkers: number, ) { super(); const osCpus = cpus().length; diff --git a/src/sys/node/node-worker-main.ts b/src/sys/node/node-worker-main.ts index 9f4e5efb952..562b6ce70d9 100644 --- a/src/sys/node/node-worker-main.ts +++ b/src/sys/node/node-worker-main.ts @@ -16,7 +16,7 @@ export class NodeWorkerMain extends EventEmitter { constructor( public id: number, - forkModulePath: string + forkModulePath: string, ) { super(); this.fork(forkModulePath); diff --git a/src/sys/node/test/node-lazy-require.spec.ts b/src/sys/node/test/node-lazy-require.spec.ts index 3d8263d3cd5..59915409c4b 100644 --- a/src/sys/node/test/node-lazy-require.spec.ts +++ b/src/sys/node/test/node-lazy-require.spec.ts @@ -43,7 +43,7 @@ describe('node-lazy-require', () => { readFSMock.mockReturnValue(mockPackageJson(testVersion)); const diagnostics = await nodeLazyRequire.ensure('.', ['jest']); expect(diagnostics.length).toBe(0); - } + }, ); it.each(['2.0.7', '10.10.10', '36.0.1', '38.0.2', '38.5.17'])( @@ -53,7 +53,7 @@ describe('node-lazy-require', () => { readFSMock.mockReturnValue(mockPackageJson(testVersion)); const diagnostics = await nodeLazyRequire.ensure('.', ['jest']); expect(diagnostics.length).toBe(0); - } + }, ); it.each(['38', undefined])('should error w/ installed version too low and maxVersion=%p', async (maxVersion) => { @@ -80,7 +80,7 @@ describe('node-lazy-require', () => { header: 'Please install supported versions of dev dependencies with either npm or yarn.', messageText: `npm install --save-dev jest@${range.jest.recommendedVersion}`, }); - } + }, ); }); }); diff --git a/src/testing/jest/jest-preprocessor.ts b/src/testing/jest/jest-preprocessor.ts index 4b260e87be8..98c4c1f2e12 100644 --- a/src/testing/jest/jest-preprocessor.ts +++ b/src/testing/jest/jest-preprocessor.ts @@ -56,7 +56,7 @@ export const jestPreprocessor = { sourceText: string, sourcePath: string, jestConfig: Jest26Config | Jest27TransformOptions, - transformOptions?: Jest26Config + transformOptions?: Jest26Config, ): string { // TODO(STENCIL-306): Drop support for versions of Jest <27 /** @@ -132,7 +132,7 @@ export const jestPreprocessor = { sourceText: string, sourcePath: string, jestConfigStr: string | Jest27TransformOptions, - transformOptions?: Jest26CacheKeyOptions + transformOptions?: Jest26CacheKeyOptions, ): string { // TODO(STENCIL-306): Remove support for earlier versions of Jest /** @@ -225,7 +225,7 @@ function getCompilerOptions(rootDir: string): ts.CompilerOptions | null { ts.sys, rootDir, undefined, - tsconfigFilePath + tsconfigFilePath, ); _tsCompilerOptions = parseResult.options; diff --git a/src/testing/matchers/html.ts b/src/testing/matchers/html.ts index e325e8c54a2..d407a061bf8 100644 --- a/src/testing/matchers/html.ts +++ b/src/testing/matchers/html.ts @@ -12,7 +12,7 @@ export function toEqualLightHtml(input: string | HTMLElement | ShadowRoot, shoul export function compareHtml( input: string | HTMLElement | ShadowRoot, shouldEqual: string, - serializeShadowRoot: boolean + serializeShadowRoot: boolean, ) { if (input == null) { throw new Error(`expect toEqualHtml() value is "${input}"`); diff --git a/src/testing/matchers/screenshot.ts b/src/testing/matchers/screenshot.ts index d42b5cac6f9..45bbabfca78 100644 --- a/src/testing/matchers/screenshot.ts +++ b/src/testing/matchers/screenshot.ts @@ -7,7 +7,7 @@ export function toMatchScreenshot(compare: d.ScreenshotDiff, opts: d.MatchScreen if (typeof (compare as any).then === 'function') { throw new Error( - `expect(compare).toMatchScreenshot() must be a resolved value, not a promise, before it can be tested` + `expect(compare).toMatchScreenshot() must be a resolved value, not a promise, before it can be tested`, ); } @@ -35,7 +35,7 @@ export function toMatchScreenshot(compare: d.ScreenshotDiff, opts: d.MatchScreen if (typeof opts.allowableMismatchedPixels === 'number') { if (opts.allowableMismatchedPixels < 0) { throw new Error( - `expect toMatchScreenshot() allowableMismatchedPixels value must be a value that is 0 or greater` + `expect toMatchScreenshot() allowableMismatchedPixels value must be a value that is 0 or greater`, ); } return { diff --git a/src/testing/platform/testing-host-ref.ts b/src/testing/platform/testing-host-ref.ts index 4c4e11305d1..aa567516f59 100644 --- a/src/testing/platform/testing-host-ref.ts +++ b/src/testing/platform/testing-host-ref.ts @@ -22,7 +22,7 @@ export const getHostRef = (elm: d.RuntimeRef | undefined): d.HostRef | undefined */ export const registerInstance = ( lazyInstance: any, - hostRef: d.HostRef | null | undefined + hostRef: d.HostRef | null | undefined, ): Map => { if (lazyInstance == null || lazyInstance.constructor == null) { throw new Error(`Invalid component constructor`); diff --git a/src/testing/puppeteer/puppeteer-element.ts b/src/testing/puppeteer/puppeteer-element.ts index 1cacbaa27f1..c43d1c827d1 100644 --- a/src/testing/puppeteer/puppeteer-element.ts +++ b/src/testing/puppeteer/puppeteer-element.ts @@ -14,7 +14,7 @@ export class E2EElement extends MockHTMLElement implements pd.E2EElementInternal constructor( private _page: pd.E2EPageInternal, - private _elmHandle: puppeteer.ElementHandle + private _elmHandle: puppeteer.ElementHandle, ) { super(null, null); _page._e2eElements.push(this); @@ -175,7 +175,7 @@ export class E2EElement extends MockHTMLElement implements pd.E2EElementInternal return elm[propertyName]; }, this._elmHandle, - propertyName + propertyName, ); return propValue; @@ -387,7 +387,7 @@ export class E2EElement extends MockHTMLElement implements pd.E2EElementInternal return rtn; }, this._elmHandle, - pseudoElt + pseudoElt, ); style.getPropertyValue = (propName: string) => { @@ -461,7 +461,7 @@ export class E2EElement extends MockHTMLElement implements pd.E2EElementInternal }); }, this._elmHandle, - this._queuedActions as any + this._queuedActions as any, ); this._queuedActions.length = 0; @@ -546,7 +546,7 @@ async function findWithCssSelector( page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, lightSelector: string, - shadowSelector: string + shadowSelector: string, ) { let elmHandle = await rootHandle.$(lightSelector); @@ -564,7 +564,7 @@ async function findWithCssSelector( return elm.shadowRoot.querySelector(shadowSelector); }, elmHandle, - shadowSelector + shadowSelector, ); await elmHandle.dispose(); @@ -583,7 +583,7 @@ async function findWithText( page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, text: string, - contains: string + contains: string, ) { const jsHandle = await page.evaluateHandle( (rootElm: Element, text: string, contains: string) => { @@ -622,7 +622,7 @@ async function findWithText( }, rootHandle, text, - contains + contains, ); if (jsHandle) { @@ -635,7 +635,7 @@ async function findWithText( export async function findAll( page: pd.E2EPageInternal, rootHandle: puppeteer.ElementHandle, - selector: pd.FindSelector + selector: pd.FindSelector, ) { const foundElms: E2EElement[] = []; @@ -659,7 +659,7 @@ export async function findAll( return elm.shadowRoot.querySelectorAll(shadowSelector); }, lightElmHandles[i], - shadowSelector + shadowSelector, ); await lightElmHandles[i].dispose(); diff --git a/src/testing/puppeteer/puppeteer-events.ts b/src/testing/puppeteer/puppeteer-events.ts index 77eb65005e3..1323b05cf8f 100644 --- a/src/testing/puppeteer/puppeteer-events.ts +++ b/src/testing/puppeteer/puppeteer-events.ts @@ -33,7 +33,7 @@ async function pageSpyOnEvent(page: pd.E2EPageInternal, eventName: string, selec export async function waitForEvent( page: pd.E2EPageInternal, eventName: string, - elementHandle: puppeteer.ElementHandle + elementHandle: puppeteer.ElementHandle, ) { const timeoutMs = jasmine.DEFAULT_TIMEOUT_INTERVAL * 0.5; const ev = await page.evaluate( @@ -49,13 +49,13 @@ export async function waitForEvent( clearTimeout(tmr); resolve((window as unknown as pd.BrowserWindow).stencilSerializeEvent(ev as any)); }, - { once: true } + { once: true }, ); }); }, elementHandle, eventName, - timeoutMs + timeoutMs, ); await page.waitForChanges(); @@ -113,7 +113,7 @@ export async function addE2EListener( page: pd.E2EPageInternal, elmHandle: puppeteer.JSHandle, eventName: string, - callback: (ev: any) => void + callback: (ev: any) => void, ) { // NODE CONTEXT const id = page._e2eEventIds++; @@ -128,12 +128,12 @@ export async function addE2EListener( elm.addEventListener(eventName, (ev: any) => { (window as unknown as pd.BrowserWindow).stencilOnEvent( id, - (window as unknown as pd.BrowserWindow).stencilSerializeEvent(ev) + (window as unknown as pd.BrowserWindow).stencilSerializeEvent(ev), ); }); }, id, - eventName + eventName, ); } diff --git a/src/testing/puppeteer/puppeteer-screenshot.ts b/src/testing/puppeteer/puppeteer-screenshot.ts index cb6fe14ed56..786d3ca2bd7 100644 --- a/src/testing/puppeteer/puppeteer-screenshot.ts +++ b/src/testing/puppeteer/puppeteer-screenshot.ts @@ -54,7 +54,7 @@ export function initPageScreenshot(page: pd.E2EPageInternal) { if (jestEnv.screenshotDescriptions.has(desc)) { throw new Error( - `Screenshot description "${desc}" found in "${testPath}" cannot be used for multiple screenshots and must be unique. To make screenshot descriptions unique within the same test, use the first argument to "compareScreenshot", such as "compareScreenshot('more to the description')".` + `Screenshot description "${desc}" found in "${testPath}" cannot be used for multiple screenshots and must be unique. To make screenshot descriptions unique within the same test, use the first argument to "compareScreenshot", such as "compareScreenshot('more to the description')".`, ); } jestEnv.screenshotDescriptions.add(desc); @@ -84,7 +84,7 @@ export async function pageCompareScreenshot( env: E2EProcessEnv, desc: string, testPath: string, - opts: ScreenshotOptions + opts: ScreenshotOptions, ) { if (typeof env.__STENCIL_EMULATE__ !== 'string') { throw new Error(`compareScreenshot, missing screenshot emulate env var`); @@ -131,7 +131,7 @@ export async function pageCompareScreenshot( width, height, testPath, - pixelmatchThreshold + pixelmatchThreshold, ); return results; diff --git a/src/testing/testing-utils.ts b/src/testing/testing-utils.ts index 9475c93aca6..6325a9a79b0 100644 --- a/src/testing/testing-utils.ts +++ b/src/testing/testing-utils.ts @@ -39,7 +39,7 @@ export function expectFilesExist(fs: InMemoryFileSystem, filePaths: string[]): v throw new Error( `The following files were expected, but could not be found:\n${notFoundFiles .map((result: string) => '-' + result) - .join('\n')}` + .join('\n')}`, ); } } @@ -58,7 +58,7 @@ export function expectFilesDoNotExist(fs: InMemoryFileSystem, filePaths: string[ throw new Error( `The following files were expected to not exist, but do:\n${existentFiles .map((result: string) => '-' + result) - .join('\n')}` + .join('\n')}`, ); } } diff --git a/src/testing/testing.ts b/src/testing/testing.ts index 104a62ebad4..d4f6848fbb7 100644 --- a/src/testing/testing.ts +++ b/src/testing/testing.ts @@ -37,7 +37,7 @@ export const createTesting = async (config: ValidatedConfig): Promise = try { if (!opts.spec && !opts.e2e) { config.logger.error( - `Testing requires either the --spec or --e2e command line flags, or both. For example, to run unit tests, use the command: stencil test --spec` + `Testing requires either the --spec or --e2e command line flags, or both. For example, to run unit tests, use the command: stencil test --spec`, ); return false; } diff --git a/src/utils/format-component-runtime-meta.ts b/src/utils/format-component-runtime-meta.ts index be3062ade55..92967a694c7 100644 --- a/src/utils/format-component-runtime-meta.ts +++ b/src/utils/format-component-runtime-meta.ts @@ -3,7 +3,7 @@ import { CMP_FLAGS, LISTENER_FLAGS, MEMBER_FLAGS } from './constants'; export const formatLazyBundleRuntimeMeta = ( bundleId: any, - cmps: d.ComponentCompilerMeta[] + cmps: d.ComponentCompilerMeta[], ): d.LazyBundleRuntimeData => { return [bundleId, cmps.map((cmp) => formatComponentRuntimeMeta(cmp, true))]; }; @@ -18,7 +18,7 @@ export const formatLazyBundleRuntimeMeta = ( */ export const formatComponentRuntimeMeta = ( compilerMeta: d.ComponentCompilerMeta, - includeMethods: boolean + includeMethods: boolean, ): d.ComponentRuntimeMetaCompact => { let flags = 0; if (compilerMeta.encapsulation === 'shadow') { @@ -58,7 +58,7 @@ export const stringifyRuntimeData = (data: any) => { const formatComponentRuntimeMembers = ( compilerMeta: d.ComponentCompilerMeta, - includeMethods = true + includeMethods = true, ): d.ComponentRuntimeMembers => { return { ...formatPropertiesRuntimeMember(compilerMeta.properties), diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 004cf53555e..c59e2c08882 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -163,7 +163,7 @@ export const pluck = (obj: { [key: string]: any }, keys: string[]) => { } return final; }, - {} as { [key: string]: any } + {} as { [key: string]: any }, ); }; diff --git a/src/utils/logger/logger-rollup.ts b/src/utils/logger/logger-rollup.ts index b0eb9aa3c26..072ae07b644 100644 --- a/src/utils/logger/logger-rollup.ts +++ b/src/utils/logger/logger-rollup.ts @@ -9,7 +9,7 @@ export const loadRollupDiagnostics = ( config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, - rollupError: RollupError + rollupError: RollupError, ) => { const formattedCode = formatErrorCode(rollupError.code); diff --git a/src/utils/logger/logger-typescript.ts b/src/utils/logger/logger-typescript.ts index 4b4761b31d1..3d822779031 100644 --- a/src/utils/logger/logger-typescript.ts +++ b/src/utils/logger/logger-typescript.ts @@ -183,7 +183,7 @@ export const loadTypeScriptDiagnostic = (tsDiagnostic: Diagnostic): d.Diagnostic */ const flattenDiagnosticMessageText = ( tsDiagnostic: Diagnostic, - diag: string | DiagnosticMessageChain | undefined + diag: string | DiagnosticMessageChain | undefined, ): string => { if (typeof diag === 'string') { return diag; diff --git a/src/utils/message-utils.ts b/src/utils/message-utils.ts index d9baeb9ba1e..3b20508208d 100644 --- a/src/utils/message-utils.ts +++ b/src/utils/message-utils.ts @@ -73,7 +73,7 @@ export const buildJsonFileError = ( diagnostics: d.Diagnostic[], jsonFilePath: string, msg: string, - jsonField: string + jsonField: string, ) => { const err = buildError(diagnostics); err.messageText = msg; diff --git a/src/utils/output-target.ts b/src/utils/output-target.ts index 4007fd45af2..ed084ce0fcc 100644 --- a/src/utils/output-target.ts +++ b/src/utils/output-target.ts @@ -63,7 +63,7 @@ export const isOutputTargetHydrate = (o: d.OutputTarget): o is d.OutputTargetHyd export const isOutputTargetCustom = (o: d.OutputTarget): o is d.OutputTargetCustom => o.type === CUSTOM; export const isOutputTargetDocs = ( - o: d.OutputTarget + o: d.OutputTarget, ): o is d.OutputTargetDocsJson | d.OutputTargetDocsReadme | d.OutputTargetDocsVscode | d.OutputTargetDocsCustom => o.type === DOCS_README || o.type === DOCS_JSON || o.type === DOCS_CUSTOM || o.type === DOCS_VSCODE; diff --git a/src/utils/result.ts b/src/utils/result.ts index 5b709a4a944..56593813f4d 100644 --- a/src/utils/result.ts +++ b/src/utils/result.ts @@ -106,7 +106,7 @@ export function map(result: Result, fn: (t: T1) => Promise export function map(result: Result, fn: (t: T1) => T2): Result; export function map( result: Result, - fn: ((t: T1) => T2) | ((t: T1) => Promise) + fn: ((t: T1) => T2) | ((t: T1) => Promise), ): Promise> | Result { if (result.isOk) { const val = fn(result.value); diff --git a/src/utils/shadow-css.ts b/src/utils/shadow-css.ts index 396501b27df..494626e1435 100644 --- a/src/utils/shadow-css.ts +++ b/src/utils/shadow-css.ts @@ -428,7 +428,7 @@ const scopeSelectors = ( scopeSelectorText: string, hostSelector: string, slotSelector: string, - commentOriginalSelector: boolean + commentOriginalSelector: boolean, ) => { return processRules(cssText, (rule: CssRule) => { let selector = rule.selector; @@ -457,7 +457,7 @@ const scopeCssText = ( scopeId: string, hostScopeId: string, slotScopeId: string, - commentOriginalSelector: boolean + commentOriginalSelector: boolean, ) => { cssText = insertPolyfillHostInCssText(cssText); cssText = convertColonHost(cssText); diff --git a/src/utils/test/output-target.spec.ts b/src/utils/test/output-target.spec.ts index 1454f6c84cb..810519b1296 100644 --- a/src/utils/test/output-target.spec.ts +++ b/src/utils/test/output-target.spec.ts @@ -13,7 +13,7 @@ describe('output-utils tests', () => { 'should return false for invalid config output type "%s"', (outputTargetType) => { expect(isValidConfigOutputTarget(outputTargetType)).toBe(false); - } + }, ); }); diff --git a/src/utils/test/scope-css.spec.ts b/src/utils/test/scope-css.spec.ts index da7e2f0ea24..9c29b51c8cd 100644 --- a/src/utils/test/scope-css.spec.ts +++ b/src/utils/test/scope-css.spec.ts @@ -209,7 +209,7 @@ describe('ShadowCss', function () { it('should not replace the selector in a `@supports` rule', () => { expect(s('@supports selector(:host()) {:host {color: red; }}', 'a')).toEqual( - '@supports selector(:host()) {.a-h {color:red;}}' + '@supports selector(:host()) {.a-h {color:red;}}', ); }); }); @@ -218,7 +218,7 @@ describe('ShadowCss', function () { it('should handle tag selector, commentOriginalSelector', () => { expect(s(':host-context(div) {}', 'a', true)).toEqual('/*!@:host-context(div)*/div.a-h, div .a-h {}'); expect(s(':host-context(ul) > .y {}', 'a', true)).toEqual( - '/*!@:host-context(ul) > .y*/ul.a-h > .y.a, ul .a-h > .y.a {}' + '/*!@:host-context(ul) > .y*/ul.a-h > .y.a, ul .a-h > .y.a {}', ); }); @@ -240,7 +240,7 @@ describe('ShadowCss', function () { it('should not replace the selector in a `@supports` rule', () => { expect(s('@supports selector(:host-context(.class1)) {:host-context(.class1) {color: red; }}', 'a')).toEqual( - '@supports selector(:host-context(.class1)) {.class1.a-h, .class1 .a-h {color:red;}}' + '@supports selector(:host-context(.class1)) {.class1.a-h, .class1 .a-h {color:red;}}', ); }); ``; @@ -270,7 +270,7 @@ describe('ShadowCss', function () { it('should handle host-context complex selector', () => { const r = s(':host-context(.red) > ::slotted(*:nth-of-type(2n - 1)) {}', 'sc-ion-tag'); expect(r).toEqual( - '.sc-ion-tag-h.red > .sc-ion-tag-s > *:nth-of-type(2n - 1), .red .sc-ion-tag-h > .sc-ion-tag-s > *:nth-of-type(2n - 1) {}' + '.sc-ion-tag-h.red > .sc-ion-tag-s > *:nth-of-type(2n - 1), .red .sc-ion-tag-h > .sc-ion-tag-s > *:nth-of-type(2n - 1) {}', ); }); @@ -307,7 +307,7 @@ describe('ShadowCss', function () { it('same selectors, commentOriginalSelector', () => { const r = s('::slotted(*) {}, ::slotted(*) {}, ::slotted(*) {}', 'sc-ion-tag', true); expect(r).toEqual( - '/*!@::slotted(*)*/.sc-ion-tag-s > * {}/*!@, ::slotted(*)*/.sc-ion-tag, .sc-ion-tag-s > * {}/*!@, ::slotted(*)*/.sc-ion-tag, .sc-ion-tag-s > * {}' + '/*!@::slotted(*)*/.sc-ion-tag-s > * {}/*!@, ::slotted(*)*/.sc-ion-tag, .sc-ion-tag-s > * {}/*!@, ::slotted(*)*/.sc-ion-tag, .sc-ion-tag-s > * {}', ); }); @@ -323,7 +323,7 @@ describe('ShadowCss', function () { it('should not replace the selector in a `@supports` rule', () => { expect(s('@supports selector(::slotted(*)) {::slotted(*) {color: red; }}', 'sc-cmp')).toEqual( - '@supports selector(::slotted(*)) {.sc-cmp-s > * {color:red;}}' + '@supports selector(::slotted(*)) {.sc-cmp-s > * {color:red;}}', ); }); }); diff --git a/src/utils/test/sourcemaps.spec.ts b/src/utils/test/sourcemaps.spec.ts index e7c6ec18379..143c4fb3c1d 100644 --- a/src/utils/test/sourcemaps.spec.ts +++ b/src/utils/test/sourcemaps.spec.ts @@ -94,121 +94,121 @@ describe('sourcemaps', () => { it('returns a correctly formatted sourcemap', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"sourcemaps.js","sourceRoot":"","sources":["sourcemaps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"sourcemaps.js","sourceRoot":"","sources":["sourcemaps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInNvdXJjZW1hcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FLZ0I7In0=' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInNvdXJjZW1hcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FLZ0I7In0=', ); }); it('handles question marks in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source?maps.js","sourceRoot":"","sources":["source?maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source?maps.js","sourceRoot":"","sources":["source?maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlP21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2U/bWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlP21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2U/bWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles plus signs in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source+maps.js","sourceRoot":"","sources":["source+maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source+maps.js","sourceRoot":"","sources":["source+maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlK21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UrbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlK21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UrbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles equal signs in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source=maps.js","sourceRoot":"","sources":["source=maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source=maps.js","sourceRoot":"","sources":["source=maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlPW1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2U9bWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlPW1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2U9bWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles ampersands in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source&maps.js","sourceRoot":"","sources":["source&maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source&maps.js","sourceRoot":"","sources":["source&maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlJm1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UmbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlJm1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UmbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles slashes in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source/maps.js","sourceRoot":"","sources":["source/maps.js.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source/maps.js","sourceRoot":"","sources":["source/maps.js.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlL21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UvbWFwcy5qcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlL21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UvbWFwcy5qcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles exclamation points in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"sourcemaps!.js","sourceRoot":"","sources":["sourcemaps!.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"sourcemaps!.js","sourceRoot":"","sources":["sourcemaps!.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwcyEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2VtYXBzIS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwcyEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2VtYXBzIS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles single quotes in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source\'maps.js","sourceRoot":"","sources":["source\'maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source\'maps.js","sourceRoot":"","sources":["source\'maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlJ21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UnbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlJ21hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UnbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('handles parenthesis in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source()maps.js","sourceRoot":"","sources":["source()maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source()maps.js","sourceRoot":"","sources":["source()maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlKCltYXBzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic291cmNlKCltYXBzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBS2dCOyJ9' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlKCltYXBzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic291cmNlKCltYXBzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBS2dCOyJ9', ); }); it('handles asterisks in sourcemaps', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"source*maps.js","sourceRoot":"","sources":["source*maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"source*maps.js","sourceRoot":"","sources":["source*maps.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlKm1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UqbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlKm1hcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzb3VyY2UqbWFwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); it('encodes multiple disallowed characters at once', () => { expect( getInlineSourceMappingUrlLinker( - '{"version":3,"file":"!source(maps)*.js","sourceRoot":"","sources":["!source(maps)*.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}' - ) + '{"version":3,"file":"!source(maps)*.js","sourceRoot":"","sources":["!source(maps)*.ts"],"names":[],"mappings":";;AAAA,mCAKgB;"}', + ), ).toBe( '//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + - 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIXNvdXJjZShtYXBzKSouanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIhc291cmNlKG1hcHMpKi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==' + 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIXNvdXJjZShtYXBzKSouanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIhc291cmNlKG1hcHMpKi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUtnQjsifQ==', ); }); }); diff --git a/src/utils/test/url-paths.spec.ts b/src/utils/test/url-paths.spec.ts index 20ffd34e0b4..9e05855616b 100644 --- a/src/utils/test/url-paths.spec.ts +++ b/src/utils/test/url-paths.spec.ts @@ -6,14 +6,14 @@ describe('url-paths', () => { "returns true for the http protocol '%s'", (url) => { expect(isRemoteUrl(url)).toBe(true); - } + }, ); it.each(['https://domain.com/file.txt', 'HTTPS://domain.com/file.txt'])( "returns true for the https protocol '%s'", (url) => { expect(isRemoteUrl(url)).toBe(true); - } + }, ); it.each(['C:/file.txt', 'C:\\file.txt', '/User/file.txt'])("returns false for file paths '%s'", (fileName) => { diff --git a/src/utils/test/util.spec.ts b/src/utils/test/util.spec.ts index 0201bcfab29..f57ad4fff76 100644 --- a/src/utils/test/util.spec.ts +++ b/src/utils/test/util.spec.ts @@ -125,7 +125,7 @@ describe('util', () => { it('createJsVarName', () => { expect(util.createJsVarName('./scoped-style-import.css?tag=my-button&encapsulation=scoped')).toBe( - 'scopedStyleImportCss' + 'scopedStyleImportCss', ); expect(util.createJsVarName('./scoped-style-import.css#hash')).toBe('scopedStyleImportCss'); expect(util.createJsVarName('./scoped-style-import.css&data')).toBe('scopedStyleImportCss'); @@ -229,7 +229,7 @@ interface Foo extends Components.Foo, HTMLStencilElement {`); 'does not add a doc block when docs are empty (%j)', (docs) => { expect(util.addDocBlock(str, docs)).toEqual(str); - } + }, ); }); }); diff --git a/src/utils/test/validation.spec.ts b/src/utils/test/validation.spec.ts index bacee4ede5a..cadd6368b03 100644 --- a/src/utils/test/validation.spec.ts +++ b/src/utils/test/validation.spec.ts @@ -29,19 +29,19 @@ describe('validation', () => { it.each(['你-好', 'my-@component', '!@#$!@#4-ohno'])('should error on any invalid characters', (funkyTag) => { expect(validateComponentTag(funkyTag)).toBe( - `"${funkyTag}" tag contains invalid characters: ${funkyTag.replace(/\w|-/g, '')}` + `"${funkyTag}" tag contains invalid characters: ${funkyTag.replace(/\w|-/g, '')}`, ); }); it('should error if no dash', () => { expect(validateComponentTag('dashless')).toBe( - '"dashless" tag must contain a dash (-) to work as a valid web component' + '"dashless" tag must contain a dash (-) to work as a valid web component', ); }); it('should error on multiple dashes in a row', () => { expect(validateComponentTag('dash--crazy')).toBe( - '"dash--crazy" tag cannot contain multiple dashes (--) next to each other' + '"dash--crazy" tag cannot contain multiple dashes (--) next to each other', ); }); diff --git a/src/utils/util.ts b/src/utils/util.ts index 80b5cb04d5c..4a236eda8e2 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -230,5 +230,5 @@ const SKIP_DEPS = ['@stencil/core']; */ export const readOnlyArrayHasStringMember = ( readOnlyArray: ReadonlyArray, - maybeMember: T | string + maybeMember: T | string, ): maybeMember is T => readOnlyArray.includes(maybeMember as (typeof readOnlyArray)[number]); diff --git a/test/.scripts/file-size-profile.js b/test/.scripts/file-size-profile.js index c146b611b55..0f241894464 100644 --- a/test/.scripts/file-size-profile.js +++ b/test/.scripts/file-size-profile.js @@ -90,7 +90,7 @@ function render(fileName, brotliSize, gzipSize, minifiedSize) { fileName = dashSplt.join('-') + '.' + dotSplt[1]; } return `| ${fileName.padEnd(40)} | ${getFileSize(brotliSize).padEnd(8)} | ${getFileSize(gzipSize).padEnd( - 8 + 8, )} | ${getFileSize(minifiedSize).padEnd(8)} |`; } diff --git a/test/browser-compile/src/utils/css-template-plugin.ts b/test/browser-compile/src/utils/css-template-plugin.ts index b2afc65cb9c..1ea306dc220 100644 --- a/test/browser-compile/src/utils/css-template-plugin.ts +++ b/test/browser-compile/src/utils/css-template-plugin.ts @@ -9,7 +9,7 @@ button { color: white; font-weight: bold; } -` +`, ); styleImports.set( @@ -22,7 +22,7 @@ my-button { display: block; padding: 20px; background: #ddd; } my-button::before { content: "style-import.css"; position: absolute; left: 0; top: 0; } button { background: purple; } -` +`, ); styleImports.set( @@ -35,7 +35,7 @@ styleImports.set( :host::before { content: "scoped-style-import.css"; position: absolute; left: 0; top: 0; } button { background: maroon; } -` +`, ); styleImports.set( @@ -48,7 +48,7 @@ styleImports.set( :host::before { content: "ios.css"; position: absolute; left: 0; top: 0; } button { background: blue; } -` +`, ); styleImports.set( @@ -61,7 +61,7 @@ styleImports.set( :host::before { content: "md.css"; position: absolute; left: 50px; top: 0; } button { background: green; } -` +`, ); export const cssTemplatePlugin = { diff --git a/test/browser-compile/src/utils/load-deps.ts b/test/browser-compile/src/utils/load-deps.ts index 4ec8ae92f47..d51f3862ace 100644 --- a/test/browser-compile/src/utils/load-deps.ts +++ b/test/browser-compile/src/utils/load-deps.ts @@ -5,7 +5,7 @@ export const loadDeps = async (resolveLookup: Map, fs: Map dep[0] === 'rollup' + (dep: [string, unknown]) => dep[0] === 'rollup', ); await loadDep(`https://cdn.jsdelivr.net/npm/rollup@${rollupDep[1]}/dist/rollup.browser.js`); diff --git a/test/karma/test-app/append-child/karma.spec.ts b/test/karma/test-app/append-child/karma.spec.ts index 59c26367fa0..f5f5556a302 100644 --- a/test/karma/test-app/append-child/karma.spec.ts +++ b/test/karma/test-app/append-child/karma.spec.ts @@ -26,7 +26,7 @@ describe('append-child', function () { expect(app.querySelector('h1').textContent).toBe('H1 TopH1 Middle 0H1 Middle 1H1 Bottom'); expect(app.querySelector('article').textContent).toBe( - 'Default TopLightDomDefault Slot 0Default Slot 1Default Bottom' + 'Default TopLightDomDefault Slot 0Default Slot 1Default Bottom', ); expect(app.querySelector('section').textContent).toBe('H6 TopH6 Middle 0H6 Middle 1H6 Bottom'); }); diff --git a/test/karma/test-app/scoped-basic/karma.spec.ts b/test/karma/test-app/scoped-basic/karma.spec.ts index af07f7b9bc2..12feb567b6a 100644 --- a/test/karma/test-app/scoped-basic/karma.spec.ts +++ b/test/karma/test-app/scoped-basic/karma.spec.ts @@ -15,7 +15,7 @@ describe('scoped-basic', function () { const scopedEl = doc.querySelector('scoped-basic'); expect(scopedEl.classList.toString()).toEqual( - 'sc-scoped-basic-root-md sc-scoped-basic-h sc-scoped-basic-s hydrated' + 'sc-scoped-basic-root-md sc-scoped-basic-h sc-scoped-basic-s hydrated', ); const scopedStyles = window.getComputedStyle(scopedEl); diff --git a/test/style-modes/src/global.ts b/test/style-modes/src/global.ts index 80534f161fe..7571200a276 100644 --- a/test/style-modes/src/global.ts +++ b/test/style-modes/src/global.ts @@ -2,7 +2,7 @@ import { setMode } from '@stencil/core'; const global = () => { setMode( - (elm: any) => elm.mode || elm.getAttribute('mode') || document.documentElement.getAttribute('mode') || 'buford' + (elm: any) => elm.mode || elm.getAttribute('mode') || document.documentElement.getAttribute('mode') || 'buford', ); }; export default global;