fisker Cheung
fisker Cheung
I understand we already have [`consistent-destructuring`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-destructuring.md), and it already covers cases I'm going to post, but that rule is buggy, and I don't like destructuring all used properties in one,...
## Fail ```js foo.split('a').join('b'); ``` ## Pass ```js foo.replaceAll('a', 'b'); ``` ```js // Not sure about this, maybe add `g` flag, result the same? foo.split(/a+/).join('b'); ``` ```js // Different with...
```js import {dirname} from 'path'; const foo = dirname(bar) ``` -> ```js import path from 'path'; const foo = path.dirname(bar) ``` I think it's doable.
Fixes #2048
Ref: https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2341#issuecomment-2100545510
Tagged template literals are not safe to change cases. ```js (function (a) {console.log(a.raw[0])})`\u{00b1}` // -> \u{00b1} (function (a) {console.log(a.raw[0])})`\u{00B1}` // -> \u{00B1} ```
Part of #2341, `String.raw` is known as broken, this PR fixes it, but we should collect more libs uses `TemplateObject.raw` and make functions configurable.
Fixes #1989
### Description To avoid escape `\`. ### Fail ```js console.log('"\\" found.'); ``` ```js const directory = "C:\\windows\\style\\path"; ``` ```js new RegExp('foo\\.bar') ``` ### Pass ```js console.log(String.raw`"\" found.`); ``` ```js const...
- [x] Use snapshot test https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2333 - [ ] Improve fix, not use the original text but manipulate tokens - [ ] Improve fix for `node?.parentNode.removeChild(node)` (node can be anything,...