eslint-plugin-no-optional-call
eslint-plugin-no-optional-call copied to clipboard
Fixing TypeError: Cannot set properties of undefined (setting 'default')
When using this plugin I ran into this issue: "TypeError: Failed to load plugin 'no-optional-call' declared in '.eslintrc.js': Cannot set properties of undefined (setting 'default')".
Using:
eslint: 8.37.0 with this, partial, config:
module.exports = {
env: {
es2022: true,
node: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
impliedStrict: false,
},
},
plugins: [
'no-optional-call',
],
rules: {
'no-optional-call/default': 'error',
}
}
What version of node are you using?
This error you're experiencing has never been an issue before, so I'm wondering if this is some breaking change in Node itself.
Hi Kyle,
I'm using Node 18.15.0
(64-bit on Windows 10)
Complete stack trace:
Oops! Something went wrong! :(
ESLint: 8.37.0
TypeError: Failed to load plugin 'no-optional-call' declared in '.eslintrc.cjs': Cannot set properties of undefined (setting 'default')
at Object.<anonymous> (C:\Users\Johan\Projects\mine\node\jm-node-starter\node_modules\eslint-plugin-no-optional-call\lib\index.js:5:33)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at ConfigArrayFactory._loadPlugin (C:\Users\Johan\Projects\mine\node\jm-node-starter\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3411:42)
at C:\Users\Johan\Projects\mine\node\jm-node-starter\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3283:33
at Array.reduce (<anonymous>)