mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
bc677d1937
PR-URL: https://github.com/nodejs/node/pull/53950 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import {
|
|
noRestrictedSyntaxCommonAll,
|
|
noRestrictedSyntaxCommonLib,
|
|
requireEslintTool,
|
|
} from '../tools/eslint/eslint.config_utils.mjs';
|
|
import { builtinModules as builtin } from 'node:module';
|
|
|
|
const globals = requireEslintTool('globals');
|
|
|
|
export default [
|
|
{
|
|
files: ['doc/**/*.md/*.{js,mjs,cjs}'],
|
|
rules: {
|
|
// Ease some restrictions in doc examples.
|
|
'no-restricted-properties': 'off',
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
...noRestrictedSyntaxCommonAll,
|
|
...noRestrictedSyntaxCommonLib,
|
|
{
|
|
selector: `CallExpression[callee.name="require"][arguments.0.type="Literal"]:matches(${builtin.map((name) => `[arguments.0.value="${name}"]`).join(',')}),ImportDeclaration:matches(${builtin.map((name) => `[source.value="${name}"]`).join(',')})`,
|
|
message: 'Use `node:` prefix.',
|
|
},
|
|
],
|
|
'no-undef': 'off',
|
|
'no-unused-expressions': 'off',
|
|
'no-unused-vars': 'off',
|
|
'symbol-description': 'off',
|
|
|
|
// Add new ECMAScript features gradually.
|
|
'prefer-const': 'error',
|
|
'prefer-rest-params': 'error',
|
|
'prefer-template': 'error',
|
|
|
|
// Stylistic rules.
|
|
'@stylistic/js/no-multiple-empty-lines': [
|
|
'error',
|
|
{
|
|
max: 1,
|
|
maxEOF: 0,
|
|
maxBOF: 0,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['doc/api_assets/*.js'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
},
|
|
];
|