solidjs-community / eslint-plugin-solid

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

Bugs happend in jsx-uses-vars #138

Open Nixie24 opened 2 months ago

Nixie24 commented 2 months ago
TypeError: context.markVariableAsUsed is not a function
Occurred while linting xxx.tsx
Rule: "solid/jsx-uses-vars"

I found that context.markVariableAsUsed was deprecated at rules/jsx-uses-vars.ts#L40. The source code from @typescript-eslint/utils:

/**
 * Marks a variable with the given name in the current scope as used.
 * This affects the no-unused-vars rule.
 *
 * @deprecated in favor of `SourceCode#markVariableAsUsed`
 */
markVariableAsUsed(name: string): boolean;
Nixie24 commented 2 months ago

Replace context.markVariableAsUsed(node.name.name) with context.sourceCode.markVariableAsUsed(node.name.name, node)

Nixie24 commented 2 months ago

P.S. It happend with ESLint v9 but not v8