@@ -1549,6 +1549,16 @@ describe("FlatESLint", () => {
15491549 } , / A l l f i l e s m a t c h e d b y ' t e s t s \/ f i x t u r e s \/ c l i - e n g i n e \/ ' a r e i g n o r e d \. / u) ;
15501550 } ) ;
15511551
1552+ it ( "should throw an error when all given files are ignored by a config object that has `name`" , async ( ) => {
1553+ eslint = new FlatESLint ( {
1554+ overrideConfigFile : getFixturePath ( "eslint.config-with-ignores3.js" )
1555+ } ) ;
1556+
1557+ await assert . rejects ( async ( ) => {
1558+ await eslint . lintFiles ( [ "tests/fixtures/cli-engine/" ] ) ;
1559+ } , / A l l f i l e s m a t c h e d b y ' t e s t s \/ f i x t u r e s \/ c l i - e n g i n e \/ ' a r e i g n o r e d \. / u) ;
1560+ } ) ;
1561+
15521562 it ( "should throw an error when all given files are ignored even with a `./` prefix" , async ( ) => {
15531563 eslint = new FlatESLint ( {
15541564 overrideConfigFile : getFixturePath ( "eslint.config_with_ignores.js" )
@@ -1682,6 +1692,29 @@ describe("FlatESLint", () => {
16821692 assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
16831693 } ) ;
16841694
1695+ it ( "should return two messages when given a file in excluded files list by a config object that has `name` while ignore is off" , async ( ) => {
1696+ eslint = new FlatESLint ( {
1697+ cwd : getFixturePath ( ) ,
1698+ ignore : false ,
1699+ overrideConfigFile : getFixturePath ( "eslint.config-with-ignores3.js" ) ,
1700+ overrideConfig : {
1701+ rules : {
1702+ "no-undef" : 2
1703+ }
1704+ }
1705+ } ) ;
1706+ const filePath = fs . realpathSync ( getFixturePath ( "undef.js" ) ) ;
1707+ const results = await eslint . lintFiles ( [ filePath ] ) ;
1708+
1709+ assert . strictEqual ( results . length , 1 ) ;
1710+ assert . strictEqual ( results [ 0 ] . filePath , filePath ) ;
1711+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . ruleId , "no-undef" ) ;
1712+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . severity , 2 ) ;
1713+ assert . strictEqual ( results [ 0 ] . messages [ 1 ] . ruleId , "no-undef" ) ;
1714+ assert . strictEqual ( results [ 0 ] . messages [ 1 ] . severity , 2 ) ;
1715+ assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
1716+ } ) ;
1717+
16851718 // https://github.com/eslint/eslint/issues/16300
16861719 it ( "should process ignore patterns relative to basePath not cwd" , async ( ) => {
16871720 eslint = new FlatESLint ( {
@@ -5724,6 +5757,30 @@ describe("FlatESLint", () => {
57245757 assert . strictEqual ( warnResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
57255758 assert . strictEqual ( warnResult . messages [ 0 ] . severity , 1 ) ;
57265759 } ) ;
5760+
5761+ // https://github.com/eslint/eslint/issues/18261
5762+ it ( "should apply to all files except for 'error.js' even with `ignore: false` option" , async ( ) => {
5763+ const engine = new FlatESLint ( {
5764+ cwd,
5765+ ignore : false
5766+ } ) ;
5767+
5768+ const results = await engine . lintFiles ( "{error,warn}.js" ) ;
5769+
5770+ assert . strictEqual ( results . length , 2 ) ;
5771+
5772+ const [ errorResult , warnResult ] = results ;
5773+
5774+ assert . strictEqual ( errorResult . filePath , path . join ( getPath ( ) , "error.js" ) ) ;
5775+ assert . strictEqual ( errorResult . messages . length , 1 ) ;
5776+ assert . strictEqual ( errorResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
5777+ assert . strictEqual ( errorResult . messages [ 0 ] . severity , 2 ) ;
5778+
5779+ assert . strictEqual ( warnResult . filePath , path . join ( getPath ( ) , "warn.js" ) ) ;
5780+ assert . strictEqual ( warnResult . messages . length , 1 ) ;
5781+ assert . strictEqual ( warnResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
5782+ assert . strictEqual ( warnResult . messages [ 0 ] . severity , 1 ) ;
5783+ } ) ;
57275784 } ) ;
57285785
57295786 describe ( "config with ignores: ['**/*.json']" , ( ) => {
0 commit comments