coc-tslint


Ⅰ. 插件描述

Tslint language server extension of coc.nvim

Ⅱ. 基本信息

创建日期:  2018-09-05
使用用户:  4
Github星:  9
插件作者:  neoclide

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'neoclide/coc-tslint'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'neoclide/coc-tslint'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'neoclide/coc-tslint'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/neoclide/coc-tslint

Ⅳ. 文档说明

# coc-tslint

Tslint language server extension for coc.nvim.

The tslint module is resolved from current file and then global modules of npm and yarn.

Note: this extension can't detect semantic issues, use coc-tslint-plugin instead.

Install

In your vim/neovim run command:

:CocInstall coc-tslint

Features

  • Lint typescript and javascript files using tslint.
  • Provide codeActions for fix lint issues.
  • Provide tslint commands:

    • tslint.fixAllProblems fix problems of current buffer.
    • tslint.createConfig create tslint config file.
    • tslint.lintProject lint current project

Configuration options

Notice this configuration settings allow you to configure the behaviour of the vscode-tslint extension. To configure rules and tslint options you should use the tslint.json file.

  • tslint.enable - enable/disable tslint.
  • tslint.jsEnable - enable/disable tslint for .js files, default is false.
  • tslint.run - run the linter onSave or onType, default is onType.
  • tslint.rulesDirectory - an additional rules directory, for user-created rules.
  • tslint.configFile - the configuration file that tslint should use instead of the default tslint.json.
  • tslint.ignoreDefinitionFiles - control if TypeScript definition files should be ignored, default is true.
  • tslint.exclude - configure glob patterns of file paths to exclude from linting. The pattern is matched against the absolute path of the linted file.
  • tslint.validateWithDefaultConfig - validate a file for which no custom tslint configuration was found. The default is false.
  • tslint.nodePath - custom path to node modules directory, used to load tslint from a different location than the default of the current workspace or the global node modules directory.
  • tslint.autoFixOnSave - turns auto fix on save on or off, or defines an array of rules (e.g. [no-var-keyword]) to auto fix on save. Note: Auto-fixing is only done when manually saving a file. It is not performed when the file is automatically saved based on the files.autoSave setting. Executing a manual save on an already-saved document will trigger auto-fixing.
  • tslint.alwaysShowStatus - always show the TSLint status bar item and not only when there are errors. The default is false.
  • tslint.alwaysShowRuleFailuresAsWarnings - always show rule failures as warnings, ignoring the severity configuration in the tslint.json configuration.
  • tslint.packageManager: use this package manager to locate the tslint and typescript modules. Valid values are "npm" or "yarn". This setting is only consulted when the modules are installed globally.

Auto-fixing

The extension supports automatic fixing of warnings to the extent supported by tslint. For warnings which support an auto-fix. You can apply the quick fix by either:

  • Trigger <Plug>(coc-codeaction) with mapped keys, and select a fix action in input list.
  • use the command Fix all auto-fixable problems.

When there are overlapping auto fixes a user will have to trigger Fix all auto-fixable problems more than once.

License

MIT

添加新评论