ionic-cli
ionic-cli copied to clipboard
Eslint and Vite errors after scaffolding new react project
Description:
After creating new project using ionic-cli some error messages were discovered
- Error [ERR_REQUIRE_ESM]: Cannot read config file: /<appRoot>/.eslintrc.js
- TS2345: Argument of type '{ plugins: PluginOption[][]; test: { globals: boolean; environment: string; setupFiles: string; }; }' is not assignable to parameter of type 'UserConfigExport'.
- ESLint: Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Steps to Reproduce: ionic start -> choose react with side menu -> check tsx files and vite.config
Possible solutions
- rename .eslintrc.js to .eslintrc.cjs
- take eslint config and eslint plugins from default vite react app (yarn create vite)
- eslintrc.js => eslintrc.cjs
parserOptions: { ecmaVersion: 2020, "sourceType": "module" },