@atlisp/lint 0.1.8 → 0.1.9

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.
@@ -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/index.js CHANGED
@@ -290,10 +290,11 @@ async function main() {
290
290
  }
291
291
  // --format-code mode: format files in place
292
292
  if (opts.formatCode || opts.formatCheck) {
293
+ const indentSize = config.line_length.tab_width;
293
294
  let needsFormat = false;
294
295
  for (const f of files) {
295
296
  const content = fs.readFileSync(f, 'utf-8');
296
- const formatted = (0, formatter_1.formatCode)(content);
297
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
297
298
  if (content !== formatted) {
298
299
  if (opts.formatCheck) {
299
300
  console.log(`${path.relative(rootDir, f)} — needs formatting`);
@@ -306,7 +307,7 @@ async function main() {
306
307
  }
307
308
  // Idempotency check: format again to verify stability
308
309
  if (!opts.formatCheck) {
309
- const reFormatted = (0, formatter_1.formatCode)(fs.readFileSync(f, 'utf-8'));
310
+ const reFormatted = (0, formatter_1.formatCode)(fs.readFileSync(f, 'utf-8'), indentSize);
310
311
  if (reFormatted !== fs.readFileSync(f, 'utf-8')) {
311
312
  console.log(`${(0, locale_1.t)('summary.tag_warn')}: ${path.relative(rootDir, f)} — ${(0, locale_1.t)('index.format_unstable')}`);
312
313
  }
@@ -331,10 +332,11 @@ async function main() {
331
332
  }
332
333
  // format_indent fix for non-staged mode (no lint results available yet)
333
334
  if (config.checks['format_indent'] !== 'off') {
335
+ const indentSize = config.line_length.tab_width;
334
336
  for (const f of files) {
335
337
  try {
336
338
  const content = fs.readFileSync(f, 'utf-8');
337
- const formatted = (0, formatter_1.formatCode)(content);
339
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
338
340
  if (formatted !== content) {
339
341
  fs.writeFileSync(f, formatted, 'utf-8');
340
342
  console.log(`${(0, locale_1.t)('summary.tag_fail')}: ${path.relative(rootDir, f)} — ${(0, locale_1.t)('index.fixed', 'format_indent')}`);
@@ -402,13 +404,14 @@ async function main() {
402
404
  }
403
405
  // format_indent fix: apply formatCode to files with format_indent issues
404
406
  if (config.checks['format_indent'] !== 'off') {
407
+ const indentSize = config.line_length.tab_width;
405
408
  for (const f of filesToLint) {
406
409
  const relPath = path.relative(rootDir, f);
407
410
  const hasFormatIssue = issues.some(i => i.file === relPath && i.rule === 'format_indent');
408
411
  if (hasFormatIssue) {
409
412
  try {
410
413
  const content = fs.readFileSync(f, 'utf-8');
411
- const formatted = (0, formatter_1.formatCode)(content);
414
+ const formatted = (0, formatter_1.formatCode)(content, indentSize);
412
415
  if (formatted !== content) {
413
416
  fs.writeFileSync(f, formatted, 'utf-8');
414
417
  console.log(`${(0, locale_1.t)('summary.tag_fail')}: ${relPath} — ${(0, locale_1.t)('index.fixed', 'format_indent')}`);
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.9",
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
  },