Skip to content

Commit 3033b25

Browse files
authored
Fix error when plugin settings are undefined (#9)
1 parent 662ddbe commit 3033b25

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/chilly-beds-collect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-import-sorting': patch
3+
---
4+
5+
Fix error when plugin settings are undefined

src/utils/resolve-import-group.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ function isScoped(name: string) {
1212
return name && scopedRegExp.test(name)
1313
}
1414

15-
function isFramework(name: string, pattern: string | RegExp) {
15+
function isFramework(name: string, pattern: string) {
1616
return pattern && new RegExp(pattern).test(name)
1717
}
1818

1919
function isThirdParty(name: string) {
2020
return isModule(name) || isScoped(name)
2121
}
2222

23-
function isFirstParty(name: string, pattern: string | RegExp) {
23+
function isFirstParty(name: string, pattern: string) {
2424
return pattern && new RegExp(pattern).test(name)
2525
}
2626

@@ -38,6 +38,7 @@ function isStyle(name: string) {
3838
function assertStringSetting(settings: TSESLint.SharedConfigurationSettings, setting: string) {
3939
let value = settings[setting]
4040

41+
if (!value) return ''
4142
if (typeof value !== 'string') throw new Error(`Invalid value for ${setting}. String expected.`)
4243

4344
return value

0 commit comments

Comments
 (0)