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

📎 Add a guide to explain how biome behaves with *known* files #587

Closed
ematipico opened this issue Oct 23, 2023 · 3 comments · Fixed by #624 or #649
Closed

📎 Add a guide to explain how biome behaves with *known* files #587

ematipico opened this issue Oct 23, 2023 · 3 comments · Fixed by #624 or #649
Assignees
Labels
A-Documentation Area: documentation good first issue Good for newcomers S-Enhancement Status: Improve an existing feature S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@ematipico
Copy link
Member

Description

This is a follow-up of the discussion that happened in #237

The task is to create a new guide page called "Biome's behaviour" (or something similar). The purpose of this page is to list all those particular behaviours/assumptions that Biome does that aren't currently documented, or they are but in the wrong section.

Here's the list of things we should do:

  1. Move the following paragraphs in this new page:

# Configuration
The configuration file is considered **optional**, Biome has good defaults. Use the configuration
file to change those defaults.
The Biome configuration file is named `biome.json` and should be placed in the root directory of your project. The root
directory is usually the directory containing your project's `package.json`.
Here's an example:
<CodeBlockHeader filename="biome.json" />
```json
{
"formatter": {
"enabled": true,
"indentStyle": "tab",
"lineWidth": 120
},
"linter": {
"enabled": false
}
}
```
This configuration file enables the formatter and sets the preferred indent style and width. The linter is disabled.
## Configuration file resolution
Biome uses auto discovery to find the nearest `biome.json` file. It starts looking for `biome.json` in the current
working directory, and then it starts looking in the parent directories until:
- it finds a `biome.json` file;
- it applies Biome's defaults if **no `biome.json` is found**;
Here's an example:
```
└── app
├── backend
│ ├── package.json
│ └── biome.json
└── frontend
├── legacy
│ └── package.json
├── new
│ └── package.json
└── biome.json
```
- biome commands that run in `app/backend/package.json` will use the configuration file `app/backend/biome.json`;
- biome commands that run in `app/frontend/legacy/package.json` and `app/frontend/new/package.json`
will use the configuration file `app/frontend/biome.json`;

  1. Explain that package.json, package-lock.json, tsconfig.json and jsconfig.json are currently ignored by Biome because the tools that own these files usually apply their formatting/style, and Biome doesn't want to disrupt them. This means that no diagnostics will be ever emitted by Biome for those files.
  2. Add a heading that explains the "known" files. These files are listed here:

pub(crate) const ALLOWED_FILES: &'static [&'static str; 15] = &[
"typescript.json",
"tsconfig.json",
"jsconfig.json",
"tslint.json",
"babel.config.json",
".babelrc.json",
".ember-cli",
"typedoc.json",
".eslintrc.json",
".eslintrc",
".jsfmtrc",
".jshintrc",
".swcrc",
".hintrc",
".babelrc",
];

And we should explain that when Biome analyses these files, they are parsed as **JSON files** with `json.parser.allowComments` and `json.parser.allowTrailingCommas` set to `true`. This is because editor tools like VSCode treat them like this.

As a bonus, we should remove `tsconfig.json` and `jsconfig.json` from that list (in the rust file)
@ematipico ematipico added good first issue Good for newcomers S-Help-wanted Status: you're familiar with the code base and want to help the project S-Enhancement Status: Improve an existing feature A-Documentation Area: documentation labels Oct 23, 2023
@Conaclos Conaclos changed the title 📎 Add a guide to explain how biome behaves with *kwown* files 📎 Add a guide to explain how biome behaves with *known* files Oct 23, 2023
@TheShiveshNetwork
Copy link
Contributor

Can you assign this to me? I'm interested in working on this.

@Conaclos
Copy link
Member

Assigned :)

@TheShiveshNetwork
Copy link
Contributor

@ematipico check out #624 and do let me know if it needs improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Documentation Area: documentation good first issue Good for newcomers S-Enhancement Status: Improve an existing feature S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
3 participants