Skip to content

Lint for import "sort order".Β #57172

@pq

Description

@pq

Migrated from dartbug/20244:

What steps will clearly show the issue / need for enhancement?

  1. Run dartfmt -t on attached foo.dart
  2. Observe that imports are not in order.

What is the current output?

import 'package:a_star/a_star_2d.dart';
import 'package:zx/zx.dart';
import 'dart:convert';
import 'dart:async';
import 'package:a_star/a_star.dart';

void main() {
}

What would you like to see instead?

import 'dart:convert';
import 'dart:async';
import 'package:a_star/a_star.dart';
import 'package:a_star/a_star_2d.dart';
import 'package:zx/zx.dart';

void main() {
}

The request, as it stands, is for a transformation supplied by dartfmt. Since dart_style is not in the business of non-WS affecting changes, this feels like linter territory. To start I think we want a lint; ultimately there will be an associated quick fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions