From aac51bd00b433b613cefb7e135daec4110cb30af Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Tue, 12 Sep 2023 12:50:06 -0500 Subject: [PATCH] chore: disallow node builtins in runtime (#8523) --- .eslintrc.cjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ad881979b..0e247943a 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,3 +1,5 @@ +const { builtinModules } = require('module') + module.exports = { extends: [ 'plugin:@typescript-eslint/recommended-type-checked', @@ -54,6 +56,16 @@ module.exports = { 'prefer-const': 'off', }, overrides: [ + { + // Ensure Node builtins aren't included in Astro's server runtime + files: ['packages/astro/src/runtime/**/*.ts'], + rules: { + "no-restricted-imports": ["error", { + "paths": [...builtinModules], + "patterns": ["node:*"] + }], + } + }, { files: ['packages/**/test/*.js', 'packages/**/*.js'], env: {