Skip to content

Support plugin-level include/exclude configuration per folder (e.g., ignore test/ for certain plugins) #367

@AndrewDongminYoo

Description

@AndrewDongminYoo

Describe the problem

At the moment, custom_lint runs all active plugins globally under the root context.
This means there’s no way to disable or scope a plugin (like riverpod_lint) to only part of the codebase, e.g. lib/** but not test/**.

While it’s possible to add a test/analysis_options.yaml, most IDEs (VS Code, IntelliJ) still merge the root configuration and show diagnostics for plugins that should be disabled.
Excluding test/** at the analyzer level disables all lints and refactorings, which is not practical.

This limitation has been discussed in related issues such as:

These clearly show that finer-grained scoping is a recurring need.

Proposed solution

Allow each plugin to define optional include / exclude globs in analysis_options.yaml.
Example:

custom_lint:
  plugins:
    - riverpod_lint:
        include:
          - lib/**
        exclude:
          - test/**
    - company_internal_lints:
        exclude:
          - example/**

This would not affect how rules are defined — it simply changes where each plugin runs.
It could be implemented by checking file path filters when building the analysis context roots or when dispatching diagnostics per plugin.

Why this matters

  • Reduces noise from lints that don’t make sense in tests or generated files.
  • Avoids breaking refactoring/navigation by globally excluding test folders.
  • Keeps the project single-root (no need for separate analyzer contexts).
  • Makes custom_lint more flexible for large monorepos and multi-plugin environments.

Alternatives considered

  • Using separate analysis_options.yaml per folder (not reliable across IDEs).
  • Rule-level ignore_test_files options (moves complexity to each package).
  • Excluding test folders globally (breaks analysis and tooling features).

Additional context

This proposal originated from a discussion in riverpod_lint where the maintainer confirmed that folder-based configuration is not currently possible.
Having a plugin-level include/exclude feature in custom_lint would solve this generically for all lint packages.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions