All-inorganic perovskite nanocrystals (NCs) have emerged as a new generation of low-cost semiconducting luminescent system for optoelectronic applications. The room-temperature photoluminescence quantum yields (PLQYs) of these NCs in the green and red spectral range approach unity. However, their PLQYs in the violet are much lower, and an insightful understanding of such poor performance remains missing. We report a general strategy for the synthesis of all-inorganic violet-emitting perovskite NCs with near-unity PLQYs through engineering local order of the lattice by nickel ion doping. A broad range of experimental characterizations, including steady-state and time-resolved luminescence spectroscopy, X-ray absorption spectra, and magic angle spinning nuclear magnetic resonance spectra, reveal that the low PLQY in undoped NCs is associated with short-range disorder of the lattice induced by intrinsic defects such as halide vacancies and that Ni doping can substantially eliminate these defects and result in increased short-range order of the lattice. Density functional theory calculations reveal that Ni doping of perovskites causes an increase of defect formation energy and does not introduce deep trap states in the band gap, which is suggested to be the main reason for the improved local structural order and near-unity PLQY. Our ability to obtain violet-emitting perovskite NCs with near-perfect properties opens the door for a range of applications in violet-emitting perovskite-based devices such as light-emitting diodes, single-photon sources, lasers, and beyond.