not-an-aardvark / eslint-plugin-self

Allows ESLint plugins to lint themselves
MIT License
18 stars 4 forks source link

'Failed to load plugin 'self' declared in '--config': enabledPluginName.replace is not a function' with v9 compatible add-on #8

Open Standard8 opened 6 months ago

Standard8 commented 6 months ago

When attempting to use this plugin with a v9 compatible add-on, a message such as this is produced:

TypeError: Failed to load plugin 'self' declared in '--config': enabledPluginName.replace is not a function
    at /Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:38:53
    at Array.map (<anonymous>)
    at /Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:38:10
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/mark/dev/eslint-plugin-json/node_modules/eslint-plugin-self/index.js:29:31)
    at Module._compile (/Users/mark/dev/eslint-plugin-json/test/packages/eslint-v7/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)

The new configuration format allows for a combination of:

{
  "configs": {
    "recommended-legacy": {
      "plugins": ["json"],
      "rules": {
        "json/*": "error",
      },
    },
    "recommended": {
      "plugins": { // object that refers to the plugin itself }
      "rules": {
        "json/*": "error",
      },
    }
  }

so this needs to be handled in some manner.