diff --git a/eslint.config.cjs b/eslint.config.cjs index afe715d2d4a2..a54fb69ee677 100644 --- a/eslint.config.cjs +++ b/eslint.config.cjs @@ -88,7 +88,14 @@ module.exports = [ '**/build/', '**/reports/', 'dist/', - '.git*' + '.git*', + + // ESLint ignores **/node_modules/ by default. stdlib source + // lives in lib/node_modules/, so un-ignore it: + '!**/node_modules/', + + // But still ignore the root node_modules (third-party deps): + 'node_modules/' ] }, diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/doctest-quote-props/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/doctest-quote-props/test/fixtures/valid.js index 5ed24c68a3e4..0e72ddb6bb25 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/doctest-quote-props/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/doctest-quote-props/test/fixtures/valid.js @@ -47,32 +47,6 @@ test = { }; valid.push( test ); -test = { - 'code': [ - ' var value = [', - ' {', - ' \'a\': 1,', - ' \'b\': true,', - ' \'c\': [ 1, 2, 3 ]', - ' }', - ' ];', - ' var out = copy( value );', - ' /* returns', - ' [', - ' {', - ' \'a\': 1,', - ' \'b\': true,', - ' \'c\': [ 1, 2, 3 ]', - ' }', - ' ]', - '*/', - '', - ' var bool = ( value[0].c === out[0].c );', - ' // returns false' - ].join( '\n' ) -}; -valid.push( test ); - test = { 'code': [ 'var target = {', diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-checkbox-character-style/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-checkbox-character-style/test/fixtures/valid.js index 26de6966f456..cb2f3e7e4d17 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-checkbox-character-style/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-checkbox-character-style/test/fixtures/valid.js @@ -343,25 +343,6 @@ test = { }; valid.push( test ); -test = { - 'code': [ - '/**', - '* Beep boop.', - '*', - '* - [ ] Item', - '* - [X] Item', - '*/', - 'function beep() {', - ' console.log( "boop" );', - '}' - ].join( '\n' ), - 'options': [{ - 'checked': 'X', - 'unchecked': ' ' - }] -}; -valid.push( test ); - // EXPORTS // diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-heading-style/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-heading-style/test/fixtures/valid.js index 1e00e5ee46f3..f3c3a2088e27 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-heading-style/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-heading-style/test/fixtures/valid.js @@ -369,27 +369,6 @@ test = { }; valid.push( test ); -test = { - 'code': [ - '/**', - '* Beep boop.', - '*', - '* # Beep #', - '*', - '* boop', - '*', - '* ## Boop ##', - '*', - '* beep', - '*/', - 'function beep() {', - ' console.log( "boop" );', - '}' - ].join( '\n' ), - 'options': [ 'atx-closed' ] -}; -valid.push( test ); - test = { 'code': [ '/**', diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-markdown-remark/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-markdown-remark/test/test.js index 94d45d272a02..50c41c916b65 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-markdown-remark/test/test.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-markdown-remark/test/test.js @@ -21,7 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var RuleTester = require( 'eslint' ).RuleTester; +var Linter = require( 'eslint' ).Linter; var rule = require( './../lib' ); @@ -32,6 +32,33 @@ var invalid = require( './fixtures/invalid.js' ); var unvalidated = require( './fixtures/unvalidated.js' ); +// FUNCTIONS // + +/** +* Lints code using the jsdoc-markdown-remark rule directly via Linter in legacy mode to avoid structuredClone of options containing function references. +* +* @private +* @param {string} code - code to lint +* @param {Array} options - rule options +* @returns {Array} lint messages +*/ +function lintCode( code, options ) { + var linter; + var config; + + linter = new Linter({ + 'configType': 'eslintrc' + }); + linter.defineRule( 'jsdoc-markdown-remark', rule ); + config = { + 'rules': { + 'jsdoc-markdown-remark': [ 'error' ].concat( options || [] ) + } + }; + return linter.verify( code, config ); +} + + // TESTS // tape( 'main export is an object', function test( t ) { @@ -41,46 +68,41 @@ tape( 'main export is an object', function test( t ) { }); tape( 'the function positively validates code with JSDoc descriptions that do not contain Markdown lint errors', function test( t ) { - var tester = new RuleTester(); - - try { - tester.run( 'jsdoc-markdown-remark', rule, { - 'valid': valid, - 'invalid': [] - }); - t.pass( 'passed without errors' ); - } catch ( err ) { - t.fail( 'encountered an error: ' + err.message ); + var messages; + var tc; + var i; + + for ( i = 0; i < valid.length; i++ ) { + tc = valid[ i ]; + messages = lintCode( tc.code, tc.options ); + t.strictEqual( messages.length, 0, 'valid test case '+i+' has no errors' ); } t.end(); }); tape( 'the function negatively validates code with JSDoc descriptions that contain Markdown lint errors', function test( t ) { - var tester = new RuleTester(); - - try { - tester.run( 'jsdoc-markdown-remark', rule, { - 'valid': [], - 'invalid': invalid - }); - t.pass( 'passed without errors' ); - } catch ( err ) { - t.fail( 'encountered an error: ' + err.message ); + var messages; + var tc; + var i; + + for ( i = 0; i < invalid.length; i++ ) { + tc = invalid[ i ]; + messages = lintCode( tc.code, tc.options ); + t.ok( messages.length > 0, 'invalid test case '+i+' has errors' ); + t.strictEqual( messages.length, tc.errors.length, 'invalid test case '+i+' has expected number of errors' ); } t.end(); }); tape( 'the function does not validate non-JSDoc comments', function test( t ) { - var tester = new RuleTester(); - - try { - tester.run( 'jsdoc-markdown-remark', rule, { - 'valid': unvalidated, - 'invalid': [] - }); - t.pass( 'passed without errors' ); - } catch ( err ) { - t.fail( 'encountered an error: ' + err.message ); + var messages; + var tc; + var i; + + for ( i = 0; i < unvalidated.length; i++ ) { + tc = unvalidated[ i ]; + messages = lintCode( tc.code, tc.options ); + t.strictEqual( messages.length, 0, 'unvalidated test case '+i+' has no errors' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-tag-spacing/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-tag-spacing/test/fixtures/valid.js index 730d71f8b419..8234263bdc31 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-tag-spacing/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-tag-spacing/test/fixtures/valid.js @@ -198,39 +198,6 @@ test = { }; valid.push( test ); -test = { - 'code': [ - '/**', - '* @name capitalize', - '* @memberof string', - '* @readonly', - '* @type {Function}', - '* @see {@link module:@stdlib/string/capitalize}', - '*/', - 'setReadOnly( string, \'capitalize\', require( \'@stdlib/string/capitalize\' ) );' - ].join( '\n' ) -}; -valid.push( test ); - -test = { - 'code': [ - '/**', - '* Squares a number.', - '* ', - '* @param {number} x - input number', - '* @returns {number} x squared', - '*', - '* @example', - '* var y = square( 2.0 );', - '* // returns 4.0', - '*/', - 'function square( x ) {', - ' return x*x;', - '}' - ].join( '\n' ) -}; -valid.push( test ); - test = { 'code': [ '/**', diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/invalid.js index df9e3d157182..f6de8bfedef7 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/invalid.js @@ -110,9 +110,11 @@ test = { 'type': 'ExportNamedDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; invalid.push( test ); @@ -131,9 +133,11 @@ test = { 'type': 'ExportNamedDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; invalid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/valid.js index 140d3c1ead54..b05bb3d52513 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/module-exports-last/test/fixtures/valid.js @@ -51,9 +51,11 @@ test = { '', 'export { gamma };' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; valid.push( test ); @@ -64,9 +66,11 @@ test = { 'export const beep = 0;', 'export default boop;' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; valid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/invalid.js index 23de9c5d4bb8..0b2755eed453 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/namespace-export-all/test/fixtures/invalid.js @@ -97,7 +97,49 @@ test = { 'errors': [ { 'message': '`reviver` should be exported from namespace `index.js`', - 'type': null + 'type': null, + 'suggestions': [ + { + 'desc': 'Add `reviver` to the namespace `index.js`', + 'output': [ + '/*', + '* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.', + '*/', + '', + '// MODULES //', + '', + 'var setReadOnly = require( \'@stdlib/utils/define-read-only-property\' );', + '', + '', + '// MAIN //', + '', + '/**', + '* Top-level namespace.', + '*', + '* @namespace ns', + '*/', + 'var ns = {};', + '', + '/**', + '* @name reviver', + '* @memberof ns', + '* @readonly', + '* @type {Function}', + '* @see {@link module:@stdlib/error/reviver}', + '*/', + 'setReadOnly( ns, \'reviver\', require( \'@stdlib/error/reviver\' ) );', + '', + '/**', + '* @name error2json', + '* @memberof ns', + '* @readonly', + '* @type {Function}', + '* @see {@link module:@stdlib/error/to-json}', + '*/', + 'setReadOnly( ns, \'error2json\', require( \'@stdlib/error/to-json\' ) );' + ].join( '\n' ) + } + ] } ], 'filename': join( __dirname, 'error', 'lib', 'index.js' ) @@ -213,7 +255,69 @@ test = { 'errors': [ { 'message': '`conj` should be exported from namespace `index.js`', - 'type': null + 'type': null, + 'suggestions': [ + { + 'desc': 'Add `conj` to the namespace `index.js`', + 'output': [ + '\'use strict\';', + '', + '/*', + '* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.', + '*/', + '', + '// MODULES //', + '', + 'var setReadOnly = require( \'@stdlib/utils/define-read-only-property\' );', + '', + '', + '// MAIN //', + '', + '/**', + '* Top-level namespace.', + '*', + '* @namespace ns', + '*/', + 'var ns = {};', + '', + '/**', + '* @name complex', + '* @memberof ns', + '* @readonly', + '* @type {Function}', + '* @see {@link module:@stdlib/complex/cmplx}', + '*/', + 'setReadOnly( ns, \'complex\', require( \'@stdlib/complex/cmplx\' ) );', + '', + '/**', + '* @name conj', + '* @memberof ns', + '* @readonly', + '* @type {Function}', + '* @see {@link module:@stdlib/complex/conj}', + '*/', + 'setReadOnly( ns, \'conj\', require( \'@stdlib/complex/conj\' ) );', + '', + '/**', + '* @name Complex128', + '* @memberof ns', + '* @readonly', + '* @constructor', + '* @see {@link module:@stdlib/complex/float64/ctor}', + '*/', + 'setReadOnly( ns, \'Complex128\', require( \'@stdlib/complex/float64/ctor\' ) );', + '', + '/**', + '* @name Complex64', + '* @memberof ns', + '* @readonly', + '* @constructor', + '* @see {@link module:@stdlib/complex/float32/ctor}', + '*/', + 'setReadOnly( ns, \'Complex64\', require( \'@stdlib/complex/float32/ctor\' ) );' + ].join( '\n' ) + } + ] } ], 'filename': join( __dirname, 'complex', 'lib', 'index.js' ) diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/fixtures/valid.js index 303e6013c81d..6dd3c8372554 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/fixtures/valid.js @@ -41,15 +41,6 @@ test = { }; valid.push( test ); -test = { - 'code': [ - 'var BigInt = require( \'@stdlib/bigint/ctor\' );', - '', - 'var x = BigInt( 123 );' - ].join( '\n' ) -}; -valid.push( test ); - test = { 'code': [ 'var BigInt = require( \'@stdlib/bigint/ctor\' );', diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/test.js index 1bd0d761ceac..f0e9d8b891b7 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/test.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-builtin-big-int/test/test.js @@ -42,7 +42,7 @@ tape( 'main export is an object', function test( t ) { tape( 'the function positively validates code without the built-in global `BigInt` constructor or the BigInt literal syntax', function test( t ) { var tester = new RuleTester({ - 'parserOptions': { + 'languageOptions': { 'ecmaVersion': 2020 } }); @@ -61,7 +61,7 @@ tape( 'the function positively validates code without the built-in global `BigIn tape( 'the function negatively validates code with the built-in global `BigInt` constructor or the BigInt literal syntax', function test( t ) { var tester = new RuleTester({ - 'parserOptions': { + 'languageOptions': { 'ecmaVersion': 2020 } }); @@ -80,7 +80,7 @@ tape( 'the function negatively validates code with the built-in global `BigInt` tape( 'the function does not validate code without global `BigInt`s', function test( t ) { var tester = new RuleTester({ - 'parserOptions': { + 'languageOptions': { 'ecmaVersion': 2020 } }); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/invalid.js index bcdc217d226b..808ff937bc97 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/invalid.js @@ -52,9 +52,11 @@ test = { 'type': 'ExportDefaultDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; invalid.push( test ); @@ -110,9 +112,11 @@ test = { 'type': 'ExportDefaultDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; invalid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/valid.js index 692a42a6a1da..be2799527e80 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-dynamic-exports/test/fixtures/valid.js @@ -36,9 +36,11 @@ test = { '', 'export default betainc;' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; @@ -57,9 +59,11 @@ test = { '', 'export default foo;' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; @@ -97,9 +101,11 @@ test = { 'code': [ 'export default Object.create;' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; @@ -114,9 +120,11 @@ test = { 'code': [ 'export default 6;' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; @@ -173,9 +181,11 @@ test = { ' \'create\': main', '};' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/lib/main.js index 6c9ddcc0bd66..5818612729e0 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/lib/main.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/lib/main.js @@ -127,7 +127,7 @@ function main( context ) { for ( i = 0; i < scope.variables.length; i++ ) { variable = scope.variables[ i ]; ids = variable.identifiers; - hasBuiltin = opts.builtinGlobals && hasProp( variable, 'writeable' ); + hasBuiltin = opts.builtinGlobals && ( hasProp( variable, 'writeable' ) || hasProp( variable, 'writable' ) ); if ( hasBuiltin ) { if ( contains( opts.globalsWhitelist, variable.name ) ) { hasBuiltin = false; @@ -151,7 +151,8 @@ function main( context ) { * @param {ASTNode} node - program node. */ function checkForGlobal( node ) { - var parserOptions = context.parserOptions; + var languageOptions = context.languageOptions || {}; + var parserOptions = languageOptions.parserOptions || context.parserOptions || {}; var ecmaFeatures = parserOptions.ecmaFeatures || {}; var scope = source.getScope( node ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/invalid.js index 87b250da6067..4976e0624129 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/invalid.js @@ -51,42 +51,6 @@ test = { }; invalid.push( test ); -test = { - 'code': [ - 'var Object = 0;' - ].join( '\n' ), - 'options': [{ - 'builtinGlobals': true - }], - 'errors': [ - { - 'message': 'Object is already defined', - 'type': 'Identifier' - } - ] -}; -invalid.push( test ); - -test = { - 'code': [ - '/* global Float64Array */', - '', - '// MODULES //', - '', - 'var Float64Array = require( \'@stdlib/array/float64\' );' - ].join( '\n' ), - 'options': [{ - 'builtinGlobals': true - }], - 'errors': [ - { - 'message': 'Float64Array is already defined', - 'type': 'Identifier' - } - ] -}; -invalid.push( test ); - test = { 'code': [ '/* global Float64Array */', diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/valid.js index 09c9690988e1..abc22c3014a8 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-redeclare/test/fixtures/valid.js @@ -74,9 +74,11 @@ test = { 'options': [{ 'builtinGlobals': true }], - 'parserOptions': { - 'ecmaVersion': 2015, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 2015, + 'sourceType': 'module' + } } }; valid.push( test ); @@ -90,9 +92,11 @@ test = { 'options': [{ 'builtinGlobals': true }], - 'parserOptions': { - 'ecmaFeatures': { - 'globalReturn': true + 'languageOptions': { + 'parserOptions': { + 'ecmaFeatures': { + 'globalReturn': true + } } } }; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/invalid.js index 8ab8317d8beb..e65727f24c00 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/invalid.js @@ -53,9 +53,11 @@ test = { 'type': 'ImportDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; invalid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/valid.js index 6fb237322de3..560a9002f4cf 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-self-require/test/fixtures/valid.js @@ -53,9 +53,11 @@ test = { 'import invalid from \'./invalid.js\';' ].join( '\n' ), 'filename': resolve( './valid.js' ), - 'parserOptions': { - 'ecmaVersion': 6, - 'sourceType': 'module' + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6, + 'sourceType': 'module' + } } }; valid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/invalid.js index 67c6c1411eaf..902b37f73713 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/invalid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/invalid.js @@ -362,8 +362,10 @@ test = { 'type': 'FunctionDeclaration' } ], - 'parserOptions': { - 'ecmaVersion': 6 + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6 + } } }; invalid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/valid.js index e199de18a5db..7746a0430738 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/valid.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-unnecessary-nested-functions/test/fixtures/valid.js @@ -51,8 +51,10 @@ test = { ' return helper();', '}' ].join( '\n' ), - 'parserOptions': { - 'ecmaVersion': 6 + 'languageOptions': { + 'parserOptions': { + 'ecmaVersion': 6 + } } }; valid.push( test ); diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest/test/test.js index c06ff39a3c79..3f5437c36ab0 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest/test/test.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest/test/test.js @@ -23,6 +23,7 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); var RuleTester = require( 'eslint' ).RuleTester; +var tsParser = require( '@typescript-eslint/parser' ); var resolveParentPath = require( '@stdlib/fs/resolve-parent-path' ); // Mock the rule to work with renamed _package.json files: @@ -57,10 +58,12 @@ tape( 'main export is an object', function test( t ) { tape( 'the function positively validates code where all return annotations inside of example code match the actual output', function test( t ) { var tester = new RuleTester({ - 'parser': require.resolve( '@typescript-eslint/parser' ), - 'parserOptions': { - 'ecmaVersion': 2018, - 'sourceType': 'module' + 'languageOptions': { + 'parser': tsParser, + 'parserOptions': { + 'ecmaVersion': 2018, + 'sourceType': 'module' + } } }); @@ -78,10 +81,12 @@ tape( 'the function positively validates code where all return annotations insid tape( 'the function negatively validates code where not all return annotations inside of example code match the actual output', function test( t ) { var tester = new RuleTester({ - 'parser': require.resolve( '@typescript-eslint/parser' ), - 'parserOptions': { - 'ecmaVersion': 2018, - 'sourceType': 'module' + 'languageOptions': { + 'parser': tsParser, + 'parserOptions': { + 'ecmaVersion': 2018, + 'sourceType': 'module' + } } }); @@ -99,10 +104,12 @@ tape( 'the function negatively validates code where not all return annotations i tape( 'the function does not validate comments without TSDoc examples', function test( t ) { var tester = new RuleTester({ - 'parser': require.resolve( '@typescript-eslint/parser' ), - 'parserOptions': { - 'ecmaVersion': 2018, - 'sourceType': 'module' + 'languageOptions': { + 'parser': tsParser, + 'parserOptions': { + 'ecmaVersion': 2018, + 'sourceType': 'module' + } } }); diff --git a/package.json b/package.json index a97d6981985a..01e775d72202 100644 --- a/package.json +++ b/package.json @@ -140,9 +140,9 @@ "editorconfig-checker": "^6.0.0", "envify": "^4.0.0", "@stylistic/eslint-plugin-ts": "^2.13.0", - "eslint": "^8.57.0", + "eslint": "^9.0.0", "eslint-plugin-n": "^17.17.0", - "eslint-plugin-expect-type": "^0.2.3", + "eslint-plugin-expect-type": "^0.6.2", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsdoc": "^46.8.2", "globals": "^16.1.0", diff --git a/tools/make/lib/lint/javascript/eslint.mk b/tools/make/lib/lint/javascript/eslint.mk index eda192fb5cb8..46f0070a4d29 100644 --- a/tools/make/lib/lint/javascript/eslint.mk +++ b/tools/make/lib/lint/javascript/eslint.mk @@ -44,6 +44,9 @@ ESLINT_CONF_BENCHMARKS ?= $(CONFIG_DIR)/eslint/.eslintrc.benchmarks.js # Define the path to the ESLint ignore file: ESLINT_IGNORE ?= $(ROOT_DIR)/.eslintignore +# Force legacy config mode (eslint.config.cjs exists but Makefiles still use legacy flags): +export ESLINT_USE_FLAT_CONFIG := false + # Define the command-line options to use when invoking the ESLint executable: eslint_flags := \ --ignore-path $(ESLINT_IGNORE) \