@@ -1037,6 +1037,56 @@ describe("FlatESLint", () => {
10371037 await assert . rejects ( async ( ) => await eslint . lintFiles ( [ "lib/cli.js" ] ) , / E x p e c t e d o b j e c t w i t h p a r s e \( \) o r p a r s e F o r E S L i n t \( \) m e t h o d / u) ;
10381038 } ) ;
10391039
1040+ describe ( "Overlapping searches" , ( ) => {
1041+ it ( "should not lint the same file multiple times when the file path was passed multiple times" , async ( ) => {
1042+ const cwd = getFixturePath ( ) ;
1043+
1044+ eslint = new FlatESLint ( {
1045+ cwd,
1046+ overrideConfigFile : true
1047+ } ) ;
1048+
1049+ const results = await eslint . lintFiles ( [ "files/foo.js" , "files/../files/foo.js" , "files/foo.js" ] ) ;
1050+
1051+ assert . strictEqual ( results . length , 1 ) ;
1052+ assert . strictEqual ( results [ 0 ] . filePath , path . resolve ( cwd , "files/foo.js" ) ) ;
1053+ assert . strictEqual ( results [ 0 ] . messages . length , 0 ) ;
1054+ assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
1055+ } ) ;
1056+
1057+ it ( "should not lint the same file multiple times when the file path and a pattern that matches the file were passed" , async ( ) => {
1058+ const cwd = getFixturePath ( ) ;
1059+
1060+ eslint = new FlatESLint ( {
1061+ cwd,
1062+ overrideConfigFile : true
1063+ } ) ;
1064+
1065+ const results = await eslint . lintFiles ( [ "files/foo.js" , "files/foo*" ] ) ;
1066+
1067+ assert . strictEqual ( results . length , 1 ) ;
1068+ assert . strictEqual ( results [ 0 ] . filePath , path . resolve ( cwd , "files/foo.js" ) ) ;
1069+ assert . strictEqual ( results [ 0 ] . messages . length , 0 ) ;
1070+ assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
1071+ } ) ;
1072+
1073+ it ( "should not lint the same file multiple times when multiple patterns that match the file were passed" , async ( ) => {
1074+ const cwd = getFixturePath ( ) ;
1075+
1076+ eslint = new FlatESLint ( {
1077+ cwd,
1078+ overrideConfigFile : true
1079+ } ) ;
1080+
1081+ const results = await eslint . lintFiles ( [ "files/f*.js" , "files/foo*" ] ) ;
1082+
1083+ assert . strictEqual ( results . length , 1 ) ;
1084+ assert . strictEqual ( results [ 0 ] . filePath , path . resolve ( cwd , "files/foo.js" ) ) ;
1085+ assert . strictEqual ( results [ 0 ] . messages . length , 0 ) ;
1086+ assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
1087+ } ) ;
1088+ } ) ;
1089+
10401090 it ( "should report zero messages when given a directory with a .js2 file" , async ( ) => {
10411091 eslint = new FlatESLint ( {
10421092 cwd : path . join ( fixtureDir , ".." ) ,
0 commit comments