@alint-js/config 0.1.3 → 0.1.5

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/LICENSE +21 -0
  2. package/dist/index.mjs +41 -4
  3. package/package.json +4 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alint contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.mjs CHANGED
@@ -227,8 +227,26 @@ const maxSupplementalFiles = 12;
227
227
  function createBasicStructuredRule(rule) {
228
228
  return {
229
229
  cache: rule.includeFiles === void 0 || rule.includeFiles.length === 0,
230
- create: (ctx) => ({ async onTargetFile(target) {
230
+ create: (ctx) => ({
231
+ /**
232
+ * Runs one structured declarative review for a planned file.
233
+ *
234
+ * Triggering workflow:
235
+ *
236
+ * {@link createBasicStructuredRule}
237
+ * -> `RuleHandlers.onTargetFile`
238
+ * -> {@link generateStructured}
239
+ *
240
+ * Upstream:
241
+ * - {@link createBasicStructuredRule}
242
+ *
243
+ * Downstream:
244
+ * - {@link generateStructured}
245
+ * - {@link reportDeclarativeFindings}
246
+ */
247
+ async onTargetFile(target) {
231
248
  const model = await ctx.model();
249
+ const file = await ctx.src.readFile(target.file);
232
250
  const supplementalFiles = await collectSupplementalFiles({
233
251
  cwd: ctx.cwd,
234
252
  includeFiles: rule.includeFiles,
@@ -243,7 +261,7 @@ function createBasicStructuredRule(rule) {
243
261
  outputLanguage: ctx.outputLanguage,
244
262
  retryFeedback,
245
263
  ruleFilePath: rule.filePath,
246
- sourceText: target.file.text,
264
+ sourceText: file.text,
247
265
  supplementalFiles,
248
266
  targetFilePath: target.file.path
249
267
  }),
@@ -375,13 +393,31 @@ const reportFindingsToolName = "report_findings";
375
393
  function createBasicCodingAgentRule(rule) {
376
394
  return {
377
395
  cache: false,
378
- create: (ctx) => ({ async onTargetFile(target) {
396
+ create: (ctx) => ({
397
+ /**
398
+ * Runs one tool-using declarative review for a planned file.
399
+ *
400
+ * Triggering workflow:
401
+ *
402
+ * {@link createBasicCodingAgentRule}
403
+ * -> `RuleHandlers.onTargetFile`
404
+ * -> {@link createCodingAgent}
405
+ *
406
+ * Upstream:
407
+ * - {@link createBasicCodingAgentRule}
408
+ *
409
+ * Downstream:
410
+ * - {@link createCodingAgent}
411
+ * - {@link reportDeclarativeFindings}
412
+ */
413
+ async onTargetFile(target) {
379
414
  const model = await ctx.model();
415
+ const file = await ctx.src.readFile(target.file);
380
416
  const result = await createCodingAgent(model).run({
381
417
  cwd: ctx.cwd,
382
418
  instruction: rule.instruction,
383
419
  outputLanguage: ctx.outputLanguage,
384
- sourceText: target.file.text,
420
+ sourceText: file.text,
385
421
  targetFilePath: target.file.path,
386
422
  tools: createTools(ctx.cwd)
387
423
  });
@@ -1023,6 +1059,7 @@ const staticConfigItemSchema = looseObject({
1023
1059
  languageOptions: optional(record(string(), unknown())),
1024
1060
  linterOptions: optional(looseObject({
1025
1061
  noInlineConfig: optional(boolean()),
1062
+ reportUnregisteredLanguages: optional(ruleSeveritySchema),
1026
1063
  reportUnusedDisableDirectives: optional(ruleSeveritySchema)
1027
1064
  })),
1028
1065
  name: optional(string()),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/config",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -17,6 +17,7 @@
17
17
  "@package-json/types": "^0.0.13",
18
18
  "apeira": "^0.0.7",
19
19
  "c12": "^4.0.0-beta.5",
20
+ "chokidar": "^5.0.0",
20
21
  "es-toolkit": "^1.49.0",
21
22
  "jiti": "^2.7.0",
22
23
  "minimatch": "^10.2.5",
@@ -27,8 +28,8 @@
27
28
  "tar-stream": "^3.2.0",
28
29
  "valibot": "^1.4.2",
29
30
  "xdg-basedir": "^5.1.0",
30
- "@alint-js/core": "0.1.3",
31
- "@alint-js/tools-fs": "0.1.3"
31
+ "@alint-js/core": "0.1.5",
32
+ "@alint-js/tools-fs": "0.1.5"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@types/tar-stream": "^3.1.4",