Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package isn't working with Typescript v5.6+ #2240

Open
mkszepp opened this issue Jan 13, 2025 · 0 comments
Open

Package isn't working with Typescript v5.6+ #2240

mkszepp opened this issue Jan 13, 2025 · 0 comments

Comments

@mkszepp
Copy link
Contributor

mkszepp commented Jan 13, 2025

The ember-source v6.1+ ships now by default the flat config for eslint.

Unfortuanally i was running into this error:
0:0 error Parsing error: Cannot read properties of undefined (reading 'sourceFile')

Steps to reproduce:

  1. ember new new-app --embroider --pnpm --typescript
  2. change in .prettierrc.js to templateSingleQuote to true
  3. copy components code to project
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

export default class Test2 extends Component {
@tracked text = 'hello';

<template>
  {{! template-lint-disable no-bare-strings }}
  <div class='row'>
    <div class='col box'>
      <div class='row'>
        <div class='col'>
          <h2>
            {{this.hello}}
          </h2>
        </div>
      </div>
    </div>
  </div>
</template>
}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
  Test2: typeof Test2;
}
}
  1. run pnpm run lint:js

Result:
The error is visible.

TypeError: Cannot read properties of undefined (reading 'sourceFile')
    at isDocumentRegistryEntry (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:142504:18)
    at getDocumentRegistryEntry (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:142580:19)
    at Object.releaseDocumentWithKey (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:142675:19)
    at Object.getOrCreateSourceFileByPath [as getSourceFileByPath] (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:151555:30)
    at tryReuseStructureFromOldProgram (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:126294:59)
    at createProgram (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:125689:23)
    at synchronizeHostDataWorker (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:151491:15)
    at synchronizeHostData (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:151386:7)
    at Object.getProgram (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:151568:5)
    at ConfiguredProject2.updateGraphWorker (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:186518:41)
    at ConfiguredProject2.updateGraph (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:186353:32)
    at ConfiguredProject2.updateGraph (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:187646:24)
    at updateWithTriggerFile (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:188190:11)
    at updateConfiguredProject (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:188198:9)
    at updateProjectFoundUsingFind (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:188133:28)
    at _ProjectService.findCreateOrReloadConfiguredProject (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:190784:62)
    at _ProjectService.tryFindDefaultConfiguredProjectForOpenScriptInfo (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:190819:25)
    at _ProjectService.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:190977:25)
    at _ProjectService.assignProjectToOpenedScriptInfo (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:190730:27)
    at _ProjectService.openClientFileWithNormalizedPath (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:191088:48)
    at _ProjectService.openClientFile (/home/markuss/projects/test/new-app/node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/typescript.js:190638:17)
    at openClientFile (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/useProgramFromProjectService.js:113:40)
    at openClientFileAndMaybeReload (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/useProgramFromProjectService.js:118:22)
    at openClientFileFromProjectService (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/useProgramFromProjectService.js:68:20)
    at useProgramFromProjectService (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/useProgramFromProjectService.js:185:9)
    at getProgramAndAST (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:44:100)
    at parseAndGenerateServices (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+typescript-estree@8.19.1_typescript@5.7.3/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:154:11)
    at Object.parseForESLint (/home/markuss/projects/test/new-app/node_modules/.pnpm/@typescript-eslint+parser@8.19.1_eslint@9.18.0_typescript@5.7.3/node_modules/@typescript-eslint/parser/dist/parser.js:101:80)
    at Object.parseForESLint (/home/markuss/projects/test/new-app/node_modules/.pnpm/ember-eslint-parser@0.5.7_@babel+core@7.26.0_@typescript-eslint+parser@8.19.1_eslint@9.18.0_t_vb2dmusjgka2eyua64avbrjc34/node_modules/ember-eslint-parser/src/parser/gjs-gts-parser.js:55:30)
    at Object.parse (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/languages/js/index.js:270:26)
    at ParserService.parseSync (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/services/parser-service.js:36:33)
    at #flatVerifyWithoutProcessors (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:1669:47)
    at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:1993:49)
    at /home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:1609:29
    at Array.map (<anonymous>)
    at Linter._verifyWithFlatConfigArrayAndProcessor (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:1604:36)
    at Linter._verifyWithFlatConfigArray (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:2069:25)
    at Linter.verify (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:1543:61)
    at Linter.verifyAndFix (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/linter/linter.js:2320:29)
    at verifyText (/home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/eslint/eslint.js:327:48)
    at /home/markuss/projects/test/new-app/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/eslint/eslint.js:807:40

Downgrade to typescript 5.5 solve the issue

Discord discussion: https://discord.com/channels/480462759797063690/1328277408910016633

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant