mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

Refs: https://github.com/nodejs/node/pull/57314 PR-URL: https://github.com/nodejs/node/pull/57315 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
30 lines
1 KiB
JavaScript
30 lines
1 KiB
JavaScript
import { createRequire } from 'node:module';
|
|
|
|
export { default as globals } from 'globals';
|
|
|
|
export const importEslintTool = (specifier) => import(specifier);
|
|
|
|
const localRequire = createRequire(new URL(import.meta.url));
|
|
export const resolveEslintTool = (request) => localRequire.resolve(request);
|
|
|
|
export const noRestrictedSyntaxCommonAll = [
|
|
{
|
|
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
|
|
message: '`setInterval()` must be invoked with at least two arguments.',
|
|
},
|
|
{
|
|
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
|
|
message: 'Use `new` keyword when throwing an `Error`.',
|
|
},
|
|
{
|
|
selector: "CallExpression[callee.property.name='substr']",
|
|
message: 'Use String.prototype.slice() or String.prototype.substring() instead of String.prototype.substr()',
|
|
},
|
|
];
|
|
|
|
export const noRestrictedSyntaxCommonLib = [
|
|
{
|
|
selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
|
|
message: '`setTimeout()` must be invoked with at least two arguments.',
|
|
},
|
|
];
|