diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea41eb61cb..b413b1ed87f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -184,7 +184,7 @@ #### Linter -Updated the Linter to `1.30.0`, which includes changes that +Updated the Linter to `1.31.0`, which includes changes that - add new lint: `enable_null_safety`. - add new lint: `library_annotations`. diff --git a/DEPS b/DEPS index 89a02d044a6..16f98df2e45 100644 --- a/DEPS +++ b/DEPS @@ -139,7 +139,7 @@ vars = { "intl_rev": "a127902594a964f2090239fb454adadf7c1a77ef", "jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1", "json_rpc_2_rev": "16fed53fbebd38edf170f58c1da1de2a325b2b98", - "linter_rev": "8bce8b8b06c22716219207eb9d52beb93932ea44", # 1.30.0 + "linter_rev": "f42cb7a38ffccaa5bfe3ede091b71be87d7075d8", # 1.31.0 "lints_rev": "16bdefe1df529262a6596f79e91003ddbdbd3890", "logging_rev": "f322480fb9d9e83e677c08db6d09067059f7ff74", "markdown_rev": "ee3f4e976efcfed87c6ec78364bc2dd3c6e717b9", diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml index a821c091961..782801ef78f 100644 --- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml +++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml @@ -1954,7 +1954,9 @@ LintCode.prefer_contains: LintCode.prefer_double_quotes: status: hasFix LintCode.prefer_equal_for_default_values: - status: hasFix + status: noFix + notes: |- + Lint is disabled in 2.19 and will be removed in 3.0. LintCode.prefer_expression_function_bodies: status: hasFix LintCode.prefer_final_fields: diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart index 91e9702fa9b..691edc7461a 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart @@ -554,9 +554,6 @@ class FixProcessor extends BaseProcessor { LintNames.prefer_double_quotes: [ ConvertToDoubleQuotes.new, ], - LintNames.prefer_equal_for_default_values: [ - ReplaceColonWithEquals.new, - ], LintNames.prefer_expression_function_bodies: [ ConvertToExpressionFunctionBody.new, ], diff --git a/pkg/analysis_server/lib/src/services/linter/lint_names.dart b/pkg/analysis_server/lib/src/services/linter/lint_names.dart index fa263a005c7..8a0e61c25be 100644 --- a/pkg/analysis_server/lib/src/services/linter/lint_names.dart +++ b/pkg/analysis_server/lib/src/services/linter/lint_names.dart @@ -93,8 +93,6 @@ class LintNames { 'prefer_const_literals_to_create_immutables'; static const String prefer_contains = 'prefer_contains'; static const String prefer_double_quotes = 'prefer_double_quotes'; - static const String prefer_equal_for_default_values = - 'prefer_equal_for_default_values'; static const String prefer_expression_function_bodies = 'prefer_expression_function_bodies'; static const String prefer_final_fields = 'prefer_final_fields'; diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart deleted file mode 100644 index f97006d1f11..00000000000 --- a/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'package:analysis_server/src/services/correction/fix.dart'; -import 'package:analysis_server/src/services/linter/lint_names.dart'; -import 'package:analyzer/src/dart/error/hint_codes.g.dart'; -import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; -import 'package:test_reflective_loader/test_reflective_loader.dart'; - -import 'fix_processor.dart'; - -void main() { - defineReflectiveSuite(() { - defineReflectiveTests(ReplaceColonWithEqualsBulkLintTest); - defineReflectiveTests(ReplaceColonWithEqualsBulkTest); - defineReflectiveTests(ReplaceColonWithEqualsLintTest); - defineReflectiveTests(ReplaceColonWithEqualsTest); - }); -} - -@reflectiveTest -class ReplaceColonWithEqualsBulkLintTest extends BulkFixProcessorTest { - @override - String get lintCode => LintNames.prefer_equal_for_default_values; - - Future test_singleFile() async { - await resolveTestCode(''' -void f({int a: 1}) => null; - -class C { - void m({int a: 1, int b: 2}) => null; -} -'''); - await assertHasFix(''' -void f({int a = 1}) => null; - -class C { - void m({int a = 1, int b = 2}) => null; -} -'''); - } -} - -@reflectiveTest -class ReplaceColonWithEqualsBulkTest extends BulkFixProcessorTest { - Future test_singleFile() async { - await resolveTestCode(''' -void f({int a: 1}) => null; - -class C { - void m({int a: 1, int b: 2}) => null; -} -'''); - await assertHasFix(''' -void f({int a = 1}) => null; - -class C { - void m({int a = 1, int b = 2}) => null; -} -'''); - } -} - -@reflectiveTest -class ReplaceColonWithEqualsLintTest extends FixProcessorLintTest { - @override - FixKind get kind => DartFixKind.REPLACE_COLON_WITH_EQUALS; - - @override - String get lintCode => LintNames.prefer_equal_for_default_values; - - Future test_method() async { - await resolveTestCode(''' -void f({int a: 1}) => null; -'''); - await assertHasFix(''' -void f({int a = 1}) => null; -''', - errorFilter: (error) => - error.errorCode != HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE); - } - - Future test_superParameter() async { - await resolveTestCode(''' -class C { - C({int? i}); -} -class D extends C { - D({int? super.i: 1}); -} -'''); - await assertHasFix(''' -class C { - C({int? i}); -} -class D extends C { - D({int? super.i = 1}); -} -''', - errorFilter: (error) => - error.errorCode != HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE); - } -} - -@reflectiveTest -class ReplaceColonWithEqualsTest extends FixProcessorTest { - @override - FixKind get kind => DartFixKind.REPLACE_COLON_WITH_EQUALS; - - Future test_method() async { - await resolveTestCode(''' -void f({int a: 1}) => null; -'''); - await assertHasFix(''' -void f({int a = 1}) => null; -'''); - } - - Future test_superParameter() async { - await resolveTestCode(''' -class C { - C({int? i}); -} -class D extends C { - D({int? super.i: 1}); -} -'''); - await assertHasFix(''' -class C { - C({int? i}); -} -class D extends C { - D({int? super.i = 1}); -} -'''); - } -} diff --git a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart index 85e51c324af..8c2da275630 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/test_all.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/test_all.dart @@ -208,7 +208,6 @@ import 'rename_to_camel_case_test.dart' as rename_to_camel_case; import 'replace_Null_with_void_test.dart' as replace_null_with_void; import 'replace_boolean_with_bool_test.dart' as replace_boolean_with_bool; import 'replace_cascade_with_dot_test.dart' as replace_cascade_with_dot; -import 'replace_colon_with_equals_test.dart' as replace_colon_with_equals; import 'replace_container_with_sized_box_test.dart' as replace_container_with_sized_box; import 'replace_final_with_const_test.dart' as replace_final_with_const; @@ -429,7 +428,6 @@ void main() { rename_method_parameter.main(); replace_boolean_with_bool.main(); replace_cascade_with_dot.main(); - replace_colon_with_equals.main(); replace_container_with_sized_box.main(); replace_final_with_const.main(); replace_final_with_var.main();