oxlint-tui 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/package.json +1 -1
- package/tui.js +7 -2
package/README.md
CHANGED
|
@@ -17,9 +17,14 @@ Configuring linters often involves jumping between your editor, a massive JSON f
|
|
|
17
17
|
* **View Docs**: Press <kbd>ENTER</kbd> on any rule to open its official documentation in your browser.
|
|
18
18
|
* **Zero Dependencies**: Written in pure Node.js without any heavy TUI libraries.
|
|
19
19
|
|
|
20
|
+
## Important note
|
|
21
|
+
|
|
22
|
+
Documentation links and information about fixability are not available in older versions of oxlint.
|
|
23
|
+
This tool was developed using oxlint version 1.41.0.
|
|
24
|
+
|
|
20
25
|
## Usage
|
|
21
26
|
|
|
22
|
-
###
|
|
27
|
+
### Quick Start (via npx)
|
|
23
28
|
|
|
24
29
|
Run it directly in your project folder (where your `.oxlintrc.json` is located):
|
|
25
30
|
|
|
@@ -27,7 +32,7 @@ Run it directly in your project folder (where your `.oxlintrc.json` is located):
|
|
|
27
32
|
npx oxlint-tui
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
###
|
|
35
|
+
### Custom Config Path
|
|
31
36
|
|
|
32
37
|
If your configuration file is located elsewhere or named differently:
|
|
33
38
|
|
|
@@ -35,7 +40,7 @@ If your configuration file is located elsewhere or named differently:
|
|
|
35
40
|
npx oxlint-tui ./configs/oxlint.json
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
###
|
|
43
|
+
### Global Install
|
|
39
44
|
|
|
40
45
|
If you use oxlint frequently, you can install it globally:
|
|
41
46
|
|
package/package.json
CHANGED
package/tui.js
CHANGED
|
@@ -117,6 +117,10 @@ function getRuleStatus(ruleName, category, config) {
|
|
|
117
117
|
return 'off';
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
function stripJsonComments(json) {
|
|
121
|
+
return json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m);
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
function loadRules() {
|
|
121
125
|
let rulesData;
|
|
122
126
|
let config = { rules: {}, categories: {} };
|
|
@@ -145,7 +149,9 @@ function loadRules() {
|
|
|
145
149
|
if (configPathToLoad) {
|
|
146
150
|
try {
|
|
147
151
|
const configFile = fs.readFileSync(configPathToLoad, 'utf8');
|
|
148
|
-
|
|
152
|
+
const cleanConfig = stripJsonComments(configFile);
|
|
153
|
+
config = JSON.parse(cleanConfig);
|
|
154
|
+
|
|
149
155
|
} catch (e) {
|
|
150
156
|
console.error(`${COLORS.error}Error: Failed to parse '${configPathToLoad}'.${COLORS.reset}`);
|
|
151
157
|
console.error(`${COLORS.warn}${e.message}${COLORS.reset}`);
|
|
@@ -171,7 +177,6 @@ function loadRules() {
|
|
|
171
177
|
|
|
172
178
|
const categories = Object.keys(map).sort();
|
|
173
179
|
|
|
174
|
-
// Sort rules - active first, then Alphabetical
|
|
175
180
|
categories.forEach(c => {
|
|
176
181
|
map[c].sort((a, b) => {
|
|
177
182
|
if (a.isActive && !b.isActive) return -1;
|