TidyConfig class
Resolved configuration for a tidy_imports run.
Configuration is read from tidy_imports.yaml at the project root if it
exists (issue import_sorter#67), otherwise from the tidy_imports: block
in pubspec.yaml. Command-line flags take precedence over both.
Constructors
-
TidyConfig({required bool emojis, required bool noComments, required bool noBlankLines, required bool sortPubspec, required bool groupProjectByFolder, required List<
String> ignoredFiles, required List<CustomTier> customTiers, bool separateRelativeImports = true, bool testImports = false, List<String> testImportPrefixes = defaultTestImportPrefixes, bool sortExports = false, int groupProjectByFolderDepth = 0, bool removeDuplicates = false, bool removeUnused = false, bool flat = false, bool relativeImports = false, List<String> reportRoots = const [], bool attachComments = false, List<String> issues = const []}) -
const
- TidyConfig.fromStandalone(dynamic yaml)
-
Builds a config from the parsed contents of a standalone
tidy_imports.yaml.factory -
TidyConfig.fromYaml(dynamic config, [List<
String> ? priorIssues]) -
Builds a config from a parsed YAML node, applying defaults for anything
missing. A
nullnode yields all defaults.factory - TidyConfig.load(String currentPath, YamlMap pubspecYaml)
-
Loads configuration, preferring
tidy_imports.yamlover thetidy_imports:block inpubspec.yaml.factory
Properties
- attachComments → bool
-
Whether a
//comment written directly above a directive moves with it. Opt-in: it changes where existing comments end up, and the note above the first directive is a file header in either case.final -
customTiers
→ List<
CustomTier> -
final
- emojis → bool
-
final
- flat → bool
-
Whether the groups are dropped for one alphabetical run per section —
the shape the
directives_orderinglint expects. Opt-in: it throws away the group comments that are this tool's most recognisable output.final - groupProjectByFolder → bool
-
final
- groupProjectByFolderDepth → int
-
How many folder segments — counted after the package root — the project
group is broken up by. 0 keeps the whole path, which is the original
behaviour of groupProjectByFolder. Any value above 0 also switches
that grouping on, since setting a depth is asking for it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
ignoredFiles
→ List<
String> -
final
-
issues
→ List<
String> -
Every problem found while reading the configuration, as a sentence ready
to print.
final
- noBlankLines → bool
-
final
- noComments → bool
-
final
- relativeImports → bool
-
Whether
package:<self>/…imports are rewritten as relative paths, matching theprefer_relative_importslint. Opt-in, and the opposite of whatalways_use_package_importswants — the two lints disagree, so the choice has to be the user's.final - removeDuplicates → bool
-
Whether a directive written identically twice is folded into one.
Opt-in: removing a line is not something a sorter should do uninvited.
final
- removeUnused → bool
-
Whether
dart fix --apply --code=unused_importruns before sorting. Opt-in for the same reason, and because it costs an analyzer pass.final -
reportRoots
→ List<
String> -
Extra entry points for
--report, as regular expressions matched against the project-relative path (/lib/app/bootstrap.dart). An entry point is unreferenced by definition, so anything the report cannot recognise on its own — a file run withdart run lib/tool.dart, a flavour main in a subfolder — is declared here rather than reported forever.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- separateRelativeImports → bool
-
Whether a blank line separates the
package:<self>/…and relative halves of the project group.final - sortExports → bool
-
Whether
exportdirectives are sorted into their own block. Opt-in: on by default it would rewrite the barrel file of every existing project.final - sortPubspec → bool
-
final
-
testImportPrefixes
→ List<
String> -
final
- testImports → bool
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
defaultTestImportPrefixes
→ const List<
String> - File-name prefixes treated as test doubles when testImports is on.