@@ -3160,6 +3160,19 @@ describe("Linter with FlatConfigArray", () => {
31603160 { name : "__defineSetter__" , writeable : true } ,
31613161 ) ;
31623162 } ) ;
3163+
3164+ it ( "should define a global named __proto__" , ( ) => {
3165+ assertGlobalVariable (
3166+ "/*global __proto__ */" ,
3167+ { } ,
3168+ { name : "__proto__" , writeable : false } ,
3169+ ) ;
3170+ assertGlobalVariable (
3171+ "/*global __proto__:writeable */" ,
3172+ { } ,
3173+ { name : "__proto__" , writeable : true } ,
3174+ ) ;
3175+ } ) ;
31633176 } ) ;
31643177
31653178 describe ( "when evaluating code containing a /*global */ block with sloppy whitespace" , ( ) => {
@@ -3808,6 +3821,47 @@ describe("Linter with FlatConfigArray", () => {
38083821 linter . verify ( code , config ) ;
38093822 assert ( spy && spy . calledOnce ) ;
38103823 } ) ;
3824+
3825+ it ( "variable named __proto__ should be exported" , ( ) => {
3826+ const code = "/* exported __proto__ */\nvar __proto__;" ;
3827+ let spy ;
3828+ const config = {
3829+ plugins : {
3830+ test : {
3831+ rules : {
3832+ checker : {
3833+ create ( context ) {
3834+ spy = sinon . spy ( node => {
3835+ const scope =
3836+ context . sourceCode . getScope (
3837+ node ,
3838+ ) ,
3839+ proto = getVariable (
3840+ scope ,
3841+ "__proto__" ,
3842+ ) ;
3843+
3844+ assert . isTrue ( proto . eslintUsed ) ;
3845+ assert . isTrue (
3846+ proto . eslintExported ,
3847+ ) ;
3848+ } ) ;
3849+
3850+ return { Program : spy } ;
3851+ } ,
3852+ } ,
3853+ } ,
3854+ } ,
3855+ } ,
3856+ languageOptions : {
3857+ sourceType : "script" ,
3858+ } ,
3859+ rules : { "test/checker" : "error" } ,
3860+ } ;
3861+
3862+ linter . verify ( code , config ) ;
3863+ assert ( spy . calledOnce ) ;
3864+ } ) ;
38113865 } ) ;
38123866
38133867 describe ( "/*eslint*/ Comments" , ( ) => {
0 commit comments