denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.92k stars 5.39k forks source link

Respect formatting in deno.lock #24403

Open valtlai opened 4 months ago

valtlai commented 4 months ago

I think deno.lock should follow the configured formatting.

For example, if I have the following deno.json:

{
  "fmt": {
    "useTabs": true
  }
}

then I want the generated deno.lock to use tabs instead of spaces for indentation.

This is to ensure the consistent code style. Currently I have to manually convert indentation to tabs every time deno.lock is updated.

Version: Deno 1.44.4

dsherret commented 4 months ago

The lockfile just happens to be json internally at the moment, but it's a .lock file (part of the reason it's a .lock file is so that it's excluded from formatting). I think needing to resolve the formatting configuration then running it through the formatter would be too much work to do because it should be as fast as possible. Not sure it's worth doing this one.

LitoMore commented 1 month ago

@dsherret It's fine for deno fmt to ingore this file. But other commands such as deno add, deno install should follow user's settings. Currently, the deno.lock will always 2-space indent even if the user set the useTabs: true.