eslint-config-preact icon indicating copy to clipboard operation
eslint-config-preact copied to clipboard

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

Open wesdse001 opened this issue 3 years ago • 1 comments

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.

wesdse001 avatar Dec 29 '21 18:12 wesdse001

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

deepthinker250 avatar Mar 10 '22 04:03 deepthinker250

@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?

CalK16 avatar Dec 24 '23 03:12 CalK16