Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No identifiers allowed directly after numeric literal #222

Closed
MuhammadRafeh opened this issue Sep 12, 2021 · 5 comments
Closed

No identifiers allowed directly after numeric literal #222

MuhammadRafeh opened this issue Sep 12, 2021 · 5 comments
Labels

Comments

@MuhammadRafeh
Copy link

In Simple Words: It gives error 'No identifiers allowed directly after numeric literal' when use Lighten in React Native, have a look below:

import Color from "color";
const lighterColor = Color(color).lighten(0.8) //Here we have Title Error!
@Qix-
Copy link
Owner

Qix- commented Sep 12, 2021

Please show the actual error.

@Gabrielhvcardoso
Copy link

Gabrielhvcardoso commented Sep 12, 2021

Getting the following error:

./node_modules/color/index.js 246:28

Module parse failed: Identifier directly after number (246:28)

File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     for (const [i, element] of rgb.entries()) {
|       const chan = element / 255;
>       lum[i] = chan <= 0.039_28 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
|     }
|

when i just import and construct new object:

import Color from 'color';

export function isDark(color: string): boolean {
  const clr = Color(color);
  return clr.isDark();
}

in a new create-react-app project.

I'm getting that error with @4.0.0 and @4.0.1, but it's working at @^3.2.1.
My @types/color version is @^3.0.2

@Qix-
Copy link
Owner

Qix- commented Sep 13, 2021

See #204.

@Qix- Qix- closed this as completed Sep 13, 2021
@Qix- Qix- added the wontfix label Sep 13, 2021
@Gabrielhvcardoso
Copy link

As i've said, this problem affect a ReactJS app, I can't just import the color package in a project file because it throws that error event even if a do not create an instance of it.

Well, I'm going to stay using the version ^3.0.2 which works well, but keep it on your radar. Thank you.

@Qix-
Copy link
Owner

Qix- commented Sep 15, 2021

but keep it on your radar

There's nothing to keep on my radar. Staying on v3 is the appropriate action if your tools/environment do not support modern javascript.

Repository owner locked as resolved and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants