You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use eslint with the eslint-plugin-security-node. Running the tests, I got an error "TypeError: Cannot read properties of undefined (reading 'loc')".
Using the eslint extension in VsCode, I get no error there.
Any idea about what happened here?
Environment
Version : 1.1.4
Node.js : 20.18.0
Eslint: 9.16.0
Used Code
import assert from 'node:assert';
import { readFile } from 'node:fs/promises';
import { pipeline } from 'node:stream/promises';
import { stub } from 'sinon';
import StreamTest from 'streamtest';
import config from '../lib/config.js';
import { getFormatter } from '../lib/formatter.js';
describe('FormatterWritable', () => {
let testConfig;
beforeEach(() => {
testConfig = structuredClone(config);
});
it('creates a writable with json formatter', async () => {
const consoleStub = stub(console, 'log');
testConfig.output = 'json';
const outputFormatter = getFormatter(testConfig.output);
const resultPromise = new Promise((resolve, reject) => {
StreamTest.fromObjects([EXPECTED_RESULT_CLASSIFICATION]) // <<<< this is line 69 mentioned in the error message
.pipe(new FormatterWritable(outputFormatter, testConfig))
.on('finish', resolve)
.on('error', reject);
});
await resultPromise;
const expectedResult = JSON.stringify(EXPECTED_RESULT_CLASSIFICATION);
assert(consoleStub.calledOnce);
assert.deepStrictEqual(consoleStub.firstCall.firstArg, expectedResult);
consoleStub.restore();
});
});
What actually happened?
Oops! Something went wrong! :(
ESLint: 9.16.0
TypeError: Cannot read properties of undefined (reading 'loc')
Occurred while linting D:\Projekte\github\license-report-check\test\util-stream.spec.js:69
Rule: "security-node/detect-unhandled-event-errors"
at CallExpression (D:\Projekte\github\license-report-check\node_modules\eslint-plugin-security-node\lib\rules\detect-unhandled-event-errors.js:133:43)
at ruleErrorHandler (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\linter.js:1098:48)
at D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\node-event-generator.js:337:14)
at runRules (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\linter.js:1142:40)
at #flatVerifyWithoutProcessors (D:\Projekte\github\license-report-check\node_modules\eslint\lib\linter\linter.js:1911:31)
The text was updated successfully, but these errors were encountered:
I use eslint with the eslint-plugin-security-node. Running the tests, I got an error "TypeError: Cannot read properties of undefined (reading 'loc')".
Using the eslint extension in VsCode, I get no error there.
Any idea about what happened here?
Environment
Version : 1.1.4
Node.js : 20.18.0
Eslint: 9.16.0
Used Code
What actually happened?
The text was updated successfully, but these errors were encountered: