@atlisp/lint 0.2.16 → 0.2.18

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 (80) hide show
  1. package/README.md +1 -1
  2. package/atlisp-lint.default.json +1 -1
  3. package/dist/checks/arg-count.d.ts +2 -1
  4. package/dist/checks/arg-count.js +37 -19
  5. package/dist/checks/builtin-arg-count.d.ts +2 -1
  6. package/dist/checks/builtin-arg-count.js +3 -2
  7. package/dist/checks/cond-duplicate.js +5 -6
  8. package/dist/checks/constant-condition.js +9 -9
  9. package/dist/checks/dangerous-calls.js +1 -1
  10. package/dist/checks/dangling-defun.d.ts +0 -7
  11. package/dist/checks/dangling-defun.js +0 -63
  12. package/dist/checks/double-not.js +1 -1
  13. package/dist/checks/empty-branch.js +1 -1
  14. package/dist/checks/empty-catch.d.ts +2 -1
  15. package/dist/checks/empty-catch.js +8 -7
  16. package/dist/checks/function-complexity.js +5 -18
  17. package/dist/checks/global-naming.js +1 -1
  18. package/dist/checks/identical-branches.js +3 -3
  19. package/dist/checks/if-without-else.js +1 -1
  20. package/dist/checks/misplaced-else.js +2 -2
  21. package/dist/checks/missing-export.js +3 -3
  22. package/dist/checks/missing-princ.js +1 -1
  23. package/dist/checks/multiple-setq.js +1 -1
  24. package/dist/checks/no-return.d.ts +2 -1
  25. package/dist/checks/no-return.js +4 -3
  26. package/dist/checks/nth-usage.js +1 -1
  27. package/dist/checks/parameter-naming.js +2 -2
  28. package/dist/checks/quote-vs-function.js +1 -1
  29. package/dist/checks/recursive-call.js +1 -1
  30. package/dist/checks/redundant-let.js +1 -1
  31. package/dist/checks/redundant-nil-else.js +1 -1
  32. package/dist/checks/redundant-progn.js +1 -1
  33. package/dist/checks/redundant-setq.js +1 -1
  34. package/dist/checks/self-compare.js +1 -1
  35. package/dist/checks/setq-single-arg.js +3 -2
  36. package/dist/checks/single-arg-and-or.js +1 -1
  37. package/dist/checks/undeclared-setq.d.ts +2 -1
  38. package/dist/checks/undeclared-setq.js +6 -5
  39. package/dist/checks/unused-let.js +3 -3
  40. package/dist/checks/unused-local-fun.js +2 -2
  41. package/dist/checks/unused-package-dep.d.ts +0 -1
  42. package/dist/checks/unused-package-dep.js +6 -93
  43. package/dist/checks/unused-param.js +2 -2
  44. package/dist/checks/unused-variable.js +2 -2
  45. package/dist/checks/variable-shadow.js +3 -3
  46. package/dist/checks/while-constant.js +1 -1
  47. package/dist/cli/collector.js +26 -19
  48. package/dist/config.d.ts +1 -1
  49. package/dist/config.js +18 -9
  50. package/dist/fixes/index.d.ts +4 -0
  51. package/dist/fixes/index.js +843 -140
  52. package/dist/formatter.d.ts +0 -1
  53. package/dist/formatter.js +141 -31
  54. package/dist/index.js +59 -51
  55. package/dist/project.d.ts +1 -1
  56. package/dist/project.js +98 -112
  57. package/dist/runner.d.ts +1 -1
  58. package/dist/runner.js +17 -8
  59. package/dist/utils.js +21 -30
  60. package/dist/validate.js +3 -3
  61. package/dist/visitor-runner.d.ts +0 -28
  62. package/dist/visitor-runner.js +3 -809
  63. package/dist/visitors/equal-nil.d.ts +2 -2
  64. package/dist/visitors/equal-nil.js +5 -4
  65. package/dist/visitors/index.d.ts +1 -1
  66. package/dist/visitors/progn-in-cond.d.ts +2 -2
  67. package/dist/visitors/progn-in-cond.js +5 -4
  68. package/dist/visitors/redundant-and-or.d.ts +2 -2
  69. package/dist/visitors/redundant-and-or.js +3 -3
  70. package/dist/visitors/redundant-car-cdr.d.ts +2 -2
  71. package/dist/visitors/redundant-car-cdr.js +3 -3
  72. package/dist/visitors/register.d.ts +6 -0
  73. package/dist/visitors/register.js +625 -0
  74. package/dist/visitors/shared.d.ts +40 -0
  75. package/dist/visitors/shared.js +129 -0
  76. package/dist/visitors/types.d.ts +2 -7
  77. package/dist/visitors/types.js +0 -69
  78. package/dist/watch.js +33 -12
  79. package/dist/worker.js +1 -1
  80. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  import { AstVisitor } from '@atlisp/parser';
