Skip to content

Commit 1373201

Browse files
Added oxlint and oxformat tooling (#133)
* Added oxlint and oxformat tooling * Added eol to codeowners * Update launch configuration
1 parent 8dc1bfc commit 1373201

15 files changed

Lines changed: 873 additions & 1151 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @cursorless-dev/code-owners
1+
* @cursorless-dev/code-owners

.oxfmtrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"sortPackageJson": false,
5+
"sortImports": {
6+
"newlinesBetween": false,
7+
"partitionByNewline": true
8+
}
9+
}

.vscode/launch.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// A launch configuration that compiles the extension and then opens it inside a new window
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
51
{
62
"version": "0.2.0",
73
"configurations": [
@@ -12,7 +8,7 @@
128
"runtimeExecutable": "${execPath}",
139
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
1410
"outFiles": ["${workspaceFolder}/out/**/*.js"],
15-
"preLaunchTask": "npm: compile"
11+
"preLaunchTask": "${defaultBuildTask}"
1612
}
1713
]
1814
}

.vscode/settings.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
// Place your settings in this file to overwrite default and user settings.
21
{
3-
"files.exclude": {
4-
"out": false // set this to true to hide the "out" folder with the compiled JS files
5-
},
6-
"search.exclude": {
7-
"out": true // set this to false to include "out" folder in search results
8-
},
9-
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10-
"typescript.tsc.autoDetect": "off",
11-
"cSpell.words": ["wasm"]
2+
"editor.defaultFormatter": "oxc.oxc-vscode",
3+
"oxc.configPath": "./oxlint.config.mts"
124
}

.vscode/tasks.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
// See https://go.microsoft.com/fwlink/?LinkId=733558
2-
// for the documentation about the tasks.json format
31
{
42
"version": "2.0.0",
53
"tasks": [
64
{
5+
"label": "Build",
76
"type": "npm",
8-
"script": "watch",
9-
"problemMatcher": "$tsc-watch",
10-
"isBackground": true,
11-
"presentation": {
12-
"reveal": "never"
13-
},
7+
"script": "build",
148
"group": {
159
"kind": "build",
1610
"isDefault": true
11+
},
12+
"presentation": {
13+
"reveal": "silent"
1714
}
1815
}
1916
]

eslint.config.ts

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

oxlint.config.mts

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import { defineConfig } from "oxlint";
2+
3+
const disabledRules = [
4+
"eslint/arrow-body-style",
5+
"eslint/capitalized-comments",
6+
"eslint/complexity",
7+
"eslint/id-length",
8+
"eslint/init-declarations",
9+
"eslint/max-classes-per-file",
10+
"eslint/max-lines-per-function",
11+
"eslint/max-lines",
12+
"eslint/max-params",
13+
"eslint/max-statements",
14+
"eslint/no-console",
15+
"eslint/no-continue",
16+
"eslint/no-eq-null",
17+
"eslint/no-magic-numbers",
18+
"eslint/no-negated-condition",
19+
"eslint/no-plusplus",
20+
"eslint/no-ternary",
21+
"eslint/no-undefined",
22+
"eslint/no-use-before-define",
23+
"eslint/no-void",
24+
"eslint/prefer-destructuring",
25+
"eslint/sort-imports",
26+
"eslint/sort-keys",
27+
"func-style",
28+
"import/exports-last",
29+
"import/group-exports",
30+
"import/max-dependencies",
31+
"import/no-named-export",
32+
"import/no-namespace",
33+
"import/no-nodejs-modules",
34+
"import/no-relative-parent-imports",
35+
"import/prefer-default-export",
36+
"oxc/no-async-await",
37+
"oxc/no-optional-chaining",
38+
"oxc/no-rest-spread-properties",
39+
"promise/prefer-await-to-callbacks",
40+
"typescript/explicit-function-return-type",
41+
"typescript/parameter-properties",
42+
"typescript/prefer-readonly-parameter-types",
43+
"typescript/promise-function-async",
44+
"typescript/strict-void-return",
45+
"unicorn/filename-case",
46+
"unicorn/no-array-for-each",
47+
"unicorn/no-lonely-if",
48+
"unicorn/no-null",
49+
"unicorn/prefer-at",
50+
"unicorn/prefer-spread",
51+
"unicorn/switch-case-braces",
52+
];
53+
54+
// oxlint-disable-next-line import/no-default-export
55+
export default defineConfig({
56+
ignorePatterns: ["src/typings"],
57+
options: {
58+
typeAware: true,
59+
typeCheck: true,
60+
},
61+
env: {
62+
node: true,
63+
},
64+
plugins: [
65+
"eslint",
66+
"typescript",
67+
"unicorn",
68+
"oxc",
69+
"import",
70+
"node",
71+
"promise",
72+
],
73+
categories: {
74+
correctness: "warn",
75+
suspicious: "warn",
76+
pedantic: "warn",
77+
perf: "warn",
78+
style: "warn",
79+
restriction: "warn",
80+
nursery: "warn",
81+
},
82+
83+
rules: {
84+
...Object.fromEntries(disabledRules.map((r) => [r, "off"])),
85+
"eslint/no-duplicate-imports": [
86+
"warn",
87+
{
88+
allowSeparateTypeImports: true,
89+
},
90+
],
91+
"eslint/no-restricted-imports": [
92+
"warn",
93+
{
94+
paths: [
95+
{
96+
name: "node:assert",
97+
message: "Use node:assert/strict instead",
98+
},
99+
],
100+
},
101+
],
102+
"eslint/no-unused-vars": [
103+
"warn",
104+
{
105+
argsIgnorePattern: "^_",
106+
destructuredArrayIgnorePattern: "^_",
107+
},
108+
],
109+
"typescript/strict-boolean-expressions": [
110+
"warn",
111+
{
112+
allowNullableBoolean: true,
113+
},
114+
],
115+
eqeqeq: [
116+
"warn",
117+
"always",
118+
{
119+
null: "never",
120+
},
121+
],
122+
},
123+
});

0 commit comments

Comments
 (0)