solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
206 stars 24 forks source link

eslint crashes when using `as` in createSignal argument #133

Closed noriapi closed 2 months ago

noriapi commented 3 months ago

Describe the bug eslint exits with the following error

Oops! Something went wrong! :(

ESLint: 8.57.0

Error: Unknown node type TSAsExpression.
Occurred while linting /home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/src/index.tsx:4
Rule: "solid/reactivity"
    at Controller.traverse (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/estraverse/estraverse.js:469:31)
    at traverse (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/estraverse/estraverse.js:670:27)
    at permissivelyTrackNode (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint-plugin-solid/dist/rules/reactivity.js:532:43)
    at checkForTrackedScopes (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint-plugin-solid/dist/rules/reactivity.js:687:29)
    at CallExpression (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint-plugin-solid/dist/rules/reactivity.js:760:17)
    at ruleErrorHandler (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint/lib/linter/linter.js:1076:28)
    at /home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/runner/work/eslint-solid-crash-repro/eslint-solid-crash-repro/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
error: "eslint" exited with code 2

To Reproduce

import { createSignal } from "solid-js";

export const createSome = () => {
  const [a] = createSignal("a" as string);

  return a;
};

repo

Expected behavior no error

Environment (please complete the following information):

Additional context

JfrAziz commented 3 months ago

confirm it, I also get this error when using as in context

qeleb commented 2 months ago

+1