Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add customWords options #4683

Merged
merged 5 commits into from
Aug 1, 2023
Merged

Conversation

siosio34
Copy link
Contributor

hello. In addition to the file path option, an option has been added to make the eslint spell checker work normally even when word lists are entered.

If this option is added, it seems that the spell checker option can be applied immediately without having to create and read the file.

Copy link
Collaborator

@Jason3S Jason3S left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siosio34,

Thank you. I think it is a good idea to be able to add these things to the eslint config to keep things in one place.

In a later PR / enhancement, it might make sense to add a "cspell" section, to add the ability to pass cspell config to the spell checker without needing to add a cspell.json file to a project.

options.ts

/**
 * CSpell config
 */
cspell?: Pick<CSpellSettings, 'words' | 'ignoreWords' | 'flagWords'>;

if (customWords && customWords.length > 0) {
const settings: CSpellSettings = {
...defaultSettings,
userWords: customWords,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use words instead of userWords. userWords is used for defining words at the "user" level to be applied across multiple projects.

dictionaries: ['eslint-plugin-custom-words'],
};

return settings;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to have both customWordListFile and customWords. Returning here would not allow customWords.

@siosio34
Copy link
Contributor Author

siosio34 commented Aug 1, 2023

@Jason3S

Thank you so much for your review. As you said in the link, it seems like a really good idea to get cspell's settings as they are. I wrote a new af29643 reflecting the part and other reviews.

I may have missed something because I am not familiar with the overall source code structure. If it is a minor modification, you can additionally modify the corresponding pr directly, or if you review it as it is now, I will reflect it as much as possible. So have a nice day

This fix takes care of a caching issue that caused tests to fail if the same document was loaded again, but with different settings.
@Jason3S Jason3S merged commit 956230c into streetsidesoftware:main Aug 1, 2023
82 checks passed
@siosio34
Copy link
Contributor Author

@Jason3S hello May I ask if this feature has been released?

@Jason3S
Copy link
Collaborator

Jason3S commented Aug 10, 2023

@siosio34,

Not yet. It will come out with v7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants