{"id":23707034,"url":"https://github.com/mbuchalik/eslint-plugin-node-imports","last_synced_at":"2026-05-01T17:35:26.256Z","repository":{"id":65346429,"uuid":"590430374","full_name":"MBuchalik/eslint-plugin-node-imports","owner":"MBuchalik","description":"Prevent imports from Node.js core modules","archived":false,"fork":false,"pushed_at":"2023-04-20T09:04:12.000Z","size":628,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T20:10:04.573Z","etag":null,"topics":["eslint","eslint-plugin","eslint-rules"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MBuchalik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-18T11:58:27.000Z","updated_at":"2024-08-05T08:40:02.000Z","dependencies_parsed_at":"2023-02-10T15:45:27.357Z","dependency_job_id":null,"html_url":"https://github.com/MBuchalik/eslint-plugin-node-imports","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MBuchalik%2Feslint-plugin-node-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MBuchalik%2Feslint-plugin-node-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MBuchalik%2Feslint-plugin-node-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MBuchalik%2Feslint-plugin-node-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MBuchalik","download_url":"https://codeload.github.com/MBuchalik/eslint-plugin-node-imports/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786251,"owners_count":19696772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","eslint-plugin","eslint-rules"],"created_at":"2024-12-30T16:02:45.597Z","updated_at":"2026-02-03T05:30:14.674Z","avatar_url":"https://github.com/MBuchalik.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-node-imports\n\n\u003e An ESLint plugin that contains a rule to prevent imports from Node.js core modules\n\nHave you ever accidentally made an import from a Node.js core module like `assert` or `fs` in an environment that does not support these core modules? `eslint-plugin-node-imports` helps: This plugin contains a rule that forbids imports from Node.js core modules.\n\n## Usage\n\nFirst, install this eslint plugin:\n\n```\nnpm install --save-dev eslint-plugin-node-imports\n```\n\nThen, add the following to the `plugins` sections of your eslint config file:\n\n```js\nplugins: ['node-imports'],\n```\n\nFinally, you can activate the rule:\n\n```js\nrules: {\n  'node-imports/no-node-import': 'error',\n}\n```\n\n## Advanced configuration\n\nIt is possible to allow certain modules. For instance, to allow the \"fs\" module, use the following setting:\n\n```js\nrules: {\n  'node-imports/no-node-import': ['error', { allowList: ['fs'] }],\n}\n```\n\n**Important:** It is only possible to allow top-level modules. If, for instance, you want to allow imports from `assert/strict`, you have to allow the entire `assert` module:\n\n```js\nrules: {\n  'node-imports/no-node-import': ['error', { allowList: ['assert'] }],\n}\n```\n\n## Examples\n\nExamples of **incorrect** code:\n\n```ts\n// 'node-imports/no-node-import': 'error',\nimport { chmod } from 'fs';\n\nimport { chmod } from 'node:fs';\n\nimport { fail } from 'assert/strict';\n\n// 'node-imports/no-node-import': ['error', { allowList: ['path'] }],\nimport { chmod } from 'fs';\n\nimport { chmod } from 'node:fs';\n\nimport { fail } from 'assert/strict';\n```\n\nExamples of **correct** code:\n\n```ts\n// 'node-imports/no-node-import': 'error',\nimport { item } from 'non-core-module';\n\nimport { item } from '../util';\n\n// 'node-imports/no-node-import': ['error', { allowList: ['fs'] }],\nimport { chmod } from 'fs';\n\nimport { chmod } from 'node:fs';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuchalik%2Feslint-plugin-node-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbuchalik%2Feslint-plugin-node-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbuchalik%2Feslint-plugin-node-imports/lists"}