Skip to content

Commit 28762c8

Browse files
authored
prevent-abbreviations: Support non-ASCII filenames (#2308)
1 parent 3889163 commit 28762c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

rules/prevent-abbreviations.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const getNameReplacements = (name, options, limit = 3) => {
116116
}
117117

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

121121
let hasReplacements = false;
122122
const combinations = words.map(word => {

test/prevent-abbreviations.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,10 @@ test({
19311931
code: 'foo();',
19321932
filename: 'err/http-error.js',
19331933
},
1934+
{
1935+
code: 'foo();',
1936+
filename: 'Мiръ.html',
1937+
},
19341938
// `ignore` option
19351939
{
19361940
code: outdent`

0 commit comments

Comments
 (0)