From 469ad6e98a12041c9f4c28aeb5535355a9b74aee Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Thu, 7 Nov 2024 17:53:02 +0100 Subject: [PATCH 1/2] Update to TypeScript 5.6.3 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a90c99f4b..721306df4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -105,7 +105,7 @@ "stylelint-prettier": "^4.1.0", "svg-symbols": "^1.0.5", "tracked-built-ins": "^3.3.0", - "typescript": "~5.5.0", + "typescript": "~5.6.3", "typescript-eslint": "^8.13.0", "webpack": "^5.95.0" }, @@ -45184,9 +45184,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 39c39d54b..f6096f7aa 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "stylelint-prettier": "^4.1.0", "svg-symbols": "^1.0.5", "tracked-built-ins": "^3.3.0", - "typescript": "~5.5.0", + "typescript": "~5.6.3", "typescript-eslint": "^8.13.0", "webpack": "^5.95.0" }, From 907f9666bead74706b351776101a5a9865c8e398 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Fri, 8 Nov 2024 10:34:14 +0100 Subject: [PATCH 2/2] Minimal reproduction config This strips everything that isn't needed while still showing the error. --- eslint.config.mjs | 144 +++------------------------------------------- 1 file changed, 9 insertions(+), 135 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 617368127..e9f30766c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,45 +1,8 @@ -/** - * Debugging: - * https://eslint.org/docs/latest/use/configure/debug - * ---------------------------------------------------- - * - * Print a file's calculated configuration - * - * npx eslint --print-config path/to/file.js - * - * Inspecting the config - * - * npx eslint --inspect-config - * - */ - -import globals from 'globals'; -import js from '@eslint/js'; - import ts from 'typescript-eslint'; - import ember from 'eslint-plugin-ember/recommended'; -import qunit from 'eslint-plugin-qunit'; -import n from 'eslint-plugin-n'; - -import babelParser from '@babel/eslint-parser'; - const parserOptions = { esm: { - js: { - ecmaFeatures: { modules: true }, - ecmaVersion: 'latest', - requireConfigFile: false, - babelOptions: { - plugins: [ - [ - '@babel/plugin-proposal-decorators', - { decoratorsBeforeExport: true }, - ], - ], - }, - }, ts: { projectService: true, tsconfigRootDir: import.meta.dirname, @@ -48,117 +11,28 @@ const parserOptions = { }; export default ts.config( - js.configs.recommended, - ember.configs.base, - ember.configs.gjs, - ember.configs.gts, - /** - * Ignores must be in their own object - * https://eslint.org/docs/latest/use/configure/ignore - */ - { - ignores: [ - 'declarations/', - 'dist/', - '.node_modules.ember-try/', - 'coverage/', - 'storybook-static/', - ], - }, - /** - * https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options - */ { - linterOptions: { - reportUnusedDisableDirectives: 'error', - }, - }, - { - files: ['**/*.js'], - languageOptions: { - parser: babelParser, - }, - }, - { - files: ['**/*.{js,gjs}'], - languageOptions: { - parserOptions: parserOptions.esm.js, - globals: { - ...globals.browser, - }, - }, + ignores: ['**/*.js', '**/*.mjs'], }, { + name: 'ts', files: ['**/*.ts'], languageOptions: { + // Uncommenting this fixes the issue so it seems to be related to switching parsers for different kinds of typed files? + // parser: ember.parser, parserOptions: parserOptions.esm.ts, }, - extends: [ember.configs.base, ...ts.configs.recommendedTypeChecked], + extends: [...ts.configs.recommendedTypeChecked], + // extends: [...ts.configs.recommended], // also fails }, { + name: 'gts', files: ['**/*.gts'], languageOptions: { parser: ember.parser, parserOptions: parserOptions.esm.ts, }, - extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts], - rules: { - // This works around an issue in Glint https://github.com/typed-ember/glint/issues/697 - // It also makes adding state to a component easier, since no other code changes would be needed. - 'ember/no-empty-glimmer-component-classes': 'off', - }, - }, - { - files: ['tests/**/*-test.{js,gjs,ts,gts}'], - plugins: { - qunit, - }, - }, - /** - * CJS node files - */ - { - files: [ - 'index.js', - '**/*.cjs', - 'config/**/*.js', - 'testem.js', - 'testem*.js', - '.prettierrc.js', - '.stylelintrc.js', - '.template-lintrc.js', - 'ember-cli-build.js', - 'tests/dummy/config/**/*.js', - '.storybook/main.js', - ], - plugins: { - n, - }, - - languageOptions: { - sourceType: 'script', - ecmaVersion: 'latest', - globals: { - ...globals.node, - }, - }, - }, - /** - * ESM node files - */ - { - files: ['**/*.mjs'], - plugins: { - n, - }, - - languageOptions: { - sourceType: 'module', - ecmaVersion: 'latest', - parserOptions: parserOptions.esm.js, - globals: { - ...globals.node, - }, - }, + // These don't really matter, commented or not, it fails + // extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts], }, );