Skip to content

Commit d676118

Browse files
authored
Merge pull request #2797 from sass/lints
Enable additional recommended lints
2 parents e182ba2 + 548e660 commit d676118

264 files changed

Lines changed: 2046 additions & 325 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.101.2
2+
3+
* Fix a bug where the deprecation warning for vendor-prefixed `expression()`
4+
functions would incorrectly indicate whether or not the function would be
5+
invalid Sass in Dart Sass 2.0.0.
6+
17
## 1.101.1
28

39
* Sass stack trace entries are now always either absolute URLs, absolute paths,

analysis/lib/analysis_options.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,4 @@ analyzer:
1010
# These are necessary for matching the JS API.
1111
avoid_types_as_parameter_names: ignore
1212

13-
# These are style preferences rather than potential semantic issues. While
14-
# we're not intrinsically opposed to adopting them for consistency with the
15-
# Dart ecosystem, there aren't currently any automated tools to help us
16-
# migrate to and remain consistent with these style rules, so achieving
17-
# consistency isn't worth the engineering time we'd spend getting there.
18-
annotate_overrides: ignore
19-
use_function_type_syntax_for_parameters: ignore
20-
prefer_interpolation_to_compose_strings: ignore
21-
2213
include: package:lints/recommended.yaml

lib/sass.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ String compile(
375375
bool quietDeps = false,
376376
bool verbose = false,
377377
@Deprecated("Use CompileResult.sourceMap from compileToResult() instead.")
378-
void sourceMap(SingleMapping map)?,
378+
void Function(SingleMapping map)? sourceMap,
379379
bool charset = true,
380380
}) {
381381
var result = compileToResult(
@@ -434,7 +434,7 @@ String compileString(
434434
@Deprecated(
435435
"Use CompileResult.sourceMap from compileStringToResult() instead.",
436436
)
437-
void sourceMap(SingleMapping map)?,
437+
void Function(SingleMapping map)? sourceMap,
438438
bool charset = true,
439439
@Deprecated("Use syntax instead.") bool indented = false,
440440
}) {
@@ -480,7 +480,7 @@ Future<String> compileAsync(
480480
@Deprecated(
481481
"Use CompileResult.sourceMap from compileToResultAsync() instead.",
482482
)
483-
void sourceMap(SingleMapping map)?,
483+
void Function(SingleMapping map)? sourceMap,
484484
}) async {
485485
var result = await compileToResultAsync(
486486
path,
@@ -523,7 +523,7 @@ Future<String> compileStringAsync(
523523
@Deprecated(
524524
"Use CompileResult.sourceMap from compileStringToResultAsync() instead.",
525525
)
526-
void sourceMap(SingleMapping map)?,
526+
void Function(SingleMapping map)? sourceMap,
527527
bool charset = true,
528528
@Deprecated("Use syntax instead.") bool indented = false,
529529
}) async {
@@ -552,4 +552,4 @@ Future<String> compileStringAsync(
552552
///
553553
/// This is only intended for use when testing custom importers.
554554
@visibleForTesting
555-
T fakeFromImport<T>(T callback()) => inImportRule(callback);
555+
T fakeFromImport<T>(T Function() callback) => inImportRule(callback);

lib/src/ast/css/at_rule.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ abstract interface class CssAtRule implements CssParentNode {
1717
///
1818
/// This implies `children.isEmpty`, but the reverse is not true—for a rule
1919
/// like `@foo {}`, [children] is empty but [isChildless] is `false`.
20+
@override
2021
bool get isChildless;
2122
}

lib/src/ast/css/media_query.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,17 @@ final class CssMediaQuery {
184184
);
185185
}
186186

187+
@override
187188
bool operator ==(Object other) =>
188189
other is CssMediaQuery &&
189190
other.modifier == modifier &&
190191
other.type == type &&
191192
listEquals(other.conditions, conditions);
192193

194+
@override
193195
int get hashCode => modifier.hashCode ^ type.hashCode ^ listHash(conditions);
194196

197+
@override
195198
String toString() {
196199
var buffer = StringBuffer();
197200
if (modifier != null) buffer.write("$modifier ");
@@ -232,5 +235,6 @@ class MediaQuerySuccessfulMergeResult implements MediaQueryMergeResult {
232235

233236
MediaQuerySuccessfulMergeResult._(this.query);
234237

238+
@override
235239
String toString() => query.toString();
236240
}

lib/src/ast/css/modifiable/at_rule.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ import 'node.dart';
1212
/// A modifiable version of [CssAtRule] for use in the evaluation step.
1313
final class ModifiableCssAtRule extends ModifiableCssParentNode
1414
implements CssAtRule {
15+
@override
1516
final CssValue<String> name;
17+
18+
@override
1619
final CssValue<String>? value;
20+
21+
@override
1722
final bool isChildless;
23+
24+
@override
1825
final FileSpan span;
1926

2027
ModifiableCssAtRule(
@@ -24,17 +31,21 @@ final class ModifiableCssAtRule extends ModifiableCssParentNode
2431
this.value,
2532
}) : isChildless = childless;
2633

34+
@override
2735
T accept<T>(ModifiableCssVisitor<T> visitor) => visitor.visitCssAtRule(this);
2836

37+
@override
2938
bool equalsIgnoringChildren(ModifiableCssNode other) =>
3039
other is ModifiableCssAtRule &&
3140
name == other.name &&
3241
value == other.value &&
3342
isChildless == other.isChildless;
3443

44+
@override
3545
ModifiableCssAtRule copyWithoutChildren() =>
3646
ModifiableCssAtRule(name, span, childless: isChildless, value: value);
3747

48+
@override
3849
void addChild(ModifiableCssNode child) {
3950
assert(!isChildless);
4051
super.addChild(child);

lib/src/ast/css/modifiable/comment.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ import 'node.dart';
1212
/// A modifiable version of [CssComment] for use in the evaluation step.
1313
final class ModifiableCssComment extends ModifiableCssNode
1414
implements CssComment {
15+
@override
1516
final String text;
17+
18+
@override
1619
final FileSpan span;
1720

21+
@override
1822
bool get isPreserved => text.codeUnitAt(2) == $exclamation;
1923

2024
ModifiableCssComment(this.text, this.span);
2125

26+
@override
2227
T accept<T>(ModifiableCssVisitor<T> visitor) => visitor.visitCssComment(this);
2328
}

lib/src/ast/css/modifiable/declaration.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ import 'node.dart';
1313
/// A modifiable version of [CssDeclaration] for use in the evaluation step.
1414
final class ModifiableCssDeclaration extends ModifiableCssNode
1515
implements CssDeclaration {
16+
@override
1617
final CssValue<String> name;
18+
19+
@override
1720
final CssValue<Value> value;
21+
22+
@override
1823
final bool parsedAsSassScript;
24+
25+
@override
1926
final FileSpan valueSpanForMap;
27+
28+
@override
2029
final FileSpan span;
2130

31+
@override
2232
bool get isCustomProperty => name.value.startsWith('--');
2333

2434
/// Returns a new CSS declaration with the given properties.
@@ -39,8 +49,10 @@ final class ModifiableCssDeclaration extends ModifiableCssNode
3949
}
4050
}
4151

52+
@override
4253
T accept<T>(ModifiableCssVisitor<T> visitor) =>
4354
visitor.visitCssDeclaration(this);
4455

56+
@override
4557
String toString() => "$name: $value;";
4658
}

lib/src/ast/css/modifiable/import.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ final class ModifiableCssImport extends ModifiableCssNode implements CssImport {
1414
/// The URL being imported.
1515
///
1616
/// This includes quotes.
17+
@override
1718
final CssValue<String> url;
1819

20+
@override
1921
final CssValue<String>? modifiers;
2022

23+
@override
2124
final FileSpan span;
2225

2326
ModifiableCssImport(this.url, this.span, {this.modifiers});
2427

28+
@override
2529
T accept<T>(ModifiableCssVisitor<T> visitor) => visitor.visitCssImport(this);
2630
}

lib/src/ast/css/modifiable/keyframe_block.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ import 'node.dart';
1313
/// A modifiable version of [CssKeyframeBlock] for use in the evaluation step.
1414
final class ModifiableCssKeyframeBlock extends ModifiableCssParentNode
1515
implements CssKeyframeBlock {
16+
@override
1617
final CssValue<List<String>> selector;
18+
19+
@override
1720
final FileSpan span;
1821

1922
ModifiableCssKeyframeBlock(this.selector, this.span);
2023

24+
@override
2125
T accept<T>(ModifiableCssVisitor<T> visitor) =>
2226
visitor.visitCssKeyframeBlock(this);
2327

28+
@override
2429
bool equalsIgnoringChildren(ModifiableCssNode other) =>
2530
other is ModifiableCssKeyframeBlock &&
2631
listEquals(selector.value, other.selector.value);
2732

33+
@override
2834
ModifiableCssKeyframeBlock copyWithoutChildren() =>
2935
ModifiableCssKeyframeBlock(selector, span);
3036
}

0 commit comments

Comments
 (0)