@@ -2314,6 +2314,103 @@ describe("ESLint", () => {
23142314assert . match ( results [ 1 ] . messages [ 0 ] . message , / ' b a z ' / u) ;
23152315} ) ;
23162316
2317+ // https://github.com/eslint/eslint/issues/18706
2318+ it ( "should disregard ignore pattern '/'" , async ( ) => {
2319+ eslint = new ESLint ( {
2320+ cwd :getFixturePath ( "ignores-relative" ) ,
2321+ overrideConfigFile :true ,
2322+ overrideConfig :[
2323+ {
2324+ ignores :[ "/" ]
2325+ } ,
2326+ {
2327+ plugins :{
2328+ "test-plugin" :{
2329+ rules :{
2330+ "no-program" :{
2331+ create ( context ) {
2332+ return {
2333+ Program ( node ) {
2334+ context . report ( {
2335+ node,
2336+ message :"Program is disallowed."
2337+ } ) ;
2338+ }
2339+ } ;
2340+ }
2341+ }
2342+ }
2343+ }
2344+ } ,
2345+ rules :{
2346+ "test-plugin/no-program" :"warn"
2347+ }
2348+ }
2349+ ]
2350+ } ) ;
2351+
2352+ const results = await eslint . lintFiles ( [ "**/a.js" ] ) ;
2353+
2354+ assert . strictEqual ( results . length , 2 ) ;
2355+ assert . strictEqual ( results [ 0 ] . filePath , getFixturePath ( "ignores-relative" , "a.js" ) ) ;
2356+ assert . strictEqual ( results [ 0 ] . messages . length , 1 ) ;
2357+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . severity , 1 ) ;
2358+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . ruleId , "test-plugin/no-program" ) ;
2359+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . message , "Program is disallowed." ) ;
2360+ assert . strictEqual ( results [ 1 ] . filePath , getFixturePath ( "ignores-relative" , "subdir" , "a.js" ) ) ;
2361+ assert . strictEqual ( results [ 1 ] . messages . length , 1 ) ;
2362+ assert . strictEqual ( results [ 1 ] . messages [ 0 ] . severity , 1 ) ;
2363+ assert . strictEqual ( results [ 1 ] . messages [ 0 ] . ruleId , "test-plugin/no-program" ) ;
2364+ assert . strictEqual ( results [ 1 ] . messages [ 0 ] . message , "Program is disallowed." ) ;
2365+ } ) ;
2366+
2367+ it ( "should not skip an unignored file in base path when all files are initially ignored by '**'" , async ( ) => {
2368+ eslint = new ESLint ( {
2369+ cwd :getFixturePath ( "ignores-relative" ) ,
2370+ overrideConfigFile :true ,
2371+ overrideConfig :[
2372+ {
2373+ ignores :[
2374+ "**" ,
2375+ "!a.js"
2376+ ]
2377+ } ,
2378+ {
2379+ plugins :{
2380+ "test-plugin" :{
2381+ rules :{
2382+ "no-program" :{
2383+ create ( context ) {
2384+ return {
2385+ Program ( node ) {
2386+ context . report ( {
2387+ node,
2388+ message :"Program is disallowed."
2389+ } ) ;
2390+ }
2391+ } ;
2392+ }
2393+ }
2394+ }
2395+ }
2396+ } ,
2397+ rules :{
2398+ "test-plugin/no-program" :"warn"
2399+ }
2400+ }
2401+ ]
2402+ } ) ;
2403+
2404+ const results = await eslint . lintFiles ( [ "**/a.js" ] ) ;
2405+
2406+ assert . strictEqual ( results . length , 1 ) ;
2407+ assert . strictEqual ( results [ 0 ] . filePath , getFixturePath ( "ignores-relative" , "a.js" ) ) ;
2408+ assert . strictEqual ( results [ 0 ] . messages . length , 1 ) ;
2409+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . severity , 1 ) ;
2410+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . ruleId , "test-plugin/no-program" ) ;
2411+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . message , "Program is disallowed." ) ;
2412+ } ) ;
2413+
23172414} ) ;
23182415
23192416