budibase/eslint-local-rules/index.js

22 lines
629 B
JavaScript
Raw Normal View History

2023-11-17 14:39:52 +01:00
module.exports = {
"no-budibase-imports": {
create: function (context) {
return {
ImportDeclaration(node) {
const importPath = node.source.value
if (
/^@budibase\/[^/]+\/.*$/.test(importPath) &&
2024-02-05 18:26:39 +01:00
!["@budibase/backend-core/tests","@budibase/string-templates/js-helpers"].includes(importPath)
2023-11-17 14:39:52 +01:00
) {
context.report({
node,
2024-02-05 18:26:39 +01:00
message: `Importing from @budibase is not allowed, except for @budibase/backend-core/tests and @budibase/string-templates/js-helpers.`,
2023-11-17 14:39:52 +01:00
})
}
},
}
},
},
}