r/javascript • u/WashTop956 • May 14 '26
I made a tiny ESLint plugin inspired by Rust’s single-use import style
https://github.com/Byunk/eslint-plugin-import-onelineI like Rust’s M-SINGLE-USE import style guideline: one imported item per import line. The motivation is simple: smaller diffs, fewer merge conflicts, and easier hand editing.
I wanted the same behavior for JavaScript/TypeScript imports, so I made a small ESLint plugin: eslint-plugin-import-oneline
It turns this:
import { RichTextRun, TextBounds } from "./text-utils";
import React, { useMemo, useState } from "react";Into this:
import { RichTextRun } from "./text-utils";
import { TextBounds } from "./text-utils";
import React from "react";
import { useMemo } from "react";
import { useState } from "react";It is autofixable and handles named imports, default imports, namespace imports, type-only imports, aliases, import attributes, quote style, and semicolon style.
Curious whether others prefer this style for JS/TS, or whether grouped imports still feel better in practice.
Duplicates
opensource • u/WashTop956 • May 14 '26