tbroadley / spellchecker-cli

A command-line tool for spellchecking files.
MIT License
119 stars 16 forks source link

Run only specified plugins #81

Closed tbroadley closed 2 years ago

tbroadley commented 2 years ago

Fixes #80

A user pointed out a bug where, even though they'd specified a specific list of plugins to run, all plugins were still running. The issue was that, when merging configuration from different sources together, we were using Lodash's merge function. When merging the default plugins array:

[
  'spell',
  'indefinite-article',
  'repeated-words',
  'syntax-mentions',
  'syntax-urls',
]

And the array passed by the user on the command line:

[
  'spell',
  'syntax-urls',
] 

Instead of the user's specified plugins completely overriding the defaults, the tool would run with the following plugins:

[
  'spell',
  'syntax-urls',
  'repeated-words',
  'syntax-mentions',
  'syntax-urls',
]

This PR fixes the issue by replacing merge with assign, which doesn't merge arrays in this manner.