format-comment
added in: 1.0.0 style
Prefer format comments like sentences.
Config
Set ignored-patterns
(default is none
) to ignore comments that match the given regular expressions.
Set only-doc-comments
(default is false
) to check only documentation comments (///
).
dart_code_linter:
...
rules:
...
- format-comment:
only-doc-comments: true
ignored-patterns:
- ^ cSpell.* # Ignores all the comments that start with 'cSpell' (for example: '// cSpell:disable-next-line').
Example
Bad:
// prefer format comments like sentences // LINT
class Test {
/// with start space with dot. // LINT
Test() {
// with start space with dot. // LINT
}
/// With start space without dot // LINT
function() {
//Without start space without dot // LINT
}
}
/* prefer format comments
like sentences */ // LINT
Good:
// Prefer format comments like sentences.
class Test {
/// With start space with dot.
Test() {
// With start space with dot.
}
/// With start space without dot.
function() {
// Without start space without dot.
}
}
/* Prefer format comments
like sentences. */