Skip to content

Commit 5f7db1e

Browse files
authored
chore: add oxlint (#126)
1 parent 7b5f27f commit 5f7db1e

7 files changed

Lines changed: 252 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ jobs:
3434

3535
- name: Check formatting
3636
run: pnpm format --check
37+
38+
- name: Check linting
39+
run: pnpm oxlint

.oxlintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["eslint", "node", "oxc"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "error"
7+
},
8+
"env": {
9+
"builtin": true,
10+
"es2018": true,
11+
"node": true,
12+
"commonjs": true
13+
},
14+
"rules": {
15+
"no-case-declarations": "error",
16+
"no-empty": "error",
17+
"no-fallthrough": "error",
18+
"no-prototype-builtins": "error",
19+
"no-redeclare": "error",
20+
"no-regex-spaces": "error",
21+
"no-unused-vars": [
22+
"error",
23+
{
24+
"caughtErrorsIgnorePattern": "^ignore"
25+
}
26+
]
27+
}
28+
}

eslint.config.mjs

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"scripts": {
44
"test": "pnpm -r test",
55
"release": "bumpp",
6-
"lint": "eslint packages --fix",
6+
"lint": "oxlint --fix",
77
"format": "oxfmt"
88
},
99
"devDependencies": {
@@ -13,14 +13,15 @@
1313
"globals": "^16.3.0",
1414
"lint-staged": "^6.1.1",
1515
"oxfmt": "^0.52.0",
16+
"oxlint": "^1.67.0",
1617
"yorkie": "^1.0.3"
1718
},
1819
"lint-staged": {
1920
"*": [
2021
"oxfmt --no-error-on-unmatched-pattern"
2122
],
2223
"*.js": [
23-
"eslint --fix",
24+
"oxlint --fix",
2425
"git add"
2526
]
2627
},

packages/launch-editor/get-args.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function getArgumentsForPosition(editor, fileName, lineNumber,
2121
return [`+call cursor(${lineNumber}, ${columnNumber})`, fileName]
2222
case 'joe':
2323
case 'gvim':
24-
return ['+' + `${lineNumber}`, fileName]
24+
return [`+${lineNumber}`, fileName]
2525
case 'emacs':
2626
case 'emacsclient':
2727
return [`+${lineNumber}:${columnNumber}`, fileName]

packages/launch-editor/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function parseFile(file) {
6060
}
6161
}
6262

63-
let _childProcess = null
63+
let currentChildProcess = null
6464

6565
function launchEditor(file, specifiedEditor, onErrorCallback) {
6666
const parsed = parseFile(file)
@@ -105,11 +105,11 @@ function launchEditor(file, specifiedEditor, onErrorCallback) {
105105
args.push(fileName)
106106
}
107107

108-
if (_childProcess && isTerminalEditor(editor)) {
108+
if (currentChildProcess && isTerminalEditor(editor)) {
109109
// There's an existing editor process already and it's attached
110110
// to the terminal, so go kill it. Otherwise two separate editor
111111
// instances attach to the stdin/stdout which gets confusing.
112-
_childProcess.kill('SIGKILL')
112+
currentChildProcess.kill('SIGKILL')
113113
}
114114

115115
if (process.platform === 'win32') {
@@ -156,22 +156,22 @@ function launchEditor(file, specifiedEditor, onErrorCallback) {
156156
}
157157
const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(' ')
158158

159-
_childProcess = childProcess.exec(launchCommand, {
159+
currentChildProcess = childProcess.exec(launchCommand, {
160160
stdio: 'inherit',
161161
shell: true,
162162
})
163163
} else {
164-
_childProcess = childProcess.spawn(editor, args, { stdio: 'inherit' })
164+
currentChildProcess = childProcess.spawn(editor, args, { stdio: 'inherit' })
165165
}
166-
_childProcess.on('exit', function (errorCode) {
167-
_childProcess = null
166+
currentChildProcess.on('exit', function (errorCode) {
167+
currentChildProcess = null
168168

169169
if (errorCode) {
170170
onErrorCallback(fileName, '(code ' + errorCode + ')')
171171
}
172172
})
173173

174-
_childProcess.on('error', function (error) {
174+
currentChildProcess.on('error', function (error) {
175175
let { code, message } = error
176176
if ('ENOENT' === code) {
177177
message = `${message} ('${editor}' command does not exist in 'PATH')`

pnpm-lock.yaml

Lines changed: 209 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)