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

Position not provided with --stdin-file-path #3201

Closed
1 task done
hexh250786313 opened this issue Jun 13, 2024 · 2 comments · Fixed by #3211 · 4 remaining pull requests
Closed
1 task done

Position not provided with --stdin-file-path #3201

hexh250786313 opened this issue Jun 13, 2024 · 2 comments · Fixed by #3211 · 4 remaining pull requests
Labels
A-CLI Area: CLI A-Diagnostic Area: diagnostocis S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@hexh250786313
Copy link

hexh250786313 commented Jun 13, 2024

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
@ematipico
Copy link
Member

ematipico commented Jun 13, 2024

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

@ematipico ematipico added the S-Needs repro Status: needs a reproduction label Jun 13, 2024
@hexh250786313
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment