2

Forgive me if this is a really stupid question, but I haven't found any answers yet - or maybe I don't know the correct thing to ask for.

Given the following files that are part of the same project:

  • MyProject.html
  • MyProject.css
  • MyProject.js

(and a MyProject.py that runs on the server to make things happen)

. . . where all three of these items are related and are actually part of a single project and they need to integrate together.

The "html" part of VS code makes sure the html is correct.
The "css" part of VS code makes sure the css is correct.
the JavaScript part of VS code makes sure the javascript is correct.

However, they may not be correct together as a unified whole - I may have changed something in the javascript that references something in the html that may not yet exist - because I forgot to write it, and I don't discover this until I launch things and watch the web-page go all pear-shaped in ways I've never heard of before.

Is there something that will take all these pieces and say "Hey! You changed the definition of this element here in the Javascript but not in the HTML (or the CSS or whatever)

In other words, not only do I want to know if the individual files are syntactically correct, but do they agree with each other?

If there is a "something" that does this, what is it called?

5
  • 2
    That tool will never exist and for good reasons, it'd slow the living hell out of your computer when programmer and wouldn't fair well as a best practice. Though it's cool, it's cooler to write code effectively and not have a slow code editor. So to that suggestion is write your JavaScript and HTML together hand in hand; split view and you won't ever have an issue. CSS can come into play any time. Commented Jan 9, 2022 at 16:35
  • 2
    Your best option for knowing if code is correct, would be a linter but that won't help you with the issues you face if you're calling elements that don't exist or did you'll want to improve how you code these functions/events. Commented Jan 9, 2022 at 16:38
  • Thanks! I strongly suspected that this was the case for the exact reasons that @BGPHiJACK suggested. Too many things would have to know too many things about too many things. (sounds bizarre, but makes sense once you think about it.) - however other seemingly impossible things have happened so I thought I'd ask. Commented Jan 9, 2022 at 19:18
  • @BGPHiJACK Can you take your two comments and make them into an "answer" so I can accept it? You've been a big help and I want to make sure you get the props you deserve. Commented Jan 10, 2022 at 17:37
  • 1
    For sure, commenting is more suitable at times but in future cases if these keywords come up we may have evolved enough to have super-computing on that level and a more improved answer will come about. For now that's the findings and it won't improve for a while. Cheers! Commented Jan 10, 2022 at 19:25

1 Answer 1

1

That tool will never exist and for good reasons, it'd slow the living hell out of your computer when programming and wouldn't fair well as a best practice. Though it's cool, it's cooler to write code effectively and not have a slow code editor. So to that suggestion is write your JavaScript and HTML together hand in hand; split view and you won't ever have an issue. CSS can come into play any time.

Your best option for knowing if code is correct, would be a linter but that won't help you with the issues you face if you're calling elements that don't exist or did you'll want to improve how you code these functions/events.

As requested submitted as an answer for the OP.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.