Skip to content

Commit 449db53

Browse files
authored
Support analyzer 8 (#356)
1 parent 0f4c355 commit 449db53

File tree

15 files changed

+33
-25
lines changed

15 files changed

+33
-25
lines changed

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ analyzer:
1111
included_file_warning: ignore
1212
# false positive when using Freezed
1313
invalid_annotation_target: ignore
14+
## Too painful to upgrade analyzer, and an official Google package is coming
15+
deprecated_member_use: ignore
1416

1517
linter:
1618
rules:
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# include: ../analysis_options.yaml
1+
include: ../analysis_options.yaml
22

3-
# linter:
4-
# rules:
5-
# public_member_api_docs: false
6-
# avoid_print: false
3+
linter:
4+
rules:
5+
public_member_api_docs: false
6+
avoid_print: false

packages/custom_lint/example/example_lint/lib/custom_lint_example_lint.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PluginBase createPlugin() => _RiverpodLint();
2323
class _RiverpodLint extends PluginBase {
2424
@override
2525
List<LintRule> getLintRules(CustomLintConfigs configs) => [
26-
PreferFinalProviders(),
26+
const PreferFinalProviders(),
2727
];
2828

2929
@override
@@ -36,7 +36,7 @@ class _RiverpodLint extends PluginBase {
3636
///
3737
/// For emitting lints on non-Dart files, subclass [LintRule].
3838
class PreferFinalProviders extends DartLintRule {
39-
PreferFinalProviders() : super(code: _code);
39+
const PreferFinalProviders() : super(code: _code);
4040

4141
/// Metadata about the lint define. This is the code which will show-up in the IDE,
4242
/// and its description..
@@ -47,7 +47,7 @@ class PreferFinalProviders extends DartLintRule {
4747

4848
/// The core logic for our custom lint rule.
4949
/// In our case, it will search over all variables defined in a Dart file and
50-
/// search for the ones that implement a specific type (see [__providerBaseChecker]).
50+
/// search for the ones that implement a specific type (see [_providerBaseChecker]).
5151
@override
5252
void run(
5353
// This object contains metadata about the analyzed file

packages/custom_lint/example/example_lint/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
sdk: '>=3.0.0 <4.0.0'
66

77
dependencies:
8-
analyzer: ^7.5.0
8+
analyzer: ^8.0.0
99
analyzer_plugin: ^0.13.0
1010
custom_lint_builder:
1111
path: ../../../custom_lint_builder

packages/custom_lint/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
sdk: ">=3.0.0 <4.0.0"
99

1010
dependencies:
11-
analyzer: ^7.5.0
11+
analyzer: ^8.0.0
1212
analyzer_plugin: ^0.13.0
1313
args: ^2.3.1
1414
async: ^2.9.0
@@ -32,7 +32,7 @@ dev_dependencies:
3232
benchmark_harness: ^2.2.0
3333
build_runner: ^2.5.0
3434
file: ^7.0.0
35-
freezed: ^3.0.0
35+
freezed: ^3.2.1
3636
glob: ^2.1.2
3737
json_serializable: ^6.5.4
3838
test: ^1.20.2

packages/custom_lint/test/goldens.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ String _encodePrioritizedSourceChanges(
8686
final output = SourceEdit.applySequence(
8787
source,
8888
prioritizedSourceChange.change.edits
89-
.expand((element) => element.edits),
89+
.expand((element) => element.edits)
90+
.toList(),
9091
);
9192

9293
final outputLineInfo = LineInfo.fromContent(output);
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# include: ../analysis_options.yaml
1+
include: ../analysis_options.yaml
22

3-
# linter:
4-
# rules:
5-
# public_member_api_docs: false
6-
# avoid_print: false
3+
linter:
4+
rules:
5+
public_member_api_docs: false
6+
avoid_print: false

packages/custom_lint_builder/example/example_lint/lib/custom_lint_builder_example_lint.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PluginBase createPlugin() => _RiverpodLint();
2323
class _RiverpodLint extends PluginBase {
2424
@override
2525
List<LintRule> getLintRules(CustomLintConfigs configs) => [
26-
PreferFinalProviders(),
26+
const PreferFinalProviders(),
2727
];
2828

2929
@override
@@ -36,7 +36,7 @@ class _RiverpodLint extends PluginBase {
3636
///
3737
/// For emitting lints on non-Dart files, subclass [LintRule].
3838
class PreferFinalProviders extends DartLintRule {
39-
PreferFinalProviders() : super(code: _code);
39+
const PreferFinalProviders() : super(code: _code);
4040

4141
/// Metadata about the lint define. This is the code which will show-up in the IDE,
4242
/// and its description..

packages/custom_lint_builder/example/example_lint/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
sdk: '>=3.0.0 <4.0.0'
66

77
dependencies:
8-
analyzer: ^7.5.0
8+
analyzer: ^8.0.0
99
analyzer_plugin: ^0.13.0
1010
custom_lint_builder:
1111
path: ../../../custom_lint_builder

packages/custom_lint_builder/lib/src/client.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,8 @@ class _ClientAnalyzerPlugin extends analyzer_plugin.ServerPlugin {
10331033
allFixes
10341034
.expand((e) => e.fixes)
10351035
.expand((e) => e.change.edits)
1036-
.expand((e) => e.edits),
1036+
.expand((e) => e.edits)
1037+
.toList(),
10371038
);
10381039

10391040
io.File(path).writeAsStringSync(editedSource);

0 commit comments

Comments
 (0)