diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-06-01 16:10:32 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-06-03 17:18:40 +0300 |
commit | 2481facd9ff3af57924c2391c507f13abf73ba3a (patch) | |
tree | fc129276a55a4c56d0e64bdbe927dd70aa868794 /.eslintrc.js | |
parent | 47548d0c81c63a9b760c3c3e0b4b62e1c1ea06e3 (diff) |
tools,doc: forbid CJS globals in ESM code snippets
PR-URL: https://github.com/nodejs/node/pull/38889
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to '.eslintrc.js')
-rw-r--r-- | .eslintrc.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index 9fda1a68397..bda641797e2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -76,6 +76,29 @@ module.exports = { 'doc/api/packages.md/*.js', ], parserOptions: { sourceType: 'module' }, + rules: { 'no-restricted-globals': [ + 'error', + { + name: '__filename', + message: 'Use import.meta.url instead', + }, + { + name: '__dirname', + message: 'Not available in ESM', + }, + { + name: 'exports', + message: 'Not available in ESM', + }, + { + name: 'module', + message: 'Not available in ESM', + }, + { + name: 'require', + message: 'Use import instead', + }, + ] }, }, ], rules: { |