chore: disallow node builtins in runtime (#8523)

This commit is contained in:
Nate Moore 2023-09-12 12:50:06 -05:00 committed by GitHub
parent a02707a8b2
commit aac51bd00b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: {