I’m running into the error below when trying to run npx eslint . with the recommended sonar eslint configuration.
Oops! Something went wrong! :(
ESLint: 9.14.0
TypeError: Cannot read properties of undefined (reading 'meta')
at decorate (/Users/project/node_modules/eslint-plugin-sonarjs/cjs/S1116/decorator.js:12:65)
at Object.<anonymous> (/Users/project/node_modules/eslint-plugin-sonarjs/cjs/S1116/index.js:25:44)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/Users/project/node_modules/eslint-plugin-sonarjs/cjs/decorated.js:56:19)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
I have eslint configured like so:
module.exports = [
// other flat config stuff...
sonarjs.configs.recommended,
{
plugins: {
sonarjs,
},
},
// more stuff...
];
The rule no-extra-semi, which is failing here, is not enabled in the recommended configuration. Can you confirm that you are enabling it in your ESLint configuration module? If possible, can you share the whole configuration file so that we can try and reproduce the issue?
cd node_modules/eslint-plugin-sonarjs/cjs/S1116
node index.js
This error is produced as well. For an easy way to reproduce this
Oops! Something went wrong! :(
ESLint: 9.15.0
TypeError: Cannot read properties of undefined (reading 'meta')
at decorate (C:\Users\BradleyArlt\source\system-admin-another\web\node_modules\eslint-plugin-sonarjs\cjs\S1116\decorator.js:12:65)
at Object.<anonymous> (C:\Users\BradleyArlt\source\system-admin-another\web\node_modules\eslint-plugin-sonarjs\cjs\S1116\index.js:25:44)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (C:\Users\BradleyArlt\source\system-admin-another\web\node_modules\eslint-plugin-sonarjs\cjs\decorated.js:56:19)
at Module._compile (node:internal/modules/cjs/loader:1469:14)