@@ -1630,6 +1630,16 @@ describe("ESLint", () => {
16301630} , / 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) ;
16311631} ) ;
16321632
1633+ it ( "should throw an error when all given files are ignored by a config object that has `name`" , async ( ) => {
1634+ eslint = new ESLint ( {
1635+ overrideConfigFile :getFixturePath ( "eslint.config-with-ignores3.js" )
1636+ } ) ;
1637+
1638+ await assert . rejects ( async ( ) => {
1639+ await eslint . lintFiles ( [ "tests/fixtures/cli-engine/" ] ) ;
1640+ } , / 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) ;
1641+ } ) ;
1642+
16331643it ( "should throw an error when all given files are ignored even with a `./` prefix" , async ( ) => {
16341644eslint = new ESLint ( {
16351645overrideConfigFile :getFixturePath ( "eslint.config-with-ignores.js" )
@@ -1775,6 +1785,29 @@ describe("ESLint", () => {
17751785assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
17761786} ) ;
17771787
1788+ 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 ( ) => {
1789+ eslint = new ESLint ( {
1790+ cwd :getFixturePath ( ) ,
1791+ ignore :false ,
1792+ overrideConfigFile :getFixturePath ( "eslint.config-with-ignores3.js" ) ,
1793+ overrideConfig :{
1794+ rules :{
1795+ "no-undef" :2
1796+ }
1797+ }
1798+ } ) ;
1799+ const filePath = fs . realpathSync ( getFixturePath ( "undef.js" ) ) ;
1800+ const results = await eslint . lintFiles ( [ filePath ] ) ;
1801+
1802+ assert . strictEqual ( results . length , 1 ) ;
1803+ assert . strictEqual ( results [ 0 ] . filePath , filePath ) ;
1804+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . ruleId , "no-undef" ) ;
1805+ assert . strictEqual ( results [ 0 ] . messages [ 0 ] . severity , 2 ) ;
1806+ assert . strictEqual ( results [ 0 ] . messages [ 1 ] . ruleId , "no-undef" ) ;
1807+ assert . strictEqual ( results [ 0 ] . messages [ 1 ] . severity , 2 ) ;
1808+ assert . strictEqual ( results [ 0 ] . suppressedMessages . length , 0 ) ;
1809+ } ) ;
1810+
17781811// https://github.com/eslint/eslint/issues/16300
17791812it ( "should process ignore patterns relative to basePath not cwd" , async ( ) => {
17801813eslint = new ESLint ( {
@@ -5698,6 +5731,30 @@ describe("ESLint", () => {
56985731assert . strictEqual ( warnResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
56995732assert . strictEqual ( warnResult . messages [ 0 ] . severity , 1 ) ;
57005733} ) ;
5734+
5735+ // https://github.com/eslint/eslint/issues/18261
5736+ it ( "should apply to all files except for 'error.js' even with `ignore: false` option" , async ( ) => {
5737+ const engine = new ESLint ( {
5738+ cwd,
5739+ ignore :false
5740+ } ) ;
5741+
5742+ const results = await engine . lintFiles ( "{error,warn}.js" ) ;
5743+
5744+ assert . strictEqual ( results . length , 2 ) ;
5745+
5746+ const [ errorResult , warnResult ] = results ;
5747+
5748+ assert . strictEqual ( errorResult . filePath , path . join ( getPath ( ) , "error.js" ) ) ;
5749+ assert . strictEqual ( errorResult . messages . length , 1 ) ;
5750+ assert . strictEqual ( errorResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
5751+ assert . strictEqual ( errorResult . messages [ 0 ] . severity , 2 ) ;
5752+
5753+ assert . strictEqual ( warnResult . filePath , path . join ( getPath ( ) , "warn.js" ) ) ;
5754+ assert . strictEqual ( warnResult . messages . length , 1 ) ;
5755+ assert . strictEqual ( warnResult . messages [ 0 ] . ruleId , "no-unused-vars" ) ;
5756+ assert . strictEqual ( warnResult . messages [ 0 ] . severity , 1 ) ;
5757+ } ) ;
57015758} ) ;
57025759
57035760describe ( "config with ignores: ['**/*.json']" , ( ) => {