File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## 0.4.8
4
+
5
+ - Support ` export const foo = -1 ` with ` allowConstantExport ` (fixes #43 )
6
+
3
7
## 0.4.7
4
8
5
9
- Support ` export { Component as default } ` (fixes #41 )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " eslint-plugin-react-refresh" ,
3
- "version" : " 0.4.7 " ,
3
+ "version" : " 0.4.8 " ,
4
4
"type" : " module" ,
5
5
"license" : " MIT" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -110,6 +110,11 @@ const valid = [
110
110
code : "export const foo = 4; export const Bar = () => {};" ,
111
111
options : [ { allowConstantExport : true } ] ,
112
112
} ,
113
+ {
114
+ name : "Component and negative number constant with allowConstantExport" ,
115
+ code : "export const foo = -4; export const Bar = () => {};" ,
116
+ options : [ { allowConstantExport : true } ] ,
117
+ } ,
113
118
{
114
119
name : "Component and string constant with allowConstantExport" ,
115
120
code : "export const CONSTANT = 'Hello world'; export const Foo = () => {};" ,
Original file line number Diff line number Diff line change @@ -102,9 +102,10 @@ export const onlyExportComponents: TSESLint.RuleModule<
102
102
if (
103
103
allowConstantExport &&
104
104
init &&
105
- ( init . type === "Literal" ||
106
- init . type === "TemplateLiteral" ||
107
- init . type === "BinaryExpression" )
105
+ ( init . type === "Literal" || // 1, "foo"
106
+ init . type === "UnaryExpression" || // -1
107
+ init . type === "TemplateLiteral" || // `Some ${template}`
108
+ init . type === "BinaryExpression" ) // 24 * 60
108
109
) {
109
110
return ;
110
111
}
You can’t perform that action at this time.
0 commit comments