biome
biome copied to clipboard
💅 How to ignore a directory?
I have a generated EdgeDB query inside src/lib/server/edgeql-js
.
How do I ignore that directory in the formatter? I found nothing in the documentation about it.
- https://biomejs.dev/reference/configuration/#filesignore
- https://biomejs.dev/reference/configuration/#formatterignore
That's not easy to find, a small note in the formatter docs would be helpful.
Thank you for your suggestion. What do you propose to add?
I searched for the word "ignore", and I only found the ignore comments, not the configuration. I recommend adding the following:
For ignoring files and directories based on filename (
.prettierignore
equivalent), see https://biomejs.dev/reference/configuration/#formatterignore
Also, is there a chance that this tool would support .eslintignore
and .prettierignore
for linting/formatting respectively?
Something related to ignoring files that I am missing from other tools is the ability to ignore the entire file from within the file itself. For example:
- istanbul can ignore a file with
/* istanbul ignore file */
in the top section of a file - tslint has
/* tslint:disable */
(https://palantir.github.io/tslint/usage/rule-flags/) - eslint has
/* eslint-disable */
(https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1)
An example where this is useful is cases where you are generating code as output of a build script, for example generating clients from OpenAPI specs.
Sometimes it is useful to be able to ignore one or more specific rules for an entire file as well:
In eslint you can achieve this by adding the rule name behind the disable command /* eslint-disable @typescript-eslint/no-var-requires */
Hi @espenja
I am aware of such practices, and I believe ignoring an entire file with a comment is just bad practice. With this practice, the tool still reads the file from disk and parses it (partially).
We might consider turning off a rule completely via comments. Users asked this already because they can add more comments and provide context of why a rule is disabled, although now that we are going to support biome.jsonc
too and with overrides
, I can't see the utility anymore.
I have a directory that contains database migrations. By design of the query builder, it uses any
, so I need to ignore 'noExplicitAny'.
Is it possible to only ignore this rule for that directory? I don't want to opt out of the entire linting for these.
I have a directory that contains database migrations. By design of the query builder, it uses
any
, so I need to ignore 'noExplicitAny'.Is it possible to only ignore this rule for that directory. I don't want to opt out of the entire linting for these.
@nikee https://biomejs.dev/reference/configuration/#overridesitemlinter
I have a directory that contains database migrations. By design of the query builder, it uses
any
, so I need to ignore 'noExplicitAny'. Is it possible to only ignore this rule for that directory. I don't want to opt out of the entire linting for these.@nikee https://biomejs.dev/reference/configuration/#overridesitemlinter
Awesome this is exactly what i want.
I want to keep my linter strictness as much as possible, but theres some things that just like to do things their way..
Im using storybook and it loves default exports, so now i can ignore noDefaultExport
just my storybook folder!
"overrides": [
{
"include": [
".storybook/**"
],
"linter": {
"rules": {
"style": {
"noDefaultExport": "off"
}
}
}
}
]