unnecessary-library-name
Same as unnecessary_library_name in Dart lints
- Group
- Style
- Path
lint/style/unnecessary-library-name- Default
- On (recommended)
- Origin
- Dart lints
- Rule
- 460 of 512
Flags a library directive that carries an explicit name.
Since Dart 2.19 the library directive no longer needs a name: part of
directives can reference their parent by URI, and library-level doc comments
and annotations attach to a bare library;. A named library is legacy syntax
that only adds a global identifier which can collide across packages. Remove
the name, keeping the library; directive itself if it anchors documentation
or annotations.
Invalid
library foo;library foo;Valid
library;
class Model {}Configure unnecessary-library-name
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"unnecessary-library-name": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/unnecessary-library-name: <reason>More style rules
- unnecessary-new
unnecessary_newrecommendedFlags an explicit
newkeyword in an instance-creation expression. - unnecessary-null-aware-operator-on-extension-on-nullable
unnecessary_null_aware_operator_on_extension_on_nullableFlags a null-aware access whose member comes from an extension on a nullable type.
- unnecessary-null-checks
unnecessary_null_checksFlags a null assertion
!on a value that flows into a nullable context. - unnecessary-nullable-for-final-variable-declarations
unnecessary_nullable_for_final_variable_declarationsrecommendedFlags a
finalorconstvariable given a nullable type but initialized to a provably non-null value. - unnecessary-parenthesis
unnecessary_parenthesisrecommendedFlags parentheses that can be removed without changing the meaning or hurting readability.
- unnecessary-raw-strings
unnecessary_raw_stringsrecommendedFlags raw string literals that contain no backslash or
$. - unnecessary-string-escapes
unnecessary_string_escapesrecommendedFlags backslashes that do not affect a string's value.
- unnecessary-string-interpolations
unnecessary_string_interpolationsrecommendedFlags a string literal whose entire content is a single interpolation of a provably non-nullable
String.