biome icon indicating copy to clipboard operation
biome copied to clipboard

💅 How to ignore a directory?

Open notramo opened this issue 1 year ago • 6 comments

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.

notramo avatar Dec 21 '23 14:12 notramo

  • https://biomejs.dev/reference/configuration/#filesignore
  • https://biomejs.dev/reference/configuration/#formatterignore

ematipico avatar Dec 21 '23 14:12 ematipico

That's not easy to find, a small note in the formatter docs would be helpful.

notramo avatar Dec 21 '23 14:12 notramo

Thank you for your suggestion. What do you propose to add?

ematipico avatar Dec 21 '23 14:12 ematipico

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?

notramo avatar Dec 21 '23 15:12 notramo

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:

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 */

espenja avatar Dec 22 '23 22:12 espenja

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.

ematipico avatar Dec 23 '23 06:12 ematipico

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.

nikeee avatar Mar 26 '24 03:03 nikeee

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

Sec-ant avatar Mar 26 '24 04:03 Sec-ant

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"
          }
        }
      }
    }
  ]

Zoxive avatar Apr 20 '24 19:04 Zoxive