Sublime Text 4 - 如何设置 LSP-eslint

问题描述

当使用 Sublime text 3 时,我有 SublimeLinterSublimeLinter-eslint 包,以及 eslint & babel-eslint 用于 JS 和 JSX 语法的全局节点模块。

切换到 Sublime 4 后,我决定尝试一下 LSP。我安装了它,还有 LSP-css(开箱即用)和 LSP-eslint,但无法正常工作。

如果我检查 Sublime 的状态栏,我会看到语言服务器显然在运行 (?)

enter image description here

这是在一个项目中,它有自己的 eslintrc.js 配置文件,它在 VScode 中开箱即用。部分内容如下:

const RulesAirBnb = require("eslint-config-airbnb-base/rules/best-practices");
const RulesCRA = require("eslint-config-react-app");

module.exports = {
    root: true,parser: "babel-eslint",parserOptions: {
        ecmaVersion: 2018,sourceType: "module",ecmaFeatures: {
            jsx: true,generators: true,},extends: [
        "airbnb",// Baseguide is AirBnB"s
        "prettier","prettier/react",],

检查了以下 SO question 但没有运气。

  • 如何让它发挥作用?
  • 我还需要 eslintbabel-eslint 的全局节点模块吗? (考虑到我在项目的 package.json 中有两个本地开发依赖项 - 听起来我不应该)

解决方法

安装 LSP-typescript 就成功了,开箱即用,甚至不需要 lsp-eslint。不真实。

经过几天的研究,找到了信息 here(感谢 chrsap!)。

如果您正在运行 ST3,请检查 LSP-typescript's readme 以获取所需的软件包。