Mithotyn
TypeScript LanguageService Plugin that provides real-time in-editor linting while you type.
Make sure to also read the full documentation of all available modules.
Installation
npm install --save-dev @fimbul/wotan @fimbul/mithotyn
yarn add -D @fimbul/wotan @fimbul/mithotyn
Usage
To enable this plugin, you need to add @fimbul/mithotyn
as plugin in your tsconfig.json
. For example:
{
"compilerOptions": {
"plugins": [
{ "name": "@fimbul/mithotyn" }
],
"strict": true,
}
}
Make sure you have @fimbul/wotan
installed in the project directory or a parent directory.
Using your existing .fimbullinter.yaml
Like the CLI this plugin uses your configurations from a file named .fimbullinter.yaml
. The main difference is that it doesn't only look for this file in the current directory but also in all parent directories.
This is necessary because there is likely only one .fimbullinter.yaml
in the root of your workspace, but multiple TypeScript projects may exist in subdirectories.
The following options are used if present in that file. Note that all paths and modules are resolved relative to the directory containing this configuration file.
modules
: loads the specified plugin modules to customize linter behaviorconfig
: use the specified configuration file for all filesfiles
: only lint files matching one of the given glob patternsexclude
: exclude files matching one of the given glob patterns
Configuration Options
To customize your in-editor linting experience you can use the following configuration options:
displayErrorsAsWarnings: boolean
: Report findings with severity error
as warning to make them distinguishable from real type errors (e.g. green instead of red squiggles in VS Code)
Example:
{
"compilerOptions": {
"plugins": [
{
"name": "@fimbul/mithotyn",
"displayErrorsAsWarnings": true
}
],
"strict": true,
}
}
Usage in VS Code
In Visual Studio Code you can choose between the version of TypeScript that comes bundled with the editor or the local one installed in the workspace.
Due to technical limitations you need to choose the workspace version to correctly pick up the plugin configured in the previous section.
- open command palette while a TypeScript or JavaScript file is opened
- select
TypeScript: Select TypeScript Version.
- select
Use Workspace Version
Other editors might work the same as VS Code.
To work around this limitation there will be an editor plugin that automatically loads this LanguageService plugin. Stay tuned.
Limitations
There are some limitations of the current implementation.
- doesn't use processors at all
The following limitations will likely be fixed in future releases.
- Currently only works with TypeScript installed in your workspace, see Usage in VS Code
- doesn't provide code fixes for findings
- doesn't validate
.wotanrc.yaml
and .fimbullinter.yaml
files - doesn't refresh lint findings if configuration changes; you need to reopen or change the file
License
Apache-2.0 © Klaus Meinhardt