import/no-internal-modules
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/no-internal-modules": "error",
},
},
];/**
* in my-project/entry.js
*/
import { settings } from './app/index'; // Reaching to "./app/index" is not allowed
import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed
import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed
export { settings } from './app/index'; // Reaching to "./app/index" is not allowed
export * from './reducer/user'; // Reaching to "./reducer/user" is not allowed/**
* in my-project/entry.js
*/
import 'source-map-support/register';
import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export getUser from '../actions/getUser';/**
* in my-project/entry.js
*/
import 'source-map-support/register';
import { settings } from '../app';
import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export { settings } from '../app';/**
* in my-project/entry.js
*/
import 'source-map-support';
import { getUser } from '../actions';
export * from 'source-map-support';
export { getUser } from '../actions';Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
import/no-internal-modules
eslint-plugin-import
import importPlugin from "eslint-plugin-import";
export default [
{
plugins: { import: importPlugin },
rules: {
"import/no-internal-modules": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce which files can be imported in a given folder.
Enforce a leading comment with the webpackChunkName for dynamic imports.
Forbid modules without exports, or exports without matching import in another module.
Forbid imported names marked with @deprecated documentation tag.
Enforce either using, or omitting, the node: protocol when importing Node.js builtin modules.
Forbid potentially ambiguous parse goal (script vs. module).