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

esbuild: Wrong WARNING line numbers in output #28851

Open
1 task
johannesnormannjensen opened this issue Nov 13, 2024 · 1 comment
Open
1 task

esbuild: Wrong WARNING line numbers in output #28851

johannesnormannjensen opened this issue Nov 13, 2024 · 1 comment
Labels

Comments

@johannesnormannjensen
Copy link

Command

build, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Wrong WARNING / ERROR line numbers in output

Example component:

import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';

const vlue = { hue: 0, saturation: 0, lightness: 0 };
@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent {
  title = 'angapp';

  field = !!(vlue.hue) ?? false;
}

Terminal output:

> [email protected] build
> ng build


DURATION[NG_READ_CONFIG]: 0.006434709s
DURATION[NG_READ_CONFIG]: 0.006614965s
DURATION[NG_CREATE_PROGRAM]: 0.405366621s
DURATION[NG_ANALYZE_PROGRAM]: 0.026746010s
DURATION[NG_FIND_AFFECTED]: 0.000203829s
DURATION[NG_EMIT_TS]: 0.037194445s
DURATION[NG_DIAGNOSTICS_TOTAL]: 0.031198823s
DURATION[NG_EMIT_JS*]: 15.239371536s [count: 700; avg: 0.021770531s; min: 0.000534034s; max: 0.040325990s]
DURATION[NG_EMIT_JS*]: 15.239371536s [count: 700; avg: 0.021770531s; min: 0.000534034s; max: 0.040325990s]
DURATION[OPTIMIZE_CHUNKS]: 0.284208465s
Browser bundles        
Initial chunk files     | Names               |  Raw size | Estimated transfer size
main-P3YWHZB2.js        | main                | 219.42 kB |                59.51 kB
polyfills-FFHMD2TL.js   | polyfills           |  34.52 kB |                11.28 kB
styles-5INURTSO.css     | styles              |   0 bytes |                 0 bytes

                        | Initial total       | 253.94 kB |                70.79 kB


Server bundles         
Initial chunk files     | Names               |  Raw size
server.mjs              | server              |   1.11 MB |                        
chunk-WHPWUB66.mjs      | -                   | 528.79 kB |                        
polyfills.server.mjs    | polyfills.server    | 268.60 kB |                        
chunk-TFNYX4J6.mjs      | -                   |  19.21 kB |                        
chunk-5XUXGTUW.mjs      | -                   |   2.55 kB |                        
render-utils.server.mjs | render-utils.server |   1.46 kB |                        
main.server.mjs         | main.server         | 149 bytes |                        

Lazy chunk files        | Names               |  Raw size
chunk-VCVCHJZV.mjs      | xhr2                |  12.07 kB |                        

Prerendered 1 static route.
Application bundle generation complete. [1.754 seconds]

▲ [WARNING] The "??" operator here will always return the left operand [suspicious-nullish-coalescing]

    src/app/app.component.ts:28:25:
      28 │     field = !!(vlue.hue) ?? false;
         ╵                          ~~

  The left operand of the "??" operator here will never be null or undefined, so it will always be returned. This usually indicates a bug in your code:

    src/app/app.component.ts:28:12:
      28 │     field = !!(vlue.hue) ?? false;
         ╵             ~~~~~~~~~~~~


▲ [WARNING] The "??" operator here will always return the left operand [suspicious-nullish-coalescing]

    src/app/app.component.ts:28:25:
      28 │     field = !!(vlue.hue) ?? false;
         ╵                          ~~

  The left operand of the "??" operator here will never be null or undefined, so it will always be returned. This usually indicates a bug in your code:

    src/app/app.component.ts:28:12:
      28 │     field = !!(vlue.hue) ?? false;

Minimal Reproduction

Create a new application using the "@angular-devkit/build-angular:application" builder

Add the mistake that causes the warning field = !!(vlue.hue) ?? false;

Exception or Error


Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 18.2.11
Node: 22.11.0
Package Manager: npm 10.9.0
OS: linux x64

Angular: 18.2.11
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.11
@angular-devkit/build-angular   18.2.11
@angular-devkit/core            18.2.11
@angular-devkit/schematics      18.2.11
@schematics/angular             18.2.11
ng-packagr                      18.2.1
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

No response

@johannesnormannjensen johannesnormannjensen changed the title Wrong WARNING / ERROR line numbers in output esbuild: Wrong WARNING / ERROR line numbers in output Nov 13, 2024
@johannesnormannjensen johannesnormannjensen changed the title esbuild: Wrong WARNING / ERROR line numbers in output esbuild: Wrong WARNING line numbers in output Nov 13, 2024
@alan-agius4 alan-agius4 added the freq1: low Only reported by a handful of users who observe it rarely label Nov 20, 2024
@bregnvig
Copy link

This stops me for using esbuild. Please fix

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

No branches or pull requests

4 participants