uilint-eslint 0.2.114 → 0.2.116

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilint-eslint",
3
- "version": "0.2.114",
3
+ "version": "0.2.116",
4
4
  "description": "ESLint plugin for UILint - AI-powered UI consistency checking",
5
5
  "author": "Peter Suggate",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "@typescript-eslint/utils": "^8.35.1",
36
36
  "oxc-resolver": "^11.0.0",
37
37
  "xxhash-wasm": "^1.1.0",
38
- "uilint-core": "0.2.114"
38
+ "uilint-core": "0.2.116"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/eslint": "^9.6.1",
@@ -5,8 +5,8 @@
5
5
  */
6
6
 
7
7
  import { RuleTester } from "@typescript-eslint/rule-tester";
8
- import { describe, afterAll } from "vitest";
9
- import { readFileSync } from "fs";
8
+ import { describe, afterAll, it } from "vitest";
9
+ import { readFileSync, existsSync } from "fs";
10
10
  import { join, dirname } from "path";
11
11
  import { fileURLToPath } from "url";
12
12
  import rule from "./no-unsafe-type-casts.js";
@@ -489,47 +489,53 @@ describe("no-unsafe-type-casts edge cases", () => {
489
489
  // ============================================
490
490
  // FIXTURE-BASED TESTS
491
491
  // ============================================
492
+ // These tests only run when the fixtures directory exists (i.e., in the source package,
493
+ // not when the rule is installed into a project's .uilint/rules/ directory)
492
494
  const __dirname = dirname(fileURLToPath(import.meta.url));
493
495
  const FIXTURES_DIR = join(__dirname, "__fixtures__/no-unsafe-type-casts");
496
+ const fixtureFilePath = join(FIXTURES_DIR, "unsafe-casts.ts");
494
497
 
495
- // Read fixture file at module level
496
- const fixtureCode = readFileSync(
497
- join(FIXTURES_DIR, "unsafe-casts.ts"),
498
- "utf-8"
499
- );
498
+ if (existsSync(fixtureFilePath)) {
499
+ const fixtureCode = readFileSync(fixtureFilePath, "utf-8");
500
500
 
501
- // Create a separate tester for fixture (no JSX for legacy syntax in fixture)
502
- const fixtureRuleTester = new RuleTester({
503
- languageOptions: {
504
- ecmaVersion: 2022,
505
- sourceType: "module",
506
- parserOptions: {
507
- ecmaFeatures: { jsx: false },
501
+ // Create a separate tester for fixture (no JSX for legacy syntax in fixture)
502
+ const fixtureRuleTester = new RuleTester({
503
+ languageOptions: {
504
+ ecmaVersion: 2022,
505
+ sourceType: "module",
506
+ parserOptions: {
507
+ ecmaFeatures: { jsx: false },
508
+ },
508
509
  },
509
- },
510
- });
510
+ });
511
511
 
512
- fixtureRuleTester.run("no-unsafe-type-casts (fixture)", rule, {
513
- valid: [],
514
- invalid: [
515
- {
516
- name: "fixture file with multiple unsafe cast patterns",
517
- code: fixtureCode,
518
- errors: [
519
- // AS ANY PATTERNS (3 occurrences)
520
- { messageId: "noAsAny" }, // response.data as any
521
- { messageId: "noAsAny" }, // payload as any
522
- { messageId: "noAsAny" }, // obj as any
523
- // DOUBLE-CAST PATTERNS (3 occurrences)
524
- // Note: "as any as" also reports an inner "as any"
525
- { messageId: "noDoubleCast" }, // jsonData as unknown as User
526
- { messageId: "noDoubleCast" }, // input as any as number[]
527
- { messageId: "noAsAny" }, // inner "as any" from the double-cast above
528
- { messageId: "noDoubleCast" }, // response.data as unknown as User[]
529
- // LEGACY SYNTAX PATTERNS (2 occurrences)
530
- { messageId: "noLegacyAsAny" }, // <any>value
531
- { messageId: "noDoubleCast" }, // <User><unknown>data
532
- ],
533
- },
534
- ],
535
- });
512
+ fixtureRuleTester.run("no-unsafe-type-casts (fixture)", rule, {
513
+ valid: [],
514
+ invalid: [
515
+ {
516
+ name: "fixture file with multiple unsafe cast patterns",
517
+ code: fixtureCode,
518
+ errors: [
519
+ // AS ANY PATTERNS (3 occurrences)
520
+ { messageId: "noAsAny" }, // response.data as any
521
+ { messageId: "noAsAny" }, // payload as any
522
+ { messageId: "noAsAny" }, // obj as any
523
+ // DOUBLE-CAST PATTERNS (3 occurrences)
524
+ // Note: "as any as" also reports an inner "as any"
525
+ { messageId: "noDoubleCast" }, // jsonData as unknown as User
526
+ { messageId: "noDoubleCast" }, // input as any as number[]
527
+ { messageId: "noAsAny" }, // inner "as any" from the double-cast above
528
+ { messageId: "noDoubleCast" }, // response.data as unknown as User[]
529
+ // LEGACY SYNTAX PATTERNS (2 occurrences)
530
+ { messageId: "noLegacyAsAny" }, // <any>value
531
+ { messageId: "noDoubleCast" }, // <User><unknown>data
532
+ ],
533
+ },
534
+ ],
535
+ });
536
+ } else {
537
+ // Skip fixture tests when running in an installed context
538
+ describe("no-unsafe-type-casts (fixture)", () => {
539
+ it.skip("fixture tests skipped - fixtures not available in installed context", () => {});
540
+ });
541
+ }