vscode-spell-checker
vscode-spell-checker copied to clipboard
Ignore variables from external libraries (import node_modules).
Imported variables should be ignored. e.g.
import { MatDatepickerInputEvent } from '@angular/material/datepicker';
someMethod(event: MatDatepickerInputEvent);
MatDatepickerInputEvent comes form an external library. In this case Angular from node_modules and the word "Datepicker" is a spelling issue. These variables should be ignored in the whole file. So ignoreRegExpList etc. will not work.
Do you know the ESLint TypeScript Naming Convention rules? This plugin can detect such import and ignores it. I have no idea how it works, but it may help to implement it.
The goal of this issue is to display only spelling issues of own sources what can be changed. Not from 3rd party libs.
This would break the tool for those wanting to spell check their aliases. import { A as Badlynamed } from ...
It should also ignore method calls to libraries when typescript says they're valid.
@rshea0, @Tatsh, @infacto
I know it is not the same, but we have recently released an ESLint plugin that does what you ask: @cspell/eslint-plugin - npm
Feedback is welcome.
Note: Full support is planned, but the ESLint plugin is a good stop-gap option.
The plugin correctly checks import aliases, like import { A as Badlynamed } from ...
@Jason3S Thanks, I'll check it out!
There is a way to ignore package names?
import { mapState } from 'pinia';
Here, pinia is detected as error, but package names are not always good-spelled words and does not require spell-checking.
There is a way to ignore package names?
import { mapState } from 'pinia';Here,
piniais detected as error, but package names are not always good-spelled words and does not require spell-checking.
You can use the package Jason mentioned above. https://www.npmjs.com/package/@cspell/eslint-plugin
Oh, that should work for JavaScript modules.
There's one for PHP too? 👀
@nelson6e65,
It is possible to tell cspell to use the composer.json file as if it was a dictionary.
Example cspell.json:
{
"dictionaries": ["php", "custom-dictionary", "fullstack", "html", "composer"],
"ignorePaths": ["vendor/**", "*.phar", "*.lock"],
"dictionaryDefinitions": [
{
"name": "custom-dictionary",
"path": "./custom-dictionary.txt",
"addWords": true
},
{
"name": "composer",
"path": "./composer.json",
"type": "C",
"addWords": false
}
]
}
"type": "C", tells cspell to split out words from "code".