oxlint-tui 1.0.0 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/tui.js +7 -2
package/README.md CHANGED
@@ -4,7 +4,7 @@ A lightweight, dependency-free Node.js Terminal User Interface (TUI) for browsin
4
4
 
5
5
  It automatically loads your local configuration to show you the status of the rules toggled in your project.
6
6
 
7
- ![screenshot](screenshot.png)
7
+ ![screenshot](https://raw.githubusercontent.com/holoflash/oxlint-config-ui/refs/heads/main/screenshot.png)
8
8
 
9
9
  ## Why?
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-tui",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A Node TUI Oxlint rules and configuration browser",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,4 +24,4 @@
24
24
  "engines": {
25
25
  "node": ">=16"
26
26
  }
27
- }
27
+ }
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
- config = JSON.parse(configFile);
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;