The COVENANT. The ten commandments were incorporated INTO the COVENANT, the agreement, between the Lord and Israel.
But again, as the article points out, the violation of these COMMANDMENTS were considered sins BEFORE the covenant was ratified. Read the article.
They were not commandments, before they were commanded, therefore not subject to violation. Sin did occur before the Commandments were given and acts which were unrighteous included those mentioned in the commandments.
Here is another interpretation of the same issue from over a century ago.
Verses 4-9. He makes a contrast between sin and the new nature and shows the marks of one who abides in Christ and one who hath not seen Him neither knows Him. "Every one that practiseth sin, practiseth lawlessness; for sin is lawlessness, this is the correct rendering. The definition of sin as "transgression of the law" is misleading and incorrect. Before there ever was a law, sin was in the world (Romans 5:12, etc.); how then can sin be the transgression of the law? It is not sins of which John speaks, but sin, the evil nature of man. Here the apostle regards man as doing nothing else but his own, natural will; he lives as a natural man. He acts independently of God, and, as far as he is concerned, never does anything but his own will. John is, therefore, not speaking. of positive overt acts, but of the natural man's habitual bent and character, his life and nature.
Arno Gaebelein 1861-1942 "THE FIRST EPISTLE OF JOHN" Chap IV
***But again, as the article points out, the violation of these COMMANDMENTS were considered sins BEFORE the covenant was ratified. Read the article.***
Deu 12:8 Ye shall not do after all [the things] that we do here this day, every man whatsoever [is] right in his own eyes.