Fix/clean install issues - #654
wouter-athom wants to merge 9 commits into
Conversation
ESLint doesn't work with typescript 7. There's a package called typescript6 that can be installed in tandem with typescript 7. This allows users to run tsc using typescript 7, and tools like eslint to run with ts6.
There was a problem hiding this comment.
Pull request overview
This PR updates the Homey CLI app generator to address install/tooling breakage caused by the TypeScript 7 API changes, and adjusts the TypeScript app template to reduce linting friction.
Changes:
- When generating a TypeScript app with ESLint enabled, installs TypeScript 6 and an additional aliased TypeScript package intended for
tscusage. - Updates the generated app’s ESLint dev dependency from ESLint v7 to ESLint v8.
- Changes the TypeScript app template export style from
module.exportstoexport default.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/App.js | Adjusts generated devDependencies (TypeScript aliasing + ESLint version) during app creation. |
| assets/templates/app/app.ts | Updates the TS app template to use export default instead of module.exports. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
lib/App.js:3618
- The new explanatory comment is now misleading and contains typos (e.g. “it's”/“lastest”). It also says the ESLint version can't be updated, but this same hunk updates ESLint from v7 to v8, so the rationale should be corrected to avoid confusion for future maintainers.
// eslint-config-athom currently relies on tooling that isn't compatible with TypeScript 7 yet.
// As a workaround, install TypeScript 6 under the `typescript` package name for ESLint,
// and also install the latest TypeScript under an alias for running `tsc`.
if (answers.eslint) {
assets/templates/app/app.ts:6
- Switching the TypeScript app entry template from
module.exports =toexport defaultwill compile to a CommonJS module that exportsdefault(given the generated tsconfig extends@tsconfig/node16and the generated package.json does not settype: "module"). New apps may fail to load if the Homey runtime expectsmodule.exports(as the JS template and other TS templates do).
import Homey from 'homey';
export default class MyApp extends Homey.App {
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
lib/App.js:3622
- The TypeScript “v6 + v7” workaround doesn’t pin the aliased TypeScript version:
@typescript/native@npm:typescriptwill always resolve to whatevertypescriptis latest (could become v8+), which contradicts the PR description and risks reintroducing the same tool breakage later. Pin the alias to the intended major (v7) so generated apps remain stable over time.
await NpmCommands.installDev(
['typescript@npm:@typescript/typescript6', '@typescript/native@npm:typescript'],
{ appPath },
);
…ises rule The drivers templates were using module.exports instead of export default. They also didn't have access modifiers. Since the linter was updated, the no-misuses-promsies rule now fires on some methods in device.ts that have a wrong type definition. They all return promises, but some of the types dont' reflect this properly.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
lib/App.js:3622
- The TypeScript 6/7 workaround doesn’t actually guarantee that
npm run build/npx tscuse TypeScript 7.npm run buildis set totsc, andtranspileToTypescript()also callsnpx tsc, both of which resolve thetscbinary fromnode_modules/.bin. Withtypescriptinstalled as@typescript/typescript6, thetscbinary is likely v6 (and the second aliased install also provides a conflictingtscbinary), which makes the effective compiler version ambiguous and contradicts the intent described in the comment/PR description.
Consider making the TypeScript 7 invocation explicit (e.g., by updating the generated build script to run the TS7 binary by path) and ensuring there is no tsc bin collision between the two installed packages.
// eslint-config-athom currently relies on tooling that isn't compatible with TypeScript 7 yet.
// As a workaround, install TypeScript 6 under the `typescript` package name for ESLint,
// and also install the latest TypeScript under an alias for running `tsc`.
if (answers.eslint) {
await NpmCommands.installDev(
['typescript@npm:@typescript/typescript6', '@typescript/native@npm:typescript'],
{ appPath },
);
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
lib/App.js:3622
- The TypeScript 7 install is currently unpinned (
@typescript/native@npm:typescript), which means a future TypeScript 8+ release could get pulled in and re-break ESLint/tooling compatibility. Pin the alias to the intended major (per PR description: 7.x) and align the comment wording accordingly.
// eslint-config-athom currently relies on tooling that isn't compatible with TypeScript 7 yet.
// As a workaround, install TypeScript 6 under the `typescript` package name for ESLint,
// and also install the latest TypeScript under an alias for running `tsc`.
if (answers.eslint) {
await NpmCommands.installDev(
After updating the TS templates to use ESM exports, the package.json needs `type: 'module'` to run the app.
There was a problem hiding this comment.
🟡 Changes recommended
The new widget API templates have small but concrete template-quality issues (statement termination consistency and route/handler consistency) that should be corrected before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 8/9 changed files
- Comments generated: 3
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
TypeScript 7 shipped with a new API, breaking tools like ESLint. To prevent this, TypeScript 6 and 7 are installed in tandem. Tools wil use the tsc6 executable instead, so they run with TypeScript v6. Running
npx tscwill use TypeScript 7 to benefit from it's increased performance.For the
device.tstemplate the linter ruleno-misused-promiseswas disabled, since the return types on some of the methods are wrong. They are all awaited in the SDK. Keeping the right types in the template has priority over a linter rule. Once the types are updated and correct, this linter rule should be enabled again.Also updated the TypeScript app and driver templates to use
export defaultinstead ofmodule.exportsto prevent linter errors.