Documentation
¶
Overview ¶
Package propernames implements MDS050, which checks that proper names (e.g. JavaScript, GitHub) appear with their configured casing.
Index ¶
- type Rule
- func (r *Rule) ApplySettings(s map[string]any) error
- func (r *Rule) Category() string
- func (r *Rule) Check(f *lint.File) []lint.Diagnostic
- func (r *Rule) DefaultSettings() map[string]any
- func (r *Rule) EnabledByDefault() bool
- func (r *Rule) Fix(f *lint.File) []byte
- func (r *Rule) ID() string
- func (r *Rule) Name() string
- func (r *Rule) SettingMergeMode(key string) rule.MergeMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct {
// Names is the list of proper names with their canonical casing.
// The names list appends across config layers so kind layers extend
// rather than replace the inherited vocabulary (same convention as
// placeholders:).
Names []string
// CheckCode enables checking inside code spans and code blocks.
CheckCode bool
// CheckHTML enables checking inside raw HTML and HTML blocks.
CheckHTML bool
}
Rule reports occurrences of configured proper names that do not match their canonical casing (e.g. "Javascript" when "JavaScript" is configured).
func (*Rule) ApplySettings ¶
ApplySettings implements rule.Configurable. The names list appends across config layers (same as placeholders:) so kind layers can extend the inherited vocabulary rather than replace it.
func (*Rule) Check ¶
func (r *Rule) Check(f *lint.File) []lint.Diagnostic
Check implements rule.Rule.
func (*Rule) DefaultSettings ¶
DefaultSettings implements rule.Configurable.
func (*Rule) EnabledByDefault ¶
EnabledByDefault implements rule.Defaultable.
func (*Rule) Fix ¶
Fix implements rule.FixableRule. It replaces each wrong-cased match with the canonical spelling. Only the left boundary is enforced — the byte before the match must be a non-word character (or start of file), but no right-boundary check is applied. The matched prefix is replaced and any trailing word characters (e.g. the 's' in "JavaScripts") are left as-is.