Skip to content

Commit

Permalink
analyzer: Add a 'web' category for lint rules
Browse files Browse the repository at this point in the history
Work towards dart-lang/linter#4991

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I1682d17f4ffdc0b844082834faba2c0f704e7102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375764
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
srawlins authored and Commit Queue committed Jul 15, 2024
1 parent 701eae7 commit 9637321
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pkg/analyzer/lib/src/lint/linter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ abstract final class Category {

/// A category of rules that protect against unused code.
static const String unusedCode = 'unused code';

/// A category of rules that help to write code deployed to the web.
static const String web = 'web';
}

/// The result of attempting to evaluate an expression as a constant.
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/lib/src/rules/avoid_double_and_int_checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AvoidDoubleAndIntChecks extends LintRule {
name: 'avoid_double_and_int_checks',
description: _desc,
details: _details,
categories: {Category.style});
categories: {Category.errorProne, Category.web});

@override
LintCode get lintCode => code;
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/lib/src/rules/avoid_js_rounded_ints.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AvoidJsRoundedInts extends LintRule {
name: 'avoid_js_rounded_ints',
description: _desc,
details: _details,
categories: {Category.errorProne});
categories: {Category.errorProne, Category.web});

@override
LintCode get lintCode => code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AvoidWebLibrariesInFlutter extends LintRule {
name: 'avoid_web_libraries_in_flutter',
description: _desc,
details: _details,
categories: {Category.errorProne, Category.flutter});
categories: {Category.errorProne, Category.flutter, Category.web});

@override
LintCode get lintCode => code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class InvalidRuntimeCheckWithJSInteropTypes extends LintRule {
name: lintName,
description: _desc,
details: _details,
categories: {Category.errorProne});
categories: {Category.errorProne, Category.web});

@override
List<LintCode> get lintCodes => const [
Expand Down

0 comments on commit 9637321

Please sign in to comment.