Skip to content

Commit b1755e9

Browse files
author
Supriya S
committed
add an option to retain old names if mapping is missing
1 parent a8f71af commit b1755e9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/getClassName.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportM
9898
if (handleMissingStyleName === 'throw') {
9999
throw new Error('Could not resolve the styleName \'' + styleName + '\'.');
100100
}
101-
if (handleMissingStyleName === 'warn') {
101+
else if (handleMissingStyleName === 'warn') {
102102
// eslint-disable-next-line no-console
103103
console.warn('Could not resolve the styleName \'' + styleName + '\'.');
104104
}
105+
else if (handleMissingStyleName === 'retain') {
106+
return styleName;
107+
}
105108
}
106109

107110
return styleModuleMap[styleName];

src/schemas/optionsSchema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"type": "boolean"
5353
},
5454
"handleMissingStyleName": {
55-
"enum": ["throw", "warn", "ignore"]
55+
"enum": ["throw", "warn", "ignore", "retain"]
5656
},
5757
"attributeNames": {
5858
"additionalProperties": false,

0 commit comments

Comments
 (0)