mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[pkg] use package:lints for pkg/_js_interop_checks, pkg/js_runtime
Change-Id: I3bf78a773d431b21bd2f5cecaf6271899b73da70 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250783 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
eddd4f4427
commit
ba805d3c63
1
pkg/_js_interop_checks/analysis_options.yaml
Normal file
1
pkg/_js_interop_checks/analysis_options.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
include: package:lints/core.yaml
|
|
@ -262,7 +262,7 @@ class JsInteropChecks extends RecursiveVisitor {
|
|||
if (isAnonymousFactory) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (procedure.function != null &&
|
||||
!procedure.function.positionalParameters.isEmpty) {
|
||||
procedure.function.positionalParameters.isNotEmpty) {
|
||||
var firstPositionalParam = procedure.function.positionalParameters[0];
|
||||
_diagnosticsReporter.report(
|
||||
messageJsInteropAnonymousFactoryPositionalParameters,
|
||||
|
@ -339,7 +339,7 @@ class JsInteropChecks extends RecursiveVisitor {
|
|||
/// Reports an error if [functionNode] has named parameters.
|
||||
void _checkNoNamedParameters(FunctionNode functionNode) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (functionNode != null && !functionNode.namedParameters.isEmpty) {
|
||||
if (functionNode != null && functionNode.namedParameters.isNotEmpty) {
|
||||
var firstNamedParam = functionNode.namedParameters[0];
|
||||
_diagnosticsReporter.report(
|
||||
messageJsInteropNamedParameters,
|
||||
|
|
|
@ -35,7 +35,7 @@ String getJSName(Annotatable a) {
|
|||
for (var annotation in a.annotations) {
|
||||
if (_isPublicJSAnnotation(annotation)) {
|
||||
var jsClasses = _stringAnnotationValues(annotation);
|
||||
if (jsClasses.length > 0) {
|
||||
if (jsClasses.isNotEmpty) {
|
||||
jsClass = jsClasses[0];
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ List<String> _stringAnnotationValues(Expression node) {
|
|||
}
|
||||
} else if (node is ConstructorInvocation) {
|
||||
var argLength = node.arguments.positional.length;
|
||||
if (argLength > 1 || node.arguments.named.length > 0) {
|
||||
if (argLength > 1 || node.arguments.named.isNotEmpty) {
|
||||
throw new ArgumentError('Method expects annotation with at most one '
|
||||
'positional argument: $node.');
|
||||
} else if (argLength == 1) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class JsUtilOptimizer extends Transformer {
|
|||
@override
|
||||
visitProcedure(Procedure node) {
|
||||
_staticTypeContext.enterMember(node);
|
||||
var transformedBody;
|
||||
ReturnStatement? transformedBody;
|
||||
if (node.isExternal && node.isExtensionMember) {
|
||||
var index = _extensionMemberIndex ??=
|
||||
_createExtensionMembersIndex(node.enclosingLibrary);
|
||||
|
|
|
@ -424,7 +424,7 @@ class JsUtilWasmOptimizer extends Transformer {
|
|||
|
||||
ReturnStatement _getExternalExtensionMethodBody(Procedure node) {
|
||||
final parameters = node.function.positionalParameters;
|
||||
assert(parameters.length > 0);
|
||||
assert(parameters.isNotEmpty);
|
||||
return _getExternalMethodBody(node, VariableGet(parameters.first),
|
||||
_getExtensionMemberName(node), parameters.sublist(1));
|
||||
}
|
||||
|
|
|
@ -9,3 +9,7 @@ environment:
|
|||
dependencies:
|
||||
_fe_analyzer_shared: any
|
||||
kernel: any
|
||||
|
||||
# Use 'any' constraints here; we get our versions from the DEPS file.
|
||||
dev_dependencies:
|
||||
lints: any
|
||||
|
|
1
pkg/js_runtime/analysis_options.yaml
Normal file
1
pkg/js_runtime/analysis_options.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
include: package:lints/core.yaml
|
|
@ -9,3 +9,4 @@ environment:
|
|||
dev_dependencies:
|
||||
_fe_analyzer_shared: any
|
||||
expect: any
|
||||
lints: any
|
||||
|
|
Loading…
Reference in a new issue