cuth / cuth/postcss-pxtorem

Some errors happen when set exclude value to function: Range out of order in character class In regex.

Open
#93 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
173
PR merge metrics
No merged PRs in 30d

Description

I am using version "postcss-pxtorem": "^6.0.0" and I'm having the same issue. This is part of my config in postcss.config.js.

```js
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*'],
unitPrecision: 5,
exclude: (file) => {
const BLACK_LIST = [
// cause error
'pages/patient-report/fang'
]
return BLACK_LIST.some(item => file.indexOf(item) !== -1)
}
}
```
When I execute the plugin, I will get the following errors,I think the error occurs when call the function `filePath.match(exclude)`.

![CleanShot 2023-01-13 at 17 46 52](https://user-images.githubusercontent.com/16186659/212289731-5a593c09-7cc0-405b-aeaf-cc9a8e6daa13.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

The report provides postcss.config.js and points to filePath.match(exclude) as the suspected entry point. Reproduce the failure with the shown exclude function and inspect how that value is handled. Done means the reported regex error no longer occurs while the exclusion behavior still works; no target test or patch location is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.