hana-linter 1.0.3 → 1.2.0

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 (107) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +115 -12
  3. package/dist/assets/.hana-linter.json +72 -0
  4. package/dist/cli.d.ts +17 -0
  5. package/dist/config.d.ts +16 -0
  6. package/dist/content-lint.d.ts +10 -0
  7. package/dist/content-lint.js +14 -0
  8. package/dist/files.d.ts +12 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/lib.d.ts +13 -0
  11. package/dist/lib.js +17 -0
  12. package/dist/lint.d.ts +10 -0
  13. package/dist/parsers/hdbcalculationview/__tests__/extractCalculationViewOutputs.test.d.ts +1 -0
  14. package/dist/parsers/hdbcalculationview/__tests__/extractCalculationViewOutputs.test.js +305 -0
  15. package/dist/parsers/hdbcalculationview/extractor.d.ts +14 -0
  16. package/dist/parsers/hdbcalculationview/extractor.js +105 -0
  17. package/dist/parsers/hdbcalculationview/index.d.ts +20 -0
  18. package/dist/parsers/hdbcalculationview/index.js +25 -0
  19. package/dist/parsers/hdbfunction/__tests__/extractFunctionParameters.test.d.ts +1 -0
  20. package/dist/parsers/hdbfunction/__tests__/extractFunctionParameters.test.js +8 -7
  21. package/dist/parsers/hdbfunction/index.d.ts +23 -0
  22. package/dist/parsers/hdbfunction/lexer.d.ts +58 -0
  23. package/dist/parsers/hdbfunction/parser.d.ts +58 -0
  24. package/dist/parsers/hdbfunction/visitor.d.ts +37 -0
  25. package/dist/parsers/hdbfunction/visitor.js +5 -4
  26. package/dist/parsers/hdbprocedure/__tests__/extractProcedureParameters.test.d.ts +1 -0
  27. package/dist/parsers/hdbprocedure/__tests__/extractProcedureParameters.test.js +17 -15
  28. package/dist/parsers/hdbprocedure/index.d.ts +21 -0
  29. package/dist/parsers/hdbprocedure/lexer.d.ts +62 -0
  30. package/dist/parsers/hdbprocedure/parser.d.ts +51 -0
  31. package/dist/parsers/hdbprocedure/visitor.d.ts +33 -0
  32. package/dist/parsers/hdbprocedure/visitor.js +6 -5
  33. package/dist/parsers/hdbrole/__tests__/extractRoleNames.test.d.ts +1 -0
  34. package/dist/parsers/hdbrole/__tests__/extractRoleNames.test.js +336 -0
  35. package/dist/parsers/hdbrole/index.d.ts +19 -0
  36. package/dist/parsers/hdbrole/index.js +38 -0
  37. package/dist/parsers/hdbrole/lexer.d.ts +44 -0
  38. package/dist/parsers/hdbrole/lexer.js +151 -0
  39. package/dist/parsers/hdbrole/parser.d.ts +37 -0
  40. package/dist/parsers/hdbrole/parser.js +252 -0
  41. package/dist/parsers/hdbrole/visitor.d.ts +39 -0
  42. package/dist/parsers/hdbrole/visitor.js +143 -0
  43. package/dist/parsers/hdbtable/__tests__/extractTableColumns.test.d.ts +1 -0
  44. package/dist/parsers/hdbtable/__tests__/extractTableColumns.test.js +6 -6
  45. package/dist/parsers/hdbtable/index.d.ts +14 -0
  46. package/dist/parsers/hdbtable/lexer.d.ts +71 -0
  47. package/dist/parsers/hdbtable/parser.d.ts +51 -0
  48. package/dist/parsers/hdbtable/visitor.d.ts +26 -0
  49. package/dist/parsers/hdbtable/visitor.js +3 -2
  50. package/dist/parsers/hdbtabletype/__tests__/extractTableTypeColumns.test.d.ts +1 -0
  51. package/dist/parsers/hdbtabletype/__tests__/extractTableTypeColumns.test.js +235 -0
  52. package/dist/parsers/hdbtabletype/index.d.ts +18 -0
  53. package/dist/parsers/hdbtabletype/index.js +37 -0
  54. package/dist/parsers/hdbtabletype/lexer.d.ts +39 -0
  55. package/dist/parsers/hdbtabletype/lexer.js +149 -0
  56. package/dist/parsers/hdbtabletype/parser.d.ts +30 -0
  57. package/dist/parsers/hdbtabletype/parser.js +138 -0
  58. package/dist/parsers/hdbtabletype/visitor.d.ts +35 -0
  59. package/dist/parsers/hdbtabletype/visitor.js +66 -0
  60. package/dist/parsers/hdbview/__tests__/extractViewColumns.test.d.ts +1 -0
  61. package/dist/parsers/hdbview/__tests__/extractViewColumns.test.js +4 -4
  62. package/dist/parsers/hdbview/index.d.ts +16 -0
  63. package/dist/parsers/hdbview/lexer.d.ts +76 -0
  64. package/dist/parsers/hdbview/parser.d.ts +67 -0
  65. package/dist/parsers/hdbview/visitor.d.ts +39 -0
  66. package/dist/parsers/hdbview/visitor.js +1 -1
  67. package/dist/report.d.ts +9 -0
  68. package/dist/report.js +38 -7
  69. package/dist/types/cli.d.ts +20 -0
  70. package/dist/types/config.d.ts +19 -0
  71. package/dist/types/issues.d.ts +16 -0
  72. package/dist/types/rules.d.ts +131 -0
  73. package/docs/chevrotain-hdbcalculationview-parser/prd.md +323 -0
  74. package/docs/chevrotain-hdbcalculationview-parser/spec.md +770 -0
  75. package/docs/chevrotain-hdbrole-parser/prd.md +271 -0
  76. package/docs/chevrotain-hdbrole-parser/spec.md +897 -0
  77. package/docs/chevrotain-hdbtabletype-parser/prd.md +219 -0
  78. package/docs/chevrotain-hdbtabletype-parser/spec.md +764 -0
  79. package/package.json +5 -3
  80. package/src/assets/.hana-linter.json +72 -0
  81. package/src/content-lint.ts +17 -0
  82. package/src/lib.ts +15 -0
  83. package/src/parsers/hdbcalculationview/__tests__/extractCalculationViewOutputs.test.ts +348 -0
  84. package/src/parsers/hdbcalculationview/extractor.ts +160 -0
  85. package/src/parsers/hdbcalculationview/index.ts +24 -0
  86. package/src/parsers/hdbfunction/__tests__/extractFunctionParameters.test.ts +8 -7
  87. package/src/parsers/hdbfunction/visitor.ts +6 -5
  88. package/src/parsers/hdbprocedure/__tests__/extractProcedureParameters.test.ts +17 -15
  89. package/src/parsers/hdbprocedure/visitor.ts +7 -6
  90. package/src/parsers/hdbrole/__tests__/extractRoleNames.test.ts +387 -0
  91. package/src/parsers/hdbrole/index.ts +40 -0
  92. package/src/parsers/hdbrole/lexer.ts +166 -0
  93. package/src/parsers/hdbrole/parser.ts +312 -0
  94. package/src/parsers/hdbrole/visitor.ts +161 -0
  95. package/src/parsers/hdbtable/__tests__/extractTableColumns.test.ts +6 -6
  96. package/src/parsers/hdbtable/visitor.ts +3 -2
  97. package/src/parsers/hdbtabletype/__tests__/extractTableTypeColumns.test.ts +266 -0
  98. package/src/parsers/hdbtabletype/index.ts +39 -0
  99. package/src/parsers/hdbtabletype/lexer.ts +165 -0
  100. package/src/parsers/hdbtabletype/parser.ts +186 -0
  101. package/src/parsers/hdbtabletype/visitor.ts +74 -0
  102. package/src/parsers/hdbview/__tests__/extractViewColumns.test.ts +4 -4
  103. package/src/parsers/hdbview/visitor.ts +1 -1
  104. package/src/report.ts +40 -7
  105. package/src/types/issues.ts +3 -1
  106. package/src/types/rules.ts +1 -1
  107. package/tsconfig.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
