There are a lot of issues when I look at it. I think it could be good, but it needs a bit more limitations. My suggestions would be as follows
Level 7+ Feature: after taking a non-attack action that doesn't cast a spell, you may spend your bonus action to make a single attack. This puts it about on par with the Eldritch Knight's ability to cast a cantrip then attack.
Level 5+ Feature: after taking a non-attack action, you may spend your bonus action to make a single attack. You may not use this ability again until after you take a short rest. Maybe add another use at higher level or a limit per long rest.
Feat: after taking a non-attack action that doesn't cast a spell other than a cantrip, you may make a melee attack as a bonus action. Due to the opportunity cost of the Feat, it doesn't need to be limited, and I think using a cantrip is still fine. Downside is that as a feat it's open to other classes unless you put a specific requirement on it (like Str 13 or something).
Level 7+ Feature: after taking a non-attack action that doesn't cast a spell, you may spend your bonus action to make a single attack. This puts it about on par with the Eldritch Knight's ability to cast a cantrip then attack.
Level 5+ Feature: after taking a non-attack action, you may spend your bonus action to make a single attack. You may not use this ability again until after you take a short rest. Maybe add another use at higher level or a limit per long rest.
Feat: after taking a non-attack action that doesn't cast a spell other than a cantrip, you may make a melee attack as a bonus action. Due to the opportunity cost of the Feat, it doesn't need to be limited, and I think using a cantrip is still fine. Downside is that as a feat it's open to other classes unless you put a specific requirement on it (like Str 13 or something).