Skip to content

Commit 2ead971

Browse files
authored
Update eslint server to latest master (sublimelsp#25)
* Update eslint server to latest master * Align compile script * Remove unused initializationOptions and update readme * Set "workspaceFolder" in "workspace/configuration" response vscode-eslint server has reasons to support a custom way of handling project directories (rather than implementing support for "workspace/workspaceFolders"). It means that we need to set the "workspaceFolder" property that specifies the given file's project (if any). This allows us to apply less strict linting to files outside of workspace or files within ignored node_modules directory.
1 parent 1c4d1c3 commit 2ead971

20 files changed

+2547
-2747
lines changed

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.dependabot export-ignore
2+
.github/ export-ignore
3+
codecov.yml export-ignore
4+
tests/ export-ignore
5+
tox.ini export-ignore
6+
compile-eslint-server.sh export-ignore
7+
unittesting.json export-ignore

LSP-eslint.sublime-settings

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,27 @@
1212
],
1313
},
1414
],
15-
"initializationOptions": {},
1615
"settings": {
17-
"validate": true,
16+
"validate": "on",
1817
"packageManager": "npm",
19-
"autoFix": true,
20-
"autoFixOnSave": true,
2118
"options": {},
2219
"run": "onType",
2320
"nodePath": null,
21+
"format": false,
2422
"quiet": false,
25-
"workspaceFolder": null,
23+
"onIgnoredFiles": "off",
2624
"codeAction": {
2725
"disableRuleComment": {
2826
"enable": true,
2927
"location": "separateLine"
3028
},
3129
"showDocumentation": {
3230
"enable": true
33-
},
31+
}
32+
},
33+
"codeActionOnSave": {
34+
"enable": true,
35+
"mode": "all"
3436
},
35-
},
37+
}
3638
}

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
# LSP-eslint
22

3-
Eslint support for Sublime's LSP plugin.
3+
Eslint support for Sublime's LSP plugin provided through [vscode-eslint](https://github.com/microsoft/vscode-eslint).
4+
5+
### Installation
46

57
* Install [LSP](https://packagecontrol.io/packages/LSP) and `LSP-eslint` from Package Control.
68
* Restart Sublime.
79

8-
## Configuration
10+
### Configuration
911

1012
Open configuration file using command palette with `Preferences: LSP-eslint Settings` command or opening it from the Sublime menu.
1113

1214
Configuration file contains multiple configuration keys:
1315

14-
### scopes
16+
#### scopes
1517

1618
Defines which scopes ESLint can run in.
1719

18-
### syntaxes
20+
#### syntaxes
1921

2022
Defines which syntax files ESLint can run in.
2123

22-
### initializationOptions
23-
24-
Configuration options sent with `initialize` message. I believe these are not used by ESLint.
25-
26-
### settings
24+
#### settings
2725

28-
ESLint configuration options. Those are currently not documented but [documentation for VSCode extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) roughly matches with those so can help in understanding them.
26+
ESLint configuration options. Refer to [documentation for VSCode extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).
2927

30-
## FAQ
28+
### FAQ
3129

3230
Q: How to enable linting of Typescript code?
3331

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
# @see https://github.com/microsoft/vscode-eslint
3+
4+
GITHUB_REPO_URL="https://github.com/microsoft/vscode-eslint"
5+
GITHUB_REPO_NAME=$(echo "${GITHUB_REPO_URL}" | command grep -oE '[^/]*$')
6+
7+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
REPO_DIR="${SCRIPT_DIR}"
9+
TEMP_DIR="${REPO_DIR}/temp"
10+
SRC_SERVER_DIR="${TEMP_DIR}/server"
11+
12+
# -------- #
13+
# clean up #
14+
# -------- #
15+
16+
pushd "${REPO_DIR}" || exit
17+
18+
rm -rf out package-lock.json package.json update-info.log
19+
mkdir -p "${TEMP_DIR}"
20+
21+
popd || exit
22+
23+
24+
# ---------------- #
25+
# download sources #
26+
# ---------------- #
27+
28+
pushd "${TEMP_DIR}" || exit
29+
30+
echo 'Enter commit SHA, branch or tag (for example 2.1.0) to build'
31+
read -rp 'SHA, branch or tag (default: master): ' ref
32+
33+
# use the "master" branch by default
34+
if [ "${ref}" = "" ]; then
35+
ref="master"
36+
fi
37+
38+
temp_zip="src-${ref}.zip"
39+
curl -L "${GITHUB_REPO_URL}/archive/${ref}.zip" -o "${temp_zip}"
40+
unzip -z "${temp_zip}" > update-info.log
41+
unzip "${temp_zip}" && rm -f "${temp_zip}"
42+
mv "${GITHUB_REPO_NAME}-"*/* "${TEMP_DIR}"
43+
44+
popd || exit
45+
46+
# ------------ #
47+
# prepare deps #
48+
# ------------ #
49+
50+
pushd "${SRC_SERVER_DIR}" || exit
51+
52+
echo 'Installing dependencies...'
53+
npm install
54+
npm install -D typescript @types/node
55+
56+
popd || exit
57+
58+
59+
# ------- #
60+
# compile #
61+
# ------- #
62+
63+
pushd "${SRC_SERVER_DIR}" || exit
64+
65+
echo 'Compiling server...'
66+
npx tsc --newLine LF -p .
67+
68+
popd || exit
69+
70+
71+
# -------------------- #
72+
# collect output files #
73+
# -------------------- #
74+
75+
pushd "${SRC_SERVER_DIR}" || exit
76+
77+
echo 'Copying and cleaning up files...'
78+
find ./out -name "*.map" -delete
79+
cp -f ../update-info.log "${REPO_DIR}"
80+
cp -r out package.json package-lock.json "${REPO_DIR}"
81+
rm -rf "${TEMP_DIR}"
82+
83+
popd || exit

0 commit comments

Comments
 (0)