Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): [no-misused-spread] correct and elaborate string spread report message#10751
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
09e9931
bb6061d
a11ffc6
1af6d6f
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -57,8 +57,13 @@ export default createRule<Options, MessageIds>({ | ||
'Using the spread operator on a Map in an object will result in an empty object. Did you mean to use `Object.fromEntries(map)` instead?', | ||
noPromiseSpreadInObject: | ||
'Using the spread operator on Promise in an object can cause unexpected behavior. Did you forget to await the promise?', | ||
noStringSpread: [ | ||
'Using the spread operator on a string can mishandle special characters, as can `.split("")`.', | ||
'- `...` produces Unicode code points, which will decompose complex emojis into individual emojis', | ||
'- .split("") produces UTF-16 code units, which breaks rich characters in many languages', | ||
'Consider using `Intl.Segmenter` for locale-aware string decomposition.', | ||
"Otherwise, if you don't need to preserve emojis or other non-Ascii characters, disable this lint rule on this line or configure the 'allow' rule option.", | ||
].join('\n'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. To anybody with opinions on string splitting: please bikeshed theheck out of this message! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Nice!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. +1. I think it makes sense to say "consider using Intl.Segmenter for robust, locale-aware string decomposition." first, and then "Otherwise, if you don't need to preserve emojis or other non-Ascii characters, disable, etc..." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. the people have spoken | ||
}, | ||
schema: [ | ||
{ | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.