-
Notifications
You must be signed in to change notification settings - Fork 151
Labels
bugSomething isn't workingSomething isn't workingtriagePending to be triaged by a maintainerPending to be triaged by a maintainer
Description
Have you read the Troubleshooting section?
Yes
Plugin version
7.6.3
ESLint version
9.32.0
Node.js version
24.5.0
Bug description
I'm seeing no-node-access triggers in situations like this:
describe('AppComponent', () => {
let user: UserEvent;
beforeEach(async () => {
user = userEvent.setup();
});
it('should lint', async () => {
await render(AppComponent);
const link = screen.getByText('Learn more about Angular');
await user.click(link);
});
});
It somehow doesn't recognize that "user" is of type UserEvent.
Changing aggressive reporting settings seems to make no difference.
This is possibly related to #1038 , but opening a new issue as directed there.
Steps to reproduce
Error output/screenshots
Linting "demo"...
/home/projects/no-node-access-bug/src/main.spec.ts
15:16 error Avoid direct Node access. Prefer using the methods from Testing Library testing-library/no-node-access
✖ 1 problem (1 error, 0 warnings)
Lint errors found in the listed files.
ESLint configuration
// @ts-check
const eslint = require('@eslint/js');
const tseslint = require('typescript-eslint');
const testing = require('eslint-plugin-testing-library');
module.exports = tseslint.config({
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: { projectService: true },
},
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
testing.configs['flat/angular'],
],
});
Rule(s) affected
no-node-access
Anything else?
If you want to see it on a real codebase, mine is https://github.com/rdamazio/efis-editor - no-node-access is currently disabled there, just re-enable it in eslint.config.js and you'll see hundreds of triggers.
Do you want to submit a pull request to fix this bug?
No
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriagePending to be triaged by a maintainerPending to be triaged by a maintainer