Skip to content

Commit

Permalink
prevent-abbreviations: Support non-ASCII filenames (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBlm authored Apr 6, 2024
1 parent 3889163 commit 28762c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/prevent-abbreviations.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const getNameReplacements = (name, options, limit = 3) => {
}

// Split words
const words = name.split(/(?=[^a-z])|(?<=[^A-Za-z])/).filter(Boolean);
const words = name.split(/(?=\P{Lowercase_Letter})|(?<=\P{Letter})/u).filter(Boolean);

let hasReplacements = false;
const combinations = words.map(word => {
Expand Down
4 changes: 4 additions & 0 deletions test/prevent-abbreviations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,10 @@ test({
code: 'foo();',
filename: 'err/http-error.js',
},
{
code: 'foo();',
filename: 'Мiръ.html',
},
// `ignore` option
{
code: outdent`
Expand Down

0 comments on commit 28762c8

Please sign in to comment.