+ ### 1.1.0
8
+
9
+ - Console output is now grouped by file, then by failed rule, reducing noise when multiple violations exist in the same file
10
+ - Added line numbers to content-lint violations (fields, input/output parameters) so users can jump directly to the offending identifier in their editor
11
+ - All four Chevrotain visitors (`hdbtable`, `hdbview`, `hdbprocedure`, `hdbfunction`) now capture `token.startLine` from the parsed token and propagate it through `ExtractedSubject` and `LintIssue`
12
+
13
+ ---
14
+
7
15
  ### 1.0.3
8
16
 
9
17
  - Fixed build: `src/assets/.hana-linter.json` is now correctly copied to `dist/assets/` during `pnpm build` via `copyfiles`, ensuring the default config template is bundled in the published package
package/README.md CHANGED
@@ -9,7 +9,7 @@ Naming-convention lint for SAP HANA artifacts in CAP projects.
9
9
 
10
10
  > **⚠️ Work in progress.** This project is under active development. APIs, configuration options, and supported artifact types may change between releases. See [Parser Status](#parser-status) for the current state of content extraction support.
11
11
 
12
- [NPM package](https://www.npmjs.com/package/hana-linter) • [Report issue](https://github.com/qualiture/hana-linter/issues) • [Releases](https://github.com/qualiture/hana-linter/releases)
12
+ [NPM package](https://www.npmjs.com/package/hana-linter) • [Report issue](https://github.com/qualiture/hana-linter/issues)
13
13
 
14
14
  Lint SAP HANA artifact file names and content identifiers in CAP projects using configurable regex-based naming rules.
15
15
 
@@ -40,7 +40,7 @@ Rule groups per extension:
40
40
 
41
41
  You can define `extension: "*"` as a shared rule set. Its rules are applied to every file extension and are merged with any extension-specific rule set.
42
42
 
43
- Content-based linting uses [Chevrotain](https://chevrotain.io)-powered lexers and CST parsers to reliably extract identifiers from HANA artifact files. This approach correctly handles block and line comments, multi-line definitions, quoted identifiers, and HANA-specific DDL constructs — without the false positives and false negatives that ad-hoc regex scanning produces.
43
+ Content-based linting uses purpose-built parsers to reliably extract identifiers from HANA artifact files. SQL DDL artifact types (`.hdbtable`, `.hdbview`, `.hdbprocedure`, `.hdbfunction`, `.hdbtabletype`, `.hdbrole`) use [Chevrotain](https://chevrotain.io)-powered lexers and CST parsers that correctly handle block and line comments, multi-line definitions, quoted identifiers, and HANA-specific DDL constructs. The XML-based `.hdbcalculationview` format uses [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) to navigate the logical model tree — without the false positives and false negatives that ad-hoc regex scanning produces.
44
44
 
45
45
  ## Parser Status
46
46
 
@@ -52,16 +52,17 @@ Content-based linting uses [Chevrotain](https://chevrotain.io)-powered lexers an
52
52
  | `.hdbview` | Chevrotain lexer + CST | ✅ Migrated |
53
53
  | `.hdbprocedure` | Chevrotain lexer + CST | ✅ Migrated |
54
54
  | `.hdbfunction` | Chevrotain lexer + CST | ✅ Migrated |
55
- | `.hdbtabletype` | — | Not yet implemented |
56
- | `.hdbcalculationview` | — | Not yet implemented |
55
+ | `.hdbtabletype` | Chevrotain lexer + CST | ✅ Migrated |
56
+ | `.hdbrole` | Chevrotain lexer + CST | ✅ Migrated |
57
+ | `.hdbcalculationview` | fast-xml-parser (XML) | ✅ Migrated |
57
58
  | `.hdbanalyticalprivilege` | — | ❌ Not yet implemented |
58
- | `.hdbrole` | — | ❌ Not yet implemented |
59
59
  | `.hdbsequence` | — | ❌ Not yet implemented |
60
60
  | `.hdbconstraint` | — | ❌ Not yet implemented |
61
61
  | `.hdbschedulerjob` | — | ❌ Not yet implemented |
62
62
  | `.hdbindex` | — | ❌ Not yet implemented |
63
63
  | `.hdbtrigger` | — | ❌ Not yet implemented |
64
64
 
65
+ - The regex **file name** validations for all of the above listed extensions **are implemented**. The **content extractor** hasn't been implemented everywhere yet.
65
66
  - **Not implemented**: `contentRuleSets` targeting these extensions will silently return no results — no identifiers are extracted and no content issues are raised.
66
67
 
67
68
  ## Install
@@ -177,13 +178,18 @@ Each `contentRuleSets` item contains:
177
178
 
178
179
  Supported extractors in this version:
179
180
 
180
- | `target` | Supported extensions | Extracted identifiers |
181
- | ----------------- | -------------------- | ---------------------------------------------- |
182
- | `field` | `.hdbtable` | Column names |
183
- | `field` | `.hdbview` | Column aliases (explicit list or `AS` aliases) |
184
- | `inputParameter` | `.hdbprocedure` | `IN` and `INOUT` parameters |
185
- | `inputParameter` | `.hdbfunction` | `IN` parameters (functions accept `IN` only) |
186
- | `outputParameter` | `.hdbprocedure` | `OUT` and `INOUT` parameters |
181
+ | `target` | Supported extensions | Extracted identifiers |
182
+ | ----------------- | --------------------- | ----------------------------------------------------------------------------- |
183
+ | `field` | `.hdbtable` | Column names |
184
+ | `field` | `.hdbview` | Column aliases (explicit list or `AS` aliases) |
185
+ | `field` | `.hdbtabletype` | Column names |
186
+ | `inputParameter` | `.hdbprocedure` | `IN` and `INOUT` parameters |
187
+ | `inputParameter` | `.hdbfunction` | `IN` parameters (functions accept `IN` only) |
188
+ | `outputParameter` | `.hdbprocedure` | `OUT` and `INOUT` parameters |
189
+ | `roleName` | `.hdbrole` | The role name defined in the file |
190
+ | `grantedRoleName` | `.hdbrole` | Each role listed in `extends roles { ... }` |
191
+ | `field` | `.hdbcalculationview` | Output attributes, calculated attributes, base/calculated/restricted measures |
192
+ | `inputParameter` | `.hdbcalculationview` | Input parameters (`variable[@parameter="true"]`) |
187
193
 
188
194
  ### Default Config Example
189
195
 
@@ -284,6 +290,66 @@ Supported extractors in this version:
284
290
  }
285
291
  ]
286
292
  }
293
+ },
294
+ {
295
+ "extension": ".hdbfunction",
296
+ "target": "inputParameter",
297
+ "groups": {
298
+ "all": [
299
+ {
300
+ "description": "Input parameters prefixed with IP_",
301
+ "pattern": "^IP_[A-Z0-9_]+$"
302
+ }
303
+ ]
304
+ }
305
+ },
306
+ {
307
+ "extension": ".hdbtabletype",
308
+ "target": "field",
309
+ "groups": {
310
+ "all": [
311
+ {
312
+ "description": "Field names in uppercase snake case",
313
+ "pattern": "^[A-Z0-9]+(?:_[A-Z0-9]+)*$"
314
+ }
315
+ ]
316
+ }
317
+ },
318
+ {
319
+ "extension": ".hdbrole",
320
+ "target": "roleName",
321
+ "groups": {
322
+ "all": [
323
+ {
324
+ "description": "Role names prefixed with R_",
325
+ "pattern": "^R_.+"
326
+ }
327
+ ]
328
+ }
329
+ },
330
+ {
331
+ "extension": ".hdbcalculationview",
332
+ "target": "field",
333
+ "groups": {
334
+ "all": [
335
+ {
336
+ "description": "Output column IDs in uppercase snake case",
337
+ "pattern": "^[A-Z0-9]+(?:_[A-Z0-9]+)*$"
338
+ }
339
+ ]
340
+ }
341
+ },
342
+ {
343
+ "extension": ".hdbcalculationview",
344
+ "target": "inputParameter",
345
+ "groups": {
346
+ "all": [
347
+ {
348
+ "description": "Input parameters prefixed with IP_",
349
+ "pattern": "^IP_[A-Z0-9_]+$"
350
+ }
351
+ ]
352
+ }
287
353
  }
288
354
  ]
289
355
  }
