rip-lang 3.13.81 → 3.13.82

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.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.81-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.82-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
package/bin/rip CHANGED
@@ -124,7 +124,12 @@ async function main() {
124
124
 
125
125
  if (args[0] === 'check') {
126
126
  const { runCheck } = await import('../src/typecheck.js');
127
- const exitCode = await runCheck(args[1] || '.', { quiet: args.includes('-q') || args.includes('--quiet') });
127
+ const checkArgs = args.slice(1);
128
+ const dir = checkArgs.find(a => !a.startsWith('-')) || '.';
129
+ const exitCode = await runCheck(dir, {
130
+ quiet: checkArgs.includes('-q') || checkArgs.includes('--quiet'),
131
+ allowAny: checkArgs.includes('--allow-any'),
132
+ });
128
133
  process.exit(exitCode);
129
134
  }
130
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.81",
3
+ "version": "3.13.82",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/typecheck.js CHANGED
@@ -322,6 +322,29 @@ export async function runCheck(targetDir, opts = {}) {
322
322
  else if (severity === 'warning') totalWarnings++;
323
323
  }
324
324
 
325
+ // Untyped component prop checking
326
+ if (!opts.allowAny && entry.dts) {
327
+ const dtsLines = entry.dts.split('\n');
328
+ const srcLines = entry.source.split('\n');
329
+ for (let d = 0; d < dtsLines.length; d++) {
330
+ const cm = dtsLines[d].match(/^export declare class (\w+)/);
331
+ if (!cm) continue;
332
+ for (let p = d + 1; p < dtsLines.length; p++) {
333
+ if (/^\}/.test(dtsLines[p])) break;
334
+ const pm = dtsLines[p].match(/^\s+(\w+)\?\s*:\s*any;$/);
335
+ if (!pm) continue;
336
+ const propName = pm[1];
337
+ for (let s = 0; s < srcLines.length; s++) {
338
+ if (new RegExp('@' + propName + '\\s*:=').test(srcLines[s])) {
339
+ errors.push({ line: s + 1, message: `Prop '${propName}' on component ${cm[1]} has no type annotation`, severity: 'error', code: 'rip' });
340
+ totalErrors++;
341
+ break;
342
+ }
343
+ }
344
+ }
345
+ }
346
+ }
347
+
325
348
  if (errors.length > 0) {
326
349
  fileResults.push({ file: fp, errors });
327
350
  }
@@ -333,7 +356,7 @@ export async function runCheck(targetDir, opts = {}) {
333
356
  for (const e of errors) {
334
357
  const loc = `${cyan(rel)}${dim(':')}${yellow(String(e.line))}`;
335
358
  const sev = e.severity === 'error' ? red('error') : yellow('warning');
336
- console.log(`${loc} ${sev} ${e.message} ${dim(`TS${e.code}`)}`);
359
+ console.log(`${loc} ${sev} ${e.message} ${dim(typeof e.code === 'number' ? `TS${e.code}` : '')}`);
337
360
  }
338
361
  }
339
362