n/file-extension-in-import
eslint-plugin-n
Safe autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/file-extension-in-import": "error",
},
},
];Enforce the style of file extensions in import declarations
import foo from "./path/to/a/file"import foo from "./path/to/a/file.js"import eslint from "eslint"
import foo from "./path/to/a/file.js"import eslint from "eslint"
import foo from "./path/to/a/file"import eslint from "eslint"
import script from "./script"
import styles from "./styles.css"
import logo from "./logo.png"Examples from the ESLint documentation.
n/file-extension-in-import
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/file-extension-in-import": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce using process.getBuiltinModule() to load Node.js built-in modules