@@ -314,6 +380,43 @@ jobs:
314
380
  - run: npx hana-linter
315
381
  ```
316
382
 
383
+ ## Pre-commit Hook (husky + lint-staged)
384
+
385
+ hana-linter's file-list mode (passing files as arguments) integrates cleanly with [lint-staged](https://github.com/lint-staged/lint-staged): lint-staged appends each staged file that matches the glob to the command, so only the files you are about to commit are linted.
386
+
387
+ **1. Install the tools**
388
+
389
+ ```bash
390
+ npm install --save-dev husky lint-staged
391
+ npx husky init
392
+ ```
393
+
394
+ **2. Configure lint-staged**
395
+
396
+ Add a `lint-staged` key to `package.json`:
397
+
398
+ ```json
399
+ {
400
+ "lint-staged": {
401
+ "*.hdb*": "hana-linter"
402
+ }
403
+ }
404
+ ```
405
+
406
+ lint-staged turns this into `hana-linter <file1> <file2> …` for every staged file that matches the glob, which is exactly the file-list mode hana-linter supports.
407
+
408
+ **3. Wire the pre-commit hook**
409
+
410
+ Replace the contents of `.husky/pre-commit` with:
411
+
412
+ ```bash
413
+ npx lint-staged
414
+ ```
415
+
416
+ Now, every `git commit` will automatically run hana-linter against the staged HANA artifact files. If any naming violations are found, the commit is blocked and the issues are reported in the terminal.
417
+
418
+ > **Tip:** Add `hana-linter` to `dependencies` (not `devDependencies`) if the linter also runs in production CI, so it is available after a plain `npm ci --production` install. For pre-commit-only use, `devDependencies` is fine.
419
+
317
420
  ## Requirements
318
421
 
319
422
  - Node.js >= 14
@@ -219,6 +219,78 @@
219
219
  }
220
220
  ]
221
221
  }
222
+ },
223
+ {
224
+ "extension": ".hdbview",
225
+ "target": "field",
226
+ "groups": {
227
+ "all": [
228
+ {
229
+ "description": "View column aliases in uppercase snake case",
230
+ "pattern": "^[A-Z0-9]+(?:_[A-Z0-9]+)*$"
231
+ }
232
+ ]
233
+ }
234
+ },
235
+ {
236
+ "extension": ".hdbfunction",
237
+ "target": "inputParameter",
238
+ "groups": {
239
+ "all": [
240
+ {
241
+ "description": "Input parameters prefixed with IP_",
242
+ "pattern": "^IP_[A-Z0-9_]+$"
243
+ }
244
+ ]
245
+ }
246
+ },
247
+ {
248
+ "extension": ".hdbtabletype",
249
+ "target": "field",
250
+ "groups": {
251
+ "all": [
252
+ {
253
+ "description": "Field names in uppercase snake case",
254
+ "pattern": "^[A-Z0-9]+(?:_[A-Z0-9]+)*$"
255
+ }
256
+ ]
257
+ }
258
+ },
259
+ {
260
+ "extension": ".hdbrole",
261
+ "target": "roleName",
262
+ "groups": {
263
+ "all": [
264
+ {
265
+ "description": "Role names prefixed with R_",
266
+ "pattern": "^R_.+"
267
+ }
268
+ ]
269
+ }
270
+ },
271
+ {
272
+ "extension": ".hdbcalculationview",
273
+ "target": "field",
274
+ "groups": {
275
+ "all": [
276
+ {
277
+ "description": "Output column IDs in uppercase snake case",
278
+ "pattern": "^[A-Z0-9]+(?:_[A-Z0-9]+)*$"
279
+ }
280
+ ]
281
+ }
282
+ },
283
+ {
284
+ "extension": ".hdbcalculationview",
285
+ "target": "inputParameter",
286
+ "groups": {
287
+ "all": [
288
+ {
289
+ "description": "Input parameters prefixed with IP_",
290
+ "pattern": "^IP_[A-Z0-9_]+$"
291
+ }
292
+ ]
293
+ }
222
294
  }
223
295
  ]
224
296
  }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { CliInput } from './types/cli';
2
+ /**
3
+ * Parse command-line arguments.
4
+ *
5
+ * Supported:
6
+ * - --config <path>
7
+ * - remaining arguments are treated as file paths
8
+ *
9
+ * @returns Parsed CLI input.
10
+ */
11
+ export declare function parseCliInput(): CliInput;
12
+ /**
13
+ * Create .hana-linter.json in current working directory from bundled template.
14
+ *
15
+ * @param force - Overwrite existing file when true.
16
+ */
17
+ export declare function runInit(force: boolean): Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { LintConfig } from './types/config';
2
+ import { JsonLintConfig } from './types/rules';
3
+ /**
4
+ * Read and parse JSON config file.
5
+ *
6
+ * @param configPath - Path to JSON configuration.
7
+ * @returns Parsed JSON config object.
8
+ */
9
+ export declare function readJsonConfig(configPath: string): Promise<JsonLintConfig>;
10
+ /**
11
+ * Convert JSON config into runtime compiled config.
12
+ *
13
+ * @param jsonConfig - Parsed JSON config.
14
+ * @returns Runtime lint config with compiled regex.
15
+ */
16
+ export declare function toLintConfig(jsonConfig: JsonLintConfig): LintConfig;
@@ -0,0 +1,10 @@
1
+ import { LintIssue } from './types/issues';
2
+ import { ContentRuleSet } from './types/rules';
3
+ /**
4
+ * Run content-based naming lint for a file.
5
+ *
6
+ * @param filePath - Candidate file path.
7
+ * @param contentRuleSets - Configured content rule sets.
8
+ * @returns List of content-based lint issues.
9
+ */
10
+ export declare function lintFileContent(filePath: string, contentRuleSets: readonly ContentRuleSet[]): Promise<LintIssue[]>;
@@ -10,6 +10,9 @@ const index_1 = require("./parsers/hdbtable/index");
10
10
  const index_2 = require("./parsers/hdbview/index");
11
11
  const index_3 = require("./parsers/hdbprocedure/index");
12
12
  const index_4 = require("./parsers/hdbfunction/index");
13
+ const index_5 = require("./parsers/hdbtabletype/index");
14
+ const index_6 = require("./parsers/hdbrole/index");
15
+ const index_7 = require("./parsers/hdbcalculationview/index");
13
16
  /**
14
17
  * Run content-based naming lint for a file.
15
18
  *
@@ -58,6 +61,15 @@ function extractSubjects(extension, fileContent) {
58
61
  if (extension === '.hdbfunction') {
59
62
  return (0, index_4.extractFunctionParameters)(fileContent);
60
63
  }
64
+ if (extension === '.hdbtabletype') {
65
+ return (0, index_5.extractTableTypeColumns)(fileContent);
66
+ }
67
+ if (extension === '.hdbrole') {
68
+ return (0, index_6.extractRoleNames)(fileContent);
69
+ }
70
+ if (extension === '.hdbcalculationview') {
71
+ return (0, index_7.extractCalculationViewOutputs)(fileContent);
72
+ }
61
73
  return [];
62
74
  }
63
75
  function evaluateAllRules(filePath, extension, subject, rules) {
@@ -70,6 +82,7 @@ function evaluateAllRules(filePath, extension, subject, rules) {
70
82
  extension,
71
83
  subjectType: subject.type,
72
84
  subjectName: subject.name,
85
+ lineNumber: subject.lineNumber,
73
86
  failedRuleDescription: rule.description,
74
87
  failedPattern: toRegexLiteral(rule)
75
88
  });
@@ -89,6 +102,7 @@ function evaluateAnyRules(filePath, extension, subject, rules) {
89
102
  extension,
90
103
  subjectType: subject.type,
91
104
  subjectName: subject.name,
105
+ lineNumber: subject.lineNumber,
92
106
  failedRuleDescription: 'At least one OR-group rule must match: ' + rules.map((rule) => rule.description).join(' | '),
93
107
  failedPattern: rules.map(toRegexLiteral).join(' OR ')
94
108
  }
@@ -0,0 +1,12 @@
1
+ import { CliInput } from './types/cli';
2
+ import { LintConfig } from './types/config';
3
+ /**
4
+ * Resolve files to validate:
5
+ * - If CLI files are provided: use only existing files from that list.
6
+ * - If none are provided: run full scan from rootDir.
7
+ *
8
+ * @param config - Lint configuration.
9
+ * @param cliInput - Parsed CLI input.
10
+ * @returns List of file paths to validate.
11
+ */
12
+ export declare function resolveFilesToValidate(config: LintConfig, cliInput: CliInput): Promise<string[]>;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/lib.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Public library API for hana-linter.
3
+ *
4
+ * Import this entry point when using hana-linter programmatically
5
+ * (e.g. from a VS Code extension). The CLI remains available via the
6
+ * `hana-linter` binary.
7
+ */
8
+ export { runLint } from './lint';
9
+ export { lintFileContent } from './content-lint';
10
+ export { readJsonConfig, toLintConfig } from './config';
11
+ export type { LintIssue, ExtractedSubject } from './types/issues';
12
+ export type { LintConfig } from './types/config';
13
+ export type { JsonLintConfig, JsonExtensionRuleSet, JsonContentRuleSet, JsonRuleDefinition, JsonRuleGroup, ContentTarget } from './types/rules';
package/dist/lib.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Public library API for hana-linter.
4
+ *
5
+ * Import this entry point when using hana-linter programmatically
6
+ * (e.g. from a VS Code extension). The CLI remains available via the
7
+ * `hana-linter` binary.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.toLintConfig = exports.readJsonConfig = exports.lintFileContent = exports.runLint = void 0;
11
+ var lint_1 = require("./lint");
12
+ Object.defineProperty(exports, "runLint", { enumerable: true, get: function () { return lint_1.runLint; } });
13
+ var content_lint_1 = require("./content-lint");
14
+ Object.defineProperty(exports, "lintFileContent", { enumerable: true, get: function () { return content_lint_1.lintFileContent; } });
15
+ var config_1 = require("./config");
16
+ Object.defineProperty(exports, "readJsonConfig", { enumerable: true, get: function () { return config_1.readJsonConfig; } });
17
+ Object.defineProperty(exports, "toLintConfig", { enumerable: true, get: function () { return config_1.toLintConfig; } });
package/dist/lint.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { LintIssue } from './types/issues';
2
+ import { LintConfig } from './types/config';
3
+ /**
4
+ * Run naming lint and return all discovered issues.
5
+ *
6
+ * @param config - Lint configuration.
7
+ * @param filesToValidate - File paths to validate.
8
+ * @returns All naming violations.
9
+ */
10
+ export declare function runLint(config: LintConfig, filesToValidate: readonly string[]): Promise<LintIssue[]>;