@@ -68,7 +68,8 @@ define(function (require, exports, module) {
6868
6969 const JSHintErrorES6Error_js = "Missing semicolon. jshint (W033)" ,
7070 ESLintErrorES7Error_js = "Parsing error: Unexpected token ; ESLint (null)" ,
71- ESLintErrorES8Error_js = "Expected '===' and instead saw '=='. ESLint (eqeqeq)" ;
71+ ESLintErrorES8Error_js = "Expected '===' and instead saw '=='. ESLint (eqeqeq)" ,
72+ ESLintReactError_js = "'element' is assigned a value but never used. ESLint (no-unused-vars)" ;
7273
7374 async function _createTempProject ( esLintSpecSubFolder ) {
7475 return await SpecRunnerUtils . getTempTestDirectory ( testRootSpec + esLintSpecSubFolder ) ;
@@ -204,6 +205,27 @@ define(function (require, exports, module) {
204205 } , 5000 ) ;
205206 } ) ;
206207
208+ describe ( "ES8 with react js support project" , function ( ) { // this should cover es7 too
209+ let reactProjectPath ;
210+
211+ beforeAll ( async function ( ) {
212+ reactProjectPath = await _createTempProject ( "es8_react_jsx" ) ;
213+ await _npmInstallInFolder ( reactProjectPath ) ;
214+ await SpecRunnerUtils . loadProjectInTestWindow ( reactProjectPath ) ;
215+ } , 30000 ) ;
216+
217+ it ( "should ESLint jsx reactjs in v8 work as expected" , async function ( ) {
218+ await _openProjectFile ( "react.jsx" ) ;
219+ await _waitForProblemsPanelVisible ( true ) ;
220+ await awaitsFor ( ( ) => {
221+ return $ ( "#problems-panel" ) . text ( ) . includes ( ESLintReactError_js ) ;
222+ } , "ESLint jsx error to be shown" ) ;
223+ } , 5000 ) ;
224+ } ) ;
225+
226+ // we should have an es9 test too as above, but es9 currently doesnt support jsx
227+ // https://github.com/facebook/react/pull/28773 do when available.
228+
207229 describe ( "ES8 module project" , function ( ) {
208230 let es7ProjectPath ;
209231
@@ -225,6 +247,13 @@ define(function (require, exports, module) {
225247 await _loadAndValidateES8Project ( ) ;
226248 } , 5000 ) ;
227249
250+ it ( "should not lint jsx file as ESLint v8 is not configured for react lint" , async function ( ) {
251+ await _openProjectFile ( "react.jsx" ) ;
252+ await awaits ( 100 ) ; // Just wait for some time to prevent any false linter runs
253+ await _waitForProblemsPanelVisible ( false ) ;
254+ expect ( $ ( "#status-inspection" ) . hasClass ( "inspection-disabled" ) ) . toBeTrue ( ) ;
255+ } , 5000 ) ;
256+
228257 it ( "should not show JSHint in desktop app if ESLint is active" , async function ( ) {
229258 await _loadAndValidateES8Project ( ) ;
230259 await awaits ( 100 ) ; // give some time so that jshint has time to complete if there is any.
0 commit comments