Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e13b384
Merge pull request #9 from QwikDev/build/v2
JerryWu1234 Apr 11, 2025
94e47d7
fix(repl): improve deepUpdate logic for array item matching
JerryWu1234 Apr 11, 2025
69dd8fb
fix it
JerryWu1234 Apr 22, 2025
765ce4a
Merge branch 'QwikDev:build/v2' into build/v2
JerryWu1234 May 12, 2025
64d00a0
Merge branch 'QwikDev:build/v2' into build/v2
JerryWu1234 Jun 6, 2025
e729fdb
chore: update devDependencies and configurations
JerryWu1234 Jun 6, 2025
bfd176b
fix: init a test
JerryWu1234 Jun 6, 2025
d206cf6
FIX: fix edge case
JerryWu1234 Jun 9, 2025
07740ac
revert code
JerryWu1234 Jun 9, 2025
63cdda0
add change
JerryWu1234 Jun 12, 2025
8514061
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Jun 12, 2025
eaaf3ec
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Jun 26, 2025
275ed8a
fix: enhance eslint-plugin to accurately detect Node API usage and im…
JerryWu1234 Jun 26, 2025
cde161b
fix: refactor GLOBALAPIS to use array instead of Set and streamline d…
JerryWu1234 Jun 26, 2025
3e304c3
fix: improve handling of undeclared variables in scopeUseTask rule
JerryWu1234 Jun 26, 2025
de415bb
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Jul 17, 2025
9c25caa
fix: improve variable scope handling in scopeUseTask rule
JerryWu1234 Jul 29, 2025
c936c82
Merge branch 'build/v2' into qwik-plugin-check
gioboa Sep 15, 2025
3565578
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Oct 27, 2025
9ae3250
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Nov 5, 2025
e59a79e
Merge branch 'build/v2' into qwik-plugin-check
JerryWu1234 Nov 17, 2025
415f43d
fix: remove unnecessary optional chaining in scopeUseTask
JerryWu1234 Nov 17, 2025
8595ea9
docs: add comment to clarify built-in node API usage in valid-scope-u…
JerryWu1234 Nov 20, 2025
8420793
fix: add process object and clarify built-in node API comment in vali…
JerryWu1234 Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loud-mammals-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-qwik': patch
---

FIX: cover more qwik eslint's edge case
12 changes: 10 additions & 2 deletions packages/eslint-plugin-qwik/src/scope-use-task.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Rule } from 'eslint';
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/utils';
import * as eslint from 'eslint'; // For Scope types
import type { Identifier } from 'estree';
const ISSERVER = 'isServer';
// Helper function: checks if a node is a descendant of another node
function isNodeDescendantOf(descendantNode, ancestorNode): boolean {
Expand Down Expand Up @@ -93,7 +94,6 @@ export const scopeUseTask: Rule.RuleModule = {
*/
function isApiUsageGuarded(apiOrCallNode, functionContextNode): boolean {
let currentParentNode: TSESTree.Node | undefined = apiOrCallNode.parent;

while (
currentParentNode &&
currentParentNode !== functionContextNode.body &&
Expand Down Expand Up @@ -322,7 +322,15 @@ export const scopeUseTask: Rule.RuleModule = {
}

if (forbiddenApis.has(node.name)) {
if (isIdentifierShadowedByDeclaration(node)) {
const isDirectIdentifier =
node.parent.type === 'VariableDeclarator' &&
(node?.parent?.init as Identifier)?.name === node.name;
// node'api usually be invoked as a member expression (e.g., process.env)
// or as a direct identifier (e.g., process).
if (
isIdentifierShadowedByDeclaration(node) ||
(node.parent.type !== 'MemberExpression' && node.parent.type !== 'VariableDeclarator')
) {
return;
}
if (!isApiUsageGuarded(node, currentUseTaskFunction)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Expect error: { "messageId": "unsafeApiUsage" }

// Expect error: { "messageId": "unsafeApiUsage" }
import { component$, useSignal, useTask$ } from '@qwik.dev/core';

export default component$(() => {
const s = useSignal(0);
useTask$(({ track }) => {
track(() => {
process.env;
const m = process;
return s.value;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default component$(() => {
function foo() {
if (isServer) {
process.env;
const m = process;
}
}
foo();
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this tests? Is there anything in this code that would be flagged with or without the qwik plugin?

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { component$, useTask$, isBrowser, useSignal } from '@qwik.dev/core';

export default component$(() => {
const state = useSignal(true);
useTask$(({ track }) => {
if (isBrowser) {
track(() => {
if (state.value) {
const values = [
{
relativePath: '',
name: 'index',
type: '',
path: '',
isSymbolicLink: false,
children: undefined,
},
];
}
});
}
});
return <></>;
});