There are three letters in the New Testament written by John the apostle. The style of writing, and historical allusions, are reminiscent of John's gospel.
The exact date is not known, but these three letters are almost certainly later writings in the New Testament. By that time many false teachers were doing the rounds, and the main purpose of the letters, especially 1 John is to equip the believers to detect false teachings and false teachers. John is thought to have lived in Ephesus before being exiled on Patmos, and the most likely destination for the letters is churches in Ephesus, though they may have had wider circulation as well.
John gives three key tests that must be applied (to ourselves and to others). These are belief, righteousness and love. All three are essential, and in many false teachings and false movements you will find that they focus on one of these, but neglect one or both of the others. For instance you get those who supposedly focus on love, but neglect righteousness (this applies today in the attitude of some towards the Bible's teachings on sexual morality) or belief (such as liberal theology).
However, we are equally wrong if we make sure our theology is as sound as a bell, but have no love (righteousness will often go out of the window as well, consider the Pharisees). In the first letter in Revelation, Ephesus is commended for upholding sound teaching, but is rebuked and warned severely because she has lost her first love.
Nor are good morals on their own any good. They must be coupled with belief and love for God and for others.
Belief, righteousness and love. All three are essential.
There is no agreement on the precise nature of the heresy or heresies being espoused, but they probably had elements of Gnosticism and Docetism. Gnosticism treated matter (evil) and spirit (good) as being completely separate and opposed. This could lead to extremes of licentious behaviour or to asceticism. Docetism denied the incarnation (hence the references in John to Jesus coming in the flesh).