2
- import { CollectState } from '../visitor-runner';
2
+ import { CollectState } from './shared';
3
3
  import { AddIssueFn } from './types';
4
4
  export declare const equalNilModule: {
5
5
  name: string;
6
- register(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
6
+ register(visitor: AstVisitor, _state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
7
7
  };
8
8
  //# sourceMappingURL=equal-nil.d.ts.map
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.equalNilModule = void 0;
4
- const types_1 = require("./types");
4
+ const parser_1 = require("@atlisp/parser");
5
+ const shared_1 = require("./shared");
5
6
  exports.equalNilModule = {
6
7
  name: 'equal_nil',
7
- register(visitor, state, checks, addIssue) {
8
+ register(visitor, _state, checks, addIssue) {
8
9
  if (checks['equal_nil'] === 'off')
9
10
  return;
10
11
  const checkEqualNil = (node) => {
11
- if (!node.children || node.children.length < 3)
12
+ if (!(0, parser_1.astIsList)(node) || node.children.length < 3)
12
13
  return;
13
- if ((0, types_1.isInQuote)(node))
14
+ if ((0, shared_1.isInQuote)(node))
14
15
  return;
15
16
  const a = node.children[1];
16
17
  const b = node.children[2];
@@ -1,5 +1,5 @@
1
1
  import { AstVisitor } from '@atlisp/parser';
2
- import { CollectState } from '../visitor-runner';
2
+ import { CollectState } from './shared';
3
3
  import { AddIssueFn } from './types';
4
4
  export declare function registerAll(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { AstVisitor } from '@atlisp/parser';
2
- import { CollectState } from '../visitor-runner';
2
+ import { CollectState } from './shared';
3
3
  import { AddIssueFn } from './types';
4
4
  export declare const prognInCondModule: {
5
5
  name: string;
6
- register(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
6
+ register(visitor: AstVisitor, _state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
7
7
  };
8
8
  //# sourceMappingURL=progn-in-cond.d.ts.map
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prognInCondModule = void 0;
4
- const types_1 = require("./types");
4
+ const parser_1 = require("@atlisp/parser");
5
+ const shared_1 = require("./shared");
5
6
  exports.prognInCondModule = {
6
7
  name: 'progn_in_cond',
7
- register(visitor, state, checks, addIssue) {
8
+ register(visitor, _state, checks, addIssue) {
8
9
  if (checks['progn_in_cond'] === 'off')
9
10
  return;
10
11
  visitor.on('cond', (node) => {
11
- if (!node.children)
12
+ if (!(0, parser_1.astIsList)(node))
12
13
  return;
13
14
  for (let i = 1; i < node.children.length; i++) {
14
15
  const clause = node.children[i];
@@ -21,7 +22,7 @@ exports.prognInCondModule = {
21
22
  form.children.length > 0 &&
22
23
  form.children[0].type === 'symbol' &&
23
24
  form.children[0].name === 'progn') {
24
- if ((0, types_1.isInQuote)(form))
25
+ if ((0, shared_1.isInQuote)(form))
25
26
  continue;
26
27
  addIssue('progn_in_cond', form.pos.line, 'cond clause with progn — cond already allows multiple forms');
27
28
  }
@@ -1,8 +1,8 @@
1
1
  import { AstVisitor } from '@atlisp/parser';
2
- import { CollectState } from '../visitor-runner';
2
+ import { CollectState } from './shared';
3
3
  import { AddIssueFn } from './types';
4
4
  export declare const redundantAndOrModule: {
5
5
  name: string;
6
- register(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
6
+ register(visitor: AstVisitor, _state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
7
7
  };
8
8
  //# sourceMappingURL=redundant-and-or.d.ts.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.redundantAndOrModule = void 0;
4
- const types_1 = require("./types");
4
+ const shared_1 = require("./shared");
5
5
  exports.redundantAndOrModule = {
6
6
  name: 'redundant_and_or',
7
- register(visitor, state, checks, addIssue) {
7
+ register(visitor, _state, checks, addIssue) {
8
8
  if (checks['redundant_and_or'] === 'off')
9
9
  return;
10
10
  visitor.on('*', (node) => {
@@ -13,7 +13,7 @@ exports.redundantAndOrModule = {
13
13
  const fn = node.children[0];
14
14
  if (fn.type !== 'symbol')
15
15
  return;
16
- if ((0, types_1.isInQuote)(node))
16
+ if ((0, shared_1.isInQuote)(node))
17
17
  return;
18
18
  if (fn.name === 'and') {
19
19
  addIssue('redundant_and_or', node.pos.line, '(and) always returns T — may be leftover code');
@@ -1,8 +1,8 @@
1
1
  import { AstVisitor } from '@atlisp/parser';
2
- import { CollectState } from '../visitor-runner';
2
+ import { CollectState } from './shared';
3
3
  import { AddIssueFn } from './types';
4
4
  export declare const redundantCarCdrModule: {
5
5
  name: string;
6
- register(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
6
+ register(visitor: AstVisitor, _state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn): void;
7
7
  };
8
8
  //# sourceMappingURL=redundant-car-cdr.d.ts.map
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.redundantCarCdrModule = void 0;
4
- const types_1 = require("./types");
4
+ const shared_1 = require("./shared");
5
5
  const CAR_CDR_MAP = {
6
6
  car: { car: 'caar', cdr: 'cadr' },
7
7
  cdr: { car: 'cdar', cdr: 'cddr' },
8
8
  };
9
9
  exports.redundantCarCdrModule = {
10
10
  name: 'redundant_car_cdr',
11
- register(visitor, state, checks, addIssue) {
11
+ register(visitor, _state, checks, addIssue) {
12
12
  if (checks['redundant_car_cdr'] === 'off')
13
13
  return;
14
14
  visitor.on('*', (node) => {
@@ -26,7 +26,7 @@ exports.redundantCarCdrModule = {
26
26
  const replacement = CAR_CDR_MAP[outer.name]?.[innerFn.name];
27
27
  if (!replacement)
28
28
  return;
29
- if ((0, types_1.isInQuote)(node))
29
+ if ((0, shared_1.isInQuote)(node))
30
30
  return;
31
31
  addIssue('redundant_car_cdr', node.pos.line, `(${outer.name} (${innerFn.name} x)) → (${replacement} x)`);
32
32
  });
@@ -0,0 +1,6 @@
1
+ import { AstVisitor } from '@atlisp/parser';
2
+ import { LintConfig } from '../types';
3
+ import { CollectState } from './shared';
4
+ import { AddIssueFn } from './types';
5
+ export declare function registerVisitorRules(visitor: AstVisitor, state: CollectState, checks: Record<string, string>, addIssue: AddIssueFn, config: LintConfig, file: string): void;
6
+ //# sourceMappingURL=register.d.ts.map