preactjs / eslint-config-preact

Unopinionated baseline ESLint config for Preact and Preact CLI codebases.
https://npm.im/eslint-config-preact
MIT License
95 stars 16 forks source link

Cannot find module '@babel/plugin-syntax-class-properties' #20

Closed wesdse001 closed 2 years ago

wesdse001 commented 2 years ago

Hi Preact team! I'm testing out WMR, which is amazing BTW! Here is my package.json:

"dependencies": {
  "preact": "^10.6.4"
},
"devDependencies": {
  "eslint": "^8.5.0",
  "eslint-config-preact": "^1.3.0",
  "wmr": "^3.7.2"
},
"eslintConfig": {
  "extends": "preact"
}

After I installed eslint-config-preact, I got the following error:

Parsing error: Cannot find module '@babel/plugin-syntax-class-properties'

I double checked my package-lock.json and made sure @babel/plugin-syntax-class-properties is installed:

"node_modules/@babel/plugin-syntax-class-properties": {
  "version": "7.12.13",
  "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz",
  "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==",
  "dev": true,
  "dependencies": {
    "@babel/helper-plugin-utils": "^7.12.13"
  },
  "peerDependencies": {
    "@babel/core": "^7.0.0-0"
  }
},

I also made sure the node_modules/@babel/plugin-syntax-class-properties directory exists in my computer.

This should mean the package is there right? Or am i just dumb haha.

deepthinker250 commented 2 years ago

@wesdse001 Add following in .babelrc { "presets": ["@babel/env"], "plugins": ["@babel/plugin-proposal-class-properties"] } And add the following in eslintConfig "plugins": ["@babel"]

CalK16 commented 11 months ago

@wesdse001 Add following in .babelrc { "presets": ["@babel/env"], "plugins": ["@babel/plugin-proposal-class-properties"] } And add the following in eslintConfig "plugins": ["@babel"]

It seems to me that .babelrc and .eslintrc is not generated with npm init preact. Is there anyway we can do better by adding the configuration files with these content by default?