mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
tools: fix require-common-first
lint rule from subfolder
PR-URL: https://github.com/nodejs/node/pull/56325 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
parent
25d895c523
commit
2d67129edb
2 changed files with 7 additions and 1 deletions
|
@ -16,6 +16,12 @@ new RuleTester().run('require-common-first', rule, {
|
|||
code: 'require("common")\n' +
|
||||
'require("assert")'
|
||||
},
|
||||
{
|
||||
code: 'import "../../../../common/index.mjs";',
|
||||
languageOptions: {
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
* @returns {string} module name
|
||||
*/
|
||||
function getModuleName(str) {
|
||||
if (str === '../common/index.mjs') {
|
||||
if (str.startsWith('../') && str.endsWith('/common/index.mjs')) {
|
||||
return 'common';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue