NullVoxPopuli / eslint-configs

My Preferred ESLint configs for all my projects. Uses only overrides so that they're easy to maintain and update
9 stars 6 forks source link

@babel/plugin-proposal-decorators not found #580

Closed betocantu93 closed 9 months ago

betocantu93 commented 9 months ago

Hello!! I've been migrating projects to use these awesome configs.

I just have one issue:

with configs.ember(); looking at the output I notice that some js files get this config

{
"parserOptions":  {
    "requireConfigFile": false,
    "babelOptions": { "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]] }
  },
}

But I'm getting this error in vscode console:

Screen Shot 2023-12-14 at 11 40 59

I followed the basic tips like, add it to devDependencies or dependencies but without luck... then I wanted to see if I copy pasted the output from configs.ember() manually would it work so I ran the script and copy pasted the output manually instead of calling the function from eslintrc.js... and it worked?

Whats interesting is that in another project it does work, can't pin down what is causing this.

Basically if my eslintrc.js file has this, it works.

//const { configs } = require('@nullvoxpopuli/eslint-configs');

//const config = configs.ember();

module.exports = {
  overrides: [
    {
      parser: '@babel/eslint-parser',
      parserOptions: {
        requireConfigFile: false,
        babelOptions: { plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]] },
      },
      env: { browser: true },
      extends: [
        'eslint:recommended',
        'plugin:decorator-position/ember',
        'plugin:ember/recommended',
      ],
    },
  ],
  plugins: ['simple-import-sort', 'decorator-position', 'ember'],
  files: [
    '{src,app,addon,addon-test-support,tests}/**/*.{gjs,js}',
    'tests/dummy/config/deprecation-workflow.js',
  ],
};

If I use this one, the errors appears.

const { configs } = require('@nullvoxpopuli/eslint-configs');

const config = configs.ember();

module.exports = config;
NullVoxPopuli commented 9 months ago

Hello! Thanks for the insue report!

What package manager and version are you using?

(And do you have .npmrc config?)

betocantu93 commented 9 months ago

I'm using: pnpm 8.11.0

And noup, I don't have .npmrc

NullVoxPopuli commented 9 months ago

Legit, what version of eslint / babel do you have atm?

betocantu93 commented 9 months ago

"@babel/core": "^7.23.2", "eslint": "^8.31.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-ember": "^11.6.0",

NullVoxPopuli commented 9 months ago

Any of these things different in your other project?

I don't immediately see anything out of the ordinary

betocantu93 commented 9 months ago

Yea, me neither... been staring back and forth for a couple of hours... trying to get all working.

As I said it does work if I manually "type in (copy paste)" the output of the configs.ember()

Just out of curiosity, shouldn't it be added to dependencies of this package?

I mean the @babel/plugin-proposal-decorators

NullVoxPopuli commented 9 months ago

Yeah, i think you're right: there is a missing dependency! I didn't notice!

Would you be willing to pr a fix? We may not be able to test, but at least we can follow advice of 'if used, declare it in package.json'

betocantu93 commented 9 months ago

Yep, sure let me do that, not sure if peerDependecy to be more flexible?