File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
fixtures/config-file/cloned-config Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -722,7 +722,12 @@ class ConfigArrayFactory {
722
722
*
723
723
* Refer https://github.com/eslint/eslint/issues/12592
724
724
*/
725
- const clonedRulesConfig = rules && JSON . parse ( JSON . stringify ( ( rules ) ) ) ;
725
+ const clonedRulesConfig = rules && JSON . parse (
726
+ JSON . stringify (
727
+ rules ,
728
+ ( key , value ) => ( value === Infinity ? Number . MAX_SAFE_INTEGER : value )
729
+ )
730
+ ) ;
726
731
727
732
// Flatten `extends`.
728
733
for ( const extendName of extendList . filter ( Boolean ) ) {
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+
3
+ rules : {
4
+ "max-len" : [ "error" , { code : Infinity } ]
5
+ }
6
+ } ;
Original file line number Diff line number Diff line change @@ -1172,9 +1172,7 @@ describe("cli", () => {
1172
1172
1173
1173
assert . strictEqual ( exit , 0 ) ;
1174
1174
} ) ;
1175
- } ) ;
1176
1175
1177
- describe ( "config file and input file" , ( ) => {
1178
1176
it ( "should exit with 1 as camelcase has wrong property type" , async ( ) => {
1179
1177
const configPath = getFixturePath ( "config-file" , "cloned-config" , "eslintConfigFail.js" ) ;
1180
1178
const filePath = getFixturePath ( "config-file" , "cloned-config" , "index.js" ) ;
@@ -1187,6 +1185,16 @@ describe("cli", () => {
1187
1185
}
1188
1186
1189
1187
} ) ;
1188
+
1189
+ it ( "should not cause an error when a rule configuration has `Infinity`" , async ( ) => {
1190
+ const configPath = getFixturePath ( "config-file" , "cloned-config" , "configWithInfinity.js" ) ;
1191
+ const filePath = getFixturePath ( "config-file" , "cloned-config" , "index.js" ) ;
1192
+ const args = `--config ${ configPath } ${ filePath } ` ;
1193
+
1194
+ const exit = await cli . execute ( args ) ;
1195
+
1196
+ assert . strictEqual ( exit , 0 ) ;
1197
+ } ) ;
1190
1198
} ) ;
1191
1199
1192
1200
describe ( "inline config and input file" , ( ) => {
You can’t perform that action at this time.
0 commit comments