biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.

Home Page:https://biomejs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Position not provided with `--stdin-file-path`

hexh250786313 opened this issue · comments

commented

Environment information

CLI:
  Version:                      1.8.1
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "tmux-256color"
  JS_RUNTIME_VERSION:           "v18.20.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.5.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

I've tried both biome lint ./xxx.ts and biome lint --stdin-file-path ./xxx.ts < ./xxx.ts. It's clear that the former command provides more information than the latter.

I'm using --stdin-file-path in my Neovim lint parser, but it doesn't provide the error position. This prevents my parser from locating the error position. I believe it would be beneficial for all linters to provide the error position when using stdin mode.

Expected result

Provide error position when use lint with stdin mode like eslint:

Eslint:

image

Biome:

image

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Can you provide us with all the information to replicate the issue? In this case, the file you're trying to lint. Without that, it's not possible to help you

commented

@ematipico I apologize for not providing detailed information earlier. Here are the steps to reproduce:

Execute that:

git clone https://github.com/hexh250786313/fastify-starter.git
cd fastify-starter
npm ci
npx biome lint --stdin-file-path=./src/index.ts < ./src/index.ts

And you will get that:

 npx biome lint --stdin-file-path=./src/index.ts < ./src/index.ts
import Fastify from 'fastify';

const server = Fastify({
    logger: true,
});

server.get('/', async () => {
    return { hello: 'world' };
});

const = "";

const start = async () => {
    try {
        await server.listen({
            port: 3000,
            host: '127.0.0.1',
        });
        server.log.info(`Server is running at http://localhost:3000`);
    } catch (err) {
        server.log.error(err);
        process.exit(1);
    }
};

start();
./src/index.ts parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Expected an identifier, an array pattern, or an object pattern but instead found '= ""'.

  ℹ Expected an identifier, an array pattern, or an object pattern here.


./src/index.ts parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ expected `,` but instead found `;`

  ℹ Remove ;


./src/index.ts parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Expected an identifier, an array pattern, or an object pattern but instead found '= ""'.

  ℹ Expected an identifier, an array pattern, or an object pattern here.