sapegin / textlint-rule-stop-words

Textlint rule to find filler words, buzzwords and clichés
MIT License
20 stars 6 forks source link

Replacement value should be used as-is #23

Closed ggrossetie closed 3 years ago

ggrossetie commented 3 years ago

The linter is trying to help by using a capital letter if the match was using standard capitalization (i.e., first letter capitalized). For instance, given the following definition:

{
  options: {
    words: [['utilize', 'use']],
  }
}

It will replace: "Utilize Elm" by "Use Elm" (and not "use Elm" with lowercase "u").

But this does not produce the expected result when working with proper noun. For instance, if I want to make sure that "reveal.js" is using the correct capitalization (all lowercase):

{
  options: {
    words: [['reveal.js', 'reveal.js']],
  }
}

The linter should replace "Reveal.js is great" by "reveal.js is great" but it won't work as expected. Arguably, both strategies can be useful so we might consider an option to enable/disable this feature. What do you think?

ggrossetie commented 3 years ago

One idea would be to declare nouns in nouns:

{
  options: {
    words: [['utilize', 'use']],
    nouns: [['reveal.js', 'reveal.js']],
  }
}

Another idea would be to introduce a special case when we (only) want to check capitalization:

{
  options: {
    words: [['utilize', 'use']],
    checkCapitalization: [
      'reveal.js',
      'Asciidoctor',
      'Ruby',
      'Node',
      'AsciiDoc'
    ],
  }
}
sapegin commented 3 years ago

Yup, this behavior is expected: starting sentences with a small letter significantly reduces readability.

For proper nouns, I'd recommend https://github.com/sapegin/textlint-rule-terminology

ggrossetie commented 3 years ago

For proper nouns, I'd recommend sapegin/textlint-rule-terminology

That's awesome, I totally missed it! Thank you so much for all the work you did on textlint :medal_sports: