Parsing error: '=' expected in `import type` - create-react-app

I am using create-react-app with TS and do import type but eslint complains in VS Code saying that Parsing error: '=' expected when hovering type in import type. I'm using eslint, 6.7.2

UPDATE: The syntax is now supported by the latest versions of #typescript-eslint/parser and #typescript-eslint/eslint-plugin.
ESLint support for TS import type syntax is working in progress.
Issue: https://github.com/typescript-eslint/typescript-eslint/issues/1436
Pull request: https://github.com/typescript-eslint/typescript-eslint/pull/1465

Prettier
If you're using prettier rather than ESLint then the solutions is:
npm update prettier#latest
# Or yarn
yarn upgrade prettier#latest
Which installed prettier version "2.6.2". Which worked for me with import type { } from './types' syntax

Related

vite - create-vite got error in node version 18

I am using yarn create vite to create my vue project, but after executed command I got following error message:
error expo-cli#6.0.2: The engine "node" is incompatible with this module. Expected version ">=12 <=16". Got "18.1.0"
error Found incompatible module.
I know that error message means I need to use node version between 12~16, but I am confused that there's no mentioned node version 18 cannot use in vite document.
Also, in the package.json, there's only limit on 14.18.0 or 16+
Am I missing something?
The error is not with vite but with expo-cli as it says right at the start of your error message: error expo-cli#6.0.2:. As the expo-cli docs state:
Only Node.js LTS releases (even-numbered) are recommended
The latest node LTS version being 16.17.1

Unable to solve crypto module in react-native

I'm trying to use web3 on my react-native application, but I get the error of "Unable to solve crypto module in react-native".
I tried to solve using rn-nodeify but I get even more error.
So I was trying to create an alias in my package.json in order to map each import or require to "crypto" to "crypto-js" or "crypto-browserify".
I tried module-aliases with no luck.
In my dependencies I tried doing the following with no luck:
"crypto": "crypto-js"
Which is the right way to create alias of module to other module?
You can put the git address yourself and convert it into your own nickname.
Example
set package.json
"any-aliasses": "ko-devHong/react-native-foreground-service" // Unconditionally, the highest level version is downloaded.
package install
yarn install or npm install
Use
import AnyForeGroundService from 'any-aliasses'

Jest + WebStorm + yarn workspaces = SyntaxError: Cannot use import statement outside a module

Running yarn test works, but starting a test using the IntelliJ WebStorm run button fails with following error:
Test suite failed to run
C:\pavel\repo\projectxy\libs\ui-components-redux\src\features\forms\__tests__\duck.test.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { apiErrorsToFieldErrors, apiErrorsToGeneralErrors, prepareApiErrors } from '../duck';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at ScriptTransformer._transformAndBuildScript (../../node_modules/#jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (../../node_modules/#jest/transform/build/ScriptTransformer.js:579:25)
Put the real root directory in the Jest template + observe Webstorm to fill the configuration file field.
Explanation: Webstorm estimates the working directory as the one where package.json sits, so it guesses the lib, not the main package.json (with workspaces definition). This causes the configuration file to not to be found.

Phantomjs error while running tests in angular cli

I am trying to run ng test in Angular Cli project using phantom browser and I am getting below error. I googled it and realized that it has something to do with polyfill (Backward compatibility?). I want to understand what's wrong here and how to fix this issue. Thanks in advance!
PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
TypeError: undefined is not an object (evaluating '(_a = ((Object))).assign.apply')
at webpack:///~/#angular/common/src/pipes/intl.js:187:0 <- src/test.ts:34449
you need to uncomment those from your polyfills.ts
import 'core-js/es6/object';
import 'core-js/es6/array';
import 'intl'; // Run `npm install --save intl`.

Cannot resolve module 'jqwidgets-framework' npm

I have installed the module jqwidgets-framework from npm.
It should be the official as it's stated on jqwidgets.com
When I try to import it with :
import jqx from 'jqwidgets-framework';
I get the error when I bundle it with webpack.
Module not found: Error: Cannot resolve module 'jqwidgets-framework'
I know that the syntax works as I import knockout and jquery the same way.
If anyone has got it to work I would like to know.
The proper way to install the jqwidgets-framework npm package is:
npm i jqwidgets-framework
or:
npm install jqwidgets-framework
Sources:
https://www.npmjs.com/package/jqwidgets-framework
http://www.jqwidgets.com/jquery-widgets-documentation/documentation/package-managers/npm-tutorial.htm