meta: reword linter messages

PR-URL: https://github.com/nodejs/node/pull/53949
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Aviv Keller 2024-07-21 18:21:42 -04:00 committed by GitHub
parent eb85db4606
commit e8c2acf5de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 13 deletions

View File

@ -346,31 +346,31 @@ export default [
'error', 'error',
{ {
name: '__filename', name: '__filename',
message: 'Use import.meta.url instead', message: 'Use import.meta.url instead.',
}, },
{ {
name: '__dirname', name: '__dirname',
message: 'Not available in ESM', message: 'Not available in ESM.',
}, },
{ {
name: 'exports', name: 'exports',
message: 'Not available in ESM', message: 'Not available in ESM.',
}, },
{ {
name: 'module', name: 'module',
message: 'Not available in ESM', message: 'Not available in ESM.',
}, },
{ {
name: 'require', name: 'require',
message: 'Use import instead', message: 'Use import instead.',
}, },
{ {
name: 'Buffer', name: 'Buffer',
message: 'Import Buffer instead of using the global', message: "Import 'Buffer' instead of using the global.",
}, },
{ {
name: 'process', name: 'process',
message: 'Import process instead of using the global', message: "Import 'process' instead of using the global.",
}, },
] }, ] },
}, },

View File

@ -11,23 +11,23 @@ const noRestrictedSyntax = [
...noRestrictedSyntaxCommonLib, ...noRestrictedSyntaxCommonLib,
{ {
selector: "CallExpression[callee.object.name='assert']:not([callee.property.name='ok']):not([callee.property.name='fail']):not([callee.property.name='ifError'])", selector: "CallExpression[callee.object.name='assert']:not([callee.property.name='ok']):not([callee.property.name='fail']):not([callee.property.name='ifError'])",
message: 'Please only use simple assertions in ./lib', message: 'Only use simple assertions',
}, },
{ {
selector: 'NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError|NodeAggregateError)$/])', selector: 'NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError|NodeAggregateError)$/])',
message: 'Use an error exported by the internal/errors module.', message: "Use an error exported by 'internal/errors' instead.",
}, },
{ {
selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']", selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']",
message: "Please use `require('internal/errors').hideStackFrames()` instead.", message: "Use 'hideStackFrames' from 'internal/errors' instead.",
}, },
{ {
selector: "AssignmentExpression:matches([left.object.name='Error']):matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])", selector: "AssignmentExpression:matches([left.object.name='Error']):matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])",
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'.", message: "Use 'overrideStackTrace' from 'internal/errors' instead.",
}, },
{ {
selector: "ThrowStatement > NewExpression[callee.name=/^ERR_[A-Z_]+$/] > ObjectExpression:first-child:not(:has([key.name='message']):has([key.name='code']):has([key.name='syscall']))", selector: "ThrowStatement > NewExpression[callee.name=/^ERR_[A-Z_]+$/] > ObjectExpression:first-child:not(:has([key.name='message']):has([key.name='code']):has([key.name='syscall']))",
message: 'The context passed into SystemError constructor must have .code, .syscall and .message.', message: 'The context passed into the SystemError constructor must include .code, .syscall, and .message properties.',
}, },
]; ];
@ -504,7 +504,7 @@ export default [
...noRestrictedSyntax, ...noRestrictedSyntax,
{ {
selector: 'VariableDeclarator:has(.init[name="primordials"]) Identifier[name=/Prototype[A-Z]/]:not([name=/^(Object|Reflect)(Get|Set)PrototypeOf$/])', selector: 'VariableDeclarator:has(.init[name="primordials"]) Identifier[name=/Prototype[A-Z]/]:not([name=/^(Object|Reflect)(Get|Set)PrototypeOf$/])',
message: 'We do not use prototype primordials in this file', message: 'Do not use prototype primordials in this file.',
}, },
], ],
}, },