In the earliest version of The Silmarillion, .... the very few Dwarves who appear are portrayed as evil beings, employers of Orc mercenaries and in conflict with the Elves ... Tolkien was inspired by the dwarves of Norse myths and dwarves of traditional European fairy-tales (such as those of the Brothers Grimm), from whom his Dwarves take their characteristic affinity with mining, metalworking, crafting and avarice.
The representation of Dwarves as evil changed dramatically with The Hobbit. Here the Dwarves became occasionally comedic and bumbling, but largely seen as honourable, serious-minded, but still portraying some negative characteristics... According to The History of the Hobbit, Tolkien was now influenced by his own selective reading of medieval texts regarding the Jewish people and their history. The dwarves' characteristics of being dispossessed of their homeland (the Lonely Mountain, their ancestral home, is the goal the exiled Dwarves seek to reclaim), and living among other groups whilst retaining their own culture are all derived from the medieval image of Jews, whilst their warlike nature stems from accounts in the Hebrew Bible. Medieval views of Jews also saw them as having a propensity for making well-crafted and beautiful things, a trait shared with Norse dwarves.