Skip to content

Commit bf6fe53

Browse files
linters(dart): detect runtime via dart --version, wire configs, link rule docs (#1098)
- Add version_command (parse `dart --version`) to respect system/Flutter Dart - Mark analysis_options.yaml as direct config; keep pubspec.yaml in affects_cache - Set suggest_if: files_present - Bump known_good_version to 3.9.2 - Update snapshots for Dart 3.9.2 and add issueUrl fields This pull request may resolve issue #1076.
1 parent 21b5554 commit bf6fe53

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

linters/dart/plugin.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tools:
1515
definitions:
1616
- name: dart
1717
download: dart
18-
known_good_version: 3.2.6
18+
known_good_version: 3.9.2
1919
shims: [dart, dartaotruntime]
2020
environment:
2121
- name: PATH
@@ -28,11 +28,16 @@ lint:
2828
- name: dart
2929
main_tool: dart
3030
files: [dart]
31-
known_good_version: 3.2.6
32-
suggest_if: never
31+
known_good_version: 3.9.2
32+
version_command:
33+
parse_regex: "Dart SDK version: ${semver}"
34+
run: dart --version
35+
suggest_if: files_present
3336
description: Lints and formats dart code
34-
affects_cache:
37+
issue_url_format: https://dart.dev/tools/linter-rules/{}
38+
direct_configs:
3539
- analysis_options.yaml
40+
affects_cache:
3641
- pubspec.yaml
3742
commands:
3843
- name: format

linters/dart/test_data/dart_v3.2.6_basic.check.shot renamed to linters/dart/test_data/dart_v3.9.2_basic.check.shot

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ exports[`Testing linter dart test basic 1`] = `
88
"column": "10",
99
"file": "test_data/basic.in.dart",
1010
"issueClass": "ISSUE_CLASS_EXISTING",
11+
"issueUrl": "https://dart.dev/tools/linter-rules/undefined_identifier",
1112
"level": "LEVEL_HIGH",
12-
"line": "14",
13+
"line": "16",
1314
"linter": "dart",
1415
"message": "Undefined name 'find'. Try correcting the name to one that is defined, or defining the name.",
1516
"targetType": "dart",
@@ -19,8 +20,9 @@ exports[`Testing linter dart test basic 1`] = `
1920
"column": "25",
2021
"file": "test_data/basic.in.dart",
2122
"issueClass": "ISSUE_CLASS_EXISTING",
23+
"issueUrl": "https://dart.dev/tools/linter-rules/undefined_identifier",
2224
"level": "LEVEL_HIGH",
23-
"line": "14",
25+
"line": "16",
2426
"linter": "dart",
2527
"message": "Undefined name 'empty'. Try correcting the name to one that is defined, or defining the name.",
2628
"targetType": "dart",
@@ -30,8 +32,9 @@ exports[`Testing linter dart test basic 1`] = `
3032
"column": "3",
3133
"file": "test_data/basic.in.dart",
3234
"issueClass": "ISSUE_CLASS_EXISTING",
35+
"issueUrl": "https://dart.dev/tools/linter-rules/undefined_function",
3336
"level": "LEVEL_HIGH",
34-
"line": "14",
37+
"line": "16",
3538
"linter": "dart",
3639
"message": "The function 'expect' isn't defined. Try importing the library that defines 'expect', correcting the name to the name of an existing function, or defining a function named 'expect'.",
3740
"targetType": "dart",

linters/dart/test_data/dart_v3.2.6_test_data.basic.in.dart.check.shot renamed to linters/dart/test_data/dart_v3.9.2_test_data.basic.in.dart.check.shot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
exports[`Testing linter dart test basic 1`] = `
44
"library;
55

6+
import 'dart:io';
7+
68
class Vector2d {
79
final double x, y;
810
Vector2d(this.x, this.y);

0 commit comments

Comments
 (0)