@atlisp/lint 0.1.8 → 0.1.10

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.
@@ -9,7 +9,7 @@
9
9
  "encoding": "error",
10
10
  "cl_syntax": "warn",
11
11
  "quit_exit": "error",
12
- "command_shell": "error",
12
+ "command_shell": "warn",
13
13
  "startapp": "warn",
14
14
  "vl_registry_write": "warn",
15
15
  "vlax_without_loading": "warn",
@@ -95,7 +95,7 @@
95
95
  "dangerous_calls": {
96
96
  "quit": "error",
97
97
  "exit": "error",
98
- "command_shell": "error",
98
+ "command_shell": "warn",
99
99
  "startapp": "warn",
100
100
  "vl_registry_write": "warn"
101
101
  },
@@ -1,3 +1,3 @@
1
1
  import { Issue } from '../types';
2
- export declare function checkFormatIndent(content: string, file: string): Issue[];
2
+ export declare function checkFormatIndent(content: string, file: string, indentSize?: number): Issue[];
3
3
  //# sourceMappingURL=format-indent.d.ts.map
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkFormatIndent = checkFormatIndent;
4
4
  const formatter_1 = require("../formatter");
5
- function checkFormatIndent(content, file) {
6
- const formatted = (0, formatter_1.formatCode)(content);
5
+ function checkFormatIndent(content, file, indentSize = 2) {
6
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
7
7
  if (content === formatted)
8
8
  return [];
9
9
  // Find first line that differs for better error location
package/dist/config.js CHANGED
@@ -51,7 +51,7 @@ const DEFAULT_CONFIG = {
51
51
  encoding: 'error',
52
52
  cl_syntax: 'warn',
53
53
  quit_exit: 'error',
54
- command_shell: 'error',
54
+ command_shell: 'warn',
55
55
  startapp: 'warn',
56
56
  vl_registry_write: 'warn',
57
57
  vlax_without_loading: 'warn',
@@ -137,7 +137,7 @@ const DEFAULT_CONFIG = {
137
137
  dangerous_calls: {
138
138
  quit: 'error',
139
139
  exit: 'error',
140
- command_shell: 'error',
140
+ command_shell: 'warn',
141
141
  startapp: 'warn',
142
142
  vl_registry_write: 'warn',
143
143
  },
package/dist/index.js CHANGED
@@ -164,10 +164,11 @@ function* walkFiles(dir, rootDir, regex) {
164
164
  function globFiles(pattern, rootDir) {
165
165
  const regexStr = pattern
166
166
  .replace(/\./g, '\\.')
167
- .replace(/\*\*\//g, '(.*/)?')
167
+ .replace(/\*\*\//g, '\x00GLOB\x00')
168
168
  .replace(/\*\*/g, '.*')
169
169
  .replace(/\*/g, '[^/]*')
170
- .replace(/\?/g, '.');
170
+ .replace(/\?/g, '.')
171
+ .replace(/\x00GLOB\x00/g, '(.*/)?');
171
172
  const regex = new RegExp(`^${regexStr}$`);
172
173
  return Array.from(walkFiles(rootDir, rootDir, regex));
173
174
  }
@@ -195,7 +196,11 @@ function collectFiles(rootDir, opts, config) {
195
196
  }
196
197
  }
197
198
  const excludePatterns = config.source.exclude.map(e => {
198
- const str = e.replace(/\./g, '\\.').replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*');
199
+ const str = e
200
+ .replace(/\./g, '\\.')
201
+ .replace(/\*\*/g, '\x00STAR\x00')
202
+ .replace(/\*/g, '[^/]*')
203
+ .replace(/\x00STAR\x00/g, '.*');
199
204
  return new RegExp(`^${str}$`);
200
205
  });
201
206
  return Array.from(files)
@@ -290,10 +295,11 @@ async function main() {
290
295
  }
291
296
  // --format-code mode: format files in place
292
297
  if (opts.formatCode || opts.formatCheck) {
298
+ const indentSize = config.line_length.tab_width;
293
299
  let needsFormat = false;
294
300
  for (const f of files) {
295
301
  const content = fs.readFileSync(f, 'utf-8');
296
- const formatted = (0, formatter_1.formatCode)(content);
302
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
297
303
  if (content !== formatted) {
298
304
  if (opts.formatCheck) {
299
305
  console.log(`${path.relative(rootDir, f)} — needs formatting`);
@@ -306,7 +312,7 @@ async function main() {
306
312
  }
307
313
  // Idempotency check: format again to verify stability
308
314
  if (!opts.formatCheck) {
309
- const reFormatted = (0, formatter_1.formatCode)(fs.readFileSync(f, 'utf-8'));
315
+ const reFormatted = (0, formatter_1.formatCode)(fs.readFileSync(f, 'utf-8'), indentSize);
310
316
  if (reFormatted !== fs.readFileSync(f, 'utf-8')) {
311
317
  console.log(`${(0, locale_1.t)('summary.tag_warn')}: ${path.relative(rootDir, f)} — ${(0, locale_1.t)('index.format_unstable')}`);
312
318
  }
@@ -331,10 +337,11 @@ async function main() {
331
337
  }
332
338
  // format_indent fix for non-staged mode (no lint results available yet)
333
339
  if (config.checks['format_indent'] !== 'off') {
340
+ const indentSize = config.line_length.tab_width;
334
341
  for (const f of files) {
335
342
  try {
336
343
  const content = fs.readFileSync(f, 'utf-8');
337
- const formatted = (0, formatter_1.formatCode)(content);
344
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
338
345
  if (formatted !== content) {
339
346
  fs.writeFileSync(f, formatted, 'utf-8');
340
347
  console.log(`${(0, locale_1.t)('summary.tag_fail')}: ${path.relative(rootDir, f)} — ${(0, locale_1.t)('index.fixed', 'format_indent')}`);
@@ -402,13 +409,14 @@ async function main() {
402
409
  }
403
410
  // format_indent fix: apply formatCode to files with format_indent issues
404
411
  if (config.checks['format_indent'] !== 'off') {
412
+ const indentSize = config.line_length.tab_width;
405
413
  for (const f of filesToLint) {
406
414
  const relPath = path.relative(rootDir, f);
407
415
  const hasFormatIssue = issues.some(i => i.file === relPath && i.rule === 'format_indent');
408
416
  if (hasFormatIssue) {
409
417
  try {
410
418
  const content = fs.readFileSync(f, 'utf-8');
411
- const formatted = (0, formatter_1.formatCode)(content);
419
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
412
420
  if (formatted !== content) {
413
421
  fs.writeFileSync(f, formatted, 'utf-8');
414
422
  console.log(`${(0, locale_1.t)('summary.tag_fail')}: ${relPath} — ${(0, locale_1.t)('index.fixed', 'format_indent')}`);
package/dist/presets.js CHANGED
@@ -8,7 +8,7 @@ exports.PRESETS = {
8
8
  encoding: 'error',
9
9
  cl_syntax: 'warn',
10
10
  quit_exit: 'error',
11
- command_shell: 'error',
11
+ command_shell: 'warn',
12
12
  startapp: 'warn',
13
13
  vl_registry_write: 'warn',
14
14
  token_in_url: 'warn',
@@ -74,7 +74,7 @@ exports.PRESETS = {
74
74
  encoding: 'error',
75
75
  cl_syntax: 'error',
76
76
  quit_exit: 'error',
77
- command_shell: 'error',
77
+ command_shell: 'warn',
78
78
  startapp: 'error',
79
79
  vl_registry_write: 'error',
80
80
  vlax_without_loading: 'error',
@@ -152,7 +152,7 @@ exports.PRESETS = {
152
152
  parens: 'error',
153
153
  encoding: 'error',
154
154
  quit_exit: 'error',
155
- command_shell: 'error',
155
+ command_shell: 'warn',
156
156
  },
157
157
  },
158
158
  };
package/dist/runner.js CHANGED
@@ -235,7 +235,7 @@ function runChecks(content, file, config) {
235
235
  addIfEnabled('loop_optimization', () => (0, loop_optimization_1.checkLoopOptimization)(content, file));
236
236
  addIfEnabled('type_check', () => (0, type_check_1.checkTypeCheck)(content, file));
237
237
  addIfEnabled('redundant_if', () => (0, redundant_if_1.checkRedundantIf)(content, file));
238
- addIfEnabled('format_indent', () => (0, format_indent_1.checkFormatIndent)(content, file));
238
+ addIfEnabled('format_indent', () => (0, format_indent_1.checkFormatIndent)(content, file, config.line_length.tab_width));
239
239
  return issues;
240
240
  }
241
241
  /** Single-pass visitor-based runChecks using AstVisitor */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlisp/lint",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "AutoLISP static analysis tool — parens, security, conventions, SBCL syntax validation",
5
5
  "keywords": [
6
6
  "CAD",
@@ -31,8 +31,8 @@
31
31
  "test:watch": "jest --watch",
32
32
  "lint": "eslint src",
33
33
  "typecheck": "tsc --noEmit",
34
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
35
- "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
34
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"*.json\" \"!stub-packages.json\"",
35
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" \"*.json\" \"!stub-packages.json\"",
36
36
  "prepublishOnly": "npm run build",
37
37
  "prepack": "npm run build"
38
38
  },