Skip to content

Allow configuring rules #51

@camchenry

Description

@camchenry

The headless mode is currently working well for enabling rules on a per-file basis. However, there isn't any way to configure rules on a per-file basis (and yes, configuration would likely need to be specified for each file, because it can change depending on glob patterns in the config to apply enable/disable different rules and configurations).

I suggest we allow passing rules as an object, similar to the .oxlintrc.json or .eslintrc format. The keys in rules are the rule names, such as no-floating-promises. The values in the rules object are the configurations. If a rule name is not present as a key, assume it is disabled by default. If an empty object is passed, use the default configuration options.

For example:

{
  "files": [
    {
      "file_path": "/absolute/path/to/file.ts",
      "rules": {
        "no-floating-promises": {
          "allowForKnownSafeCalls": [
            { "from": "file", "name": "safe", "path": "input.ts" }
          ]
        },
      },
    }
  ]
}

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions