Skip to content

Commit c26448e

Browse files
committed
fix: add eslint
1 parent d517ef4 commit c26448e

File tree

7 files changed

+1862
-47
lines changed

7 files changed

+1862
-47
lines changed

.eslintrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "eslint-config-atomic",
3+
"ignorePatterns": ["dist/", "node_modules/", "lib/debugger/VendorLib"]
4+
}

.github/workflows/CI.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
- name: Format ✨
4848
run: npm run test.format
4949

50-
# - name: Lint ✨
51-
# run: npm run test.lint
50+
- name: Lint ✨
51+
run: npm run test.lint
5252

5353
Release:
5454
needs: [Test]

babel.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
let presets = ["babel-preset-atomic"]
1+
const presets = ["babel-preset-atomic"]
22

3-
let plugins = []
3+
const plugins = []
44

55
module.exports = {
6-
presets: presets,
7-
plugins: plugins,
6+
presets,
7+
plugins,
88
exclude: ["node_modules/**", "lib/debugger/VendorLib/**"],
99
sourceMap: "inline",
1010
}

lib/main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createDebuggerProvider, activate as debuggerActivate, dispose as debugg
77

88
// Ref: https://github.com/nteract/hydrogen/blob/master/lib/autocomplete-provider.js#L33
99
// adapted from http://stackoverflow.com/q/5474008
10-
const PYTHON_REGEX = /(([^\d\W]|[\u00A0-\uFFFF])[\w.\u00A0-\uFFFF]*)|\.$/
10+
const PYTHON_REGEX = /(([^\W\d]|[\u00A0-\uFFFF])[\w.\u00A0-\uFFFF]*)|\.$/
1111

1212
class PythonLanguageClient extends AutoLanguageClient {
1313
activate() {
@@ -62,7 +62,7 @@ class PythonLanguageClient extends AutoLanguageClient {
6262
const venvPath = (await detectPipEnv(projectPath)) || (await detectVirtualEnv(projectPath))
6363
const pylsEnvironment = Object.assign({}, process.env)
6464
if (venvPath) {
65-
pylsEnvironment["VIRTUAL_ENV"] = venvPath
65+
pylsEnvironment.VIRTUAL_ENV = venvPath
6666
}
6767
this.python = replacePipEnvPathVar(atom.config.get("ide-python.python"), venvPath)
6868

@@ -114,7 +114,9 @@ class PythonLanguageClient extends AutoLanguageClient {
114114
}
115115

116116
async getSuggestions(request) {
117-
if (!PYTHON_REGEX.test(request.prefix)) return null
117+
if (!PYTHON_REGEX.test(request.prefix)) {
118+
return null
119+
}
118120
return super.getSuggestions(request)
119121
}
120122

@@ -125,7 +127,7 @@ class PythonLanguageClient extends AutoLanguageClient {
125127

126128
createTimeoutPromise(milliseconds) {
127129
return new Promise((resolve, reject) => {
128-
let timeout = setTimeout(() => {
130+
const timeout = setTimeout(() => {
129131
clearTimeout(timeout)
130132
this.logger.error(`Server failed to shutdown in ${milliseconds}ms, forcing termination`)
131133
resolve()

lib/utils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ async function detectVirtualEnv(path) {
3232
})
3333
)
3434
if (entries) {
35-
for (let entry of entries) {
35+
for (const entry of entries) {
3636
if (entry.isDirectory()) {
3737
if (VIRTUAL_ENV_BIN_DIRS.indexOf(entry.getBaseName()) !== -1) {
38-
for (let executable of VIRTUAL_ENV_EXECUTABLES) {
38+
for (const executable of VIRTUAL_ENV_EXECUTABLES) {
3939
if (await entry.getFile(executable).exists()) {
4040
return path
4141
}
4242
}
4343
} else {
44-
for (let dir_name of VIRTUAL_ENV_BIN_DIRS) {
45-
for (let executable of VIRTUAL_ENV_EXECUTABLES) {
44+
for (const dir_name of VIRTUAL_ENV_BIN_DIRS) {
45+
for (const executable of VIRTUAL_ENV_EXECUTABLES) {
4646
if (await entry.getSubdirectory(dir_name).getFile(executable).exists()) {
4747
return entry.getPath()
4848
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
"babel": "npm run clean && shx cp -r lib dist && cross-env NODE_ENV=production cross-env BABEL_KEEP_MODULES=false babel dist --out-dir dist",
3838
"copy": "shx cp -r lib/debugger/VendorLib dist/debugger",
3939
"build": "npm run babel",
40-
"build-commit": "build-commit -o dist",
41-
"prepare": "npm run build"
40+
"build-commit": "build-commit -o dist"
4241
},
4342
"package-deps": [
4443
"atom-ide-base"
@@ -80,6 +79,7 @@
8079
"babel-preset-atomic": "^4.2.0",
8180
"build-commit": "0.1.4",
8281
"cross-env": "^7.0.3",
82+
"eslint-config-atomic": "^1.16.2",
8383
"mock-spawn": "0.2.6",
8484
"prettier-config-atomic": "^2.0.5",
8585
"shx": "^0.3.3"

0 commit comments

Comments
 (0)