refactor(core): Lint to restrict @n8n/typeorm to persistence layer (no-changelog) (#9840)

This commit is contained in:
Iván Ovejero
2024-06-24 10:24:05 +02:00
committed by GitHub
parent 2ce97be33e
commit 8e529219df
24 changed files with 61 additions and 0 deletions

View File

@@ -422,6 +422,32 @@ module.exports = {
};
},
},
'misplaced-n8n-typeorm-import': {
meta: {
type: 'error',
docs: {
description:
'Ensure `@n8n/typeorm` is imported only from within the `packages/cli/src/databases` directory.',
recommended: 'error',
},
messages: {
moveImport: 'Move this import to `packages/cli/src/databases/**/*.ts`.',
},
},
create(context) {
return {
ImportDeclaration(node) {
if (
node.source.value === '@n8n/typeorm' &&
!context.getFilename().includes('packages/cli/src/databases/')
) {
context.report({ node, messageId: 'moveImport' });
}
},
};
},
},
};
const isJsonParseCall = (node) =>