{"_id":"@anderjason/eslint-plugin-import-boundary","_rev":"3-89a47ac29668fc25b9122ebc8d00dfe8","name":"@anderjason/eslint-plugin-import-boundary","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@anderjason/eslint-plugin-import-boundary","version":"0.1.0","description":"An ESLint plugin to enforce import boundaries. Disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.","main":"index.js","scripts":{"test":"jest"},"author":{"name":"Jason Anderson","email":"jason@gearsandwires.com"},"license":"MIT","bugs":{"url":"https://github.com/anderjason/eslint-plugin-import-boundary/issues"},"repository":{"type":"git","url":"git+https://github.com/anderjason/eslint-plugin-import-boundary.git"},"homepage":"https://github.com/anderjason/eslint-plugin-import-boundary","devDependencies":{"eslint":"^7.32.0","jest":"^29.6.2"},"gitHead":"0ee70488fdee97b597c8205eadd70a88db57fbe9","_id":"@anderjason/eslint-plugin-import-boundary@0.1.0","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-uAQKpUSyxelsf8vCJIJ3tc53XQH/JbpQr1JCfD46DgqiqG889qQCUwsISK3MkS/5hPLpAXb7DSFe8YTCgkC6mQ==","shasum":"affbdab8973836f85e0f3702a37e06fce75e2ebf","tarball":"https://registry.npmjs.org/@anderjason/eslint-plugin-import-boundary/-/eslint-plugin-import-boundary-0.1.0.tgz","fileCount":5,"unpackedSize":7788,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGN/VNNblIyAAKrkMPAuaPPx/D0KeViJWIhlw85X1C5NAiEAp/Ff1G5YYfTNoMDmbp6yompxj8Y+pgwSivBKAkB2ydw="}]},"_npmUser":{"name":"anderjason","email":"jason@gearsandwires.com"},"directories":{},"maintainers":[{"name":"anderjason","email":"jason@gearsandwires.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin-import-boundary_0.1.0_1690908431257_0.6526564981931386"},"_hasShrinkwrap":false},"0.1.1":{"name":"@anderjason/eslint-plugin-import-boundary","version":"0.1.1","description":"An ESLint plugin to enforce import boundaries. Disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.","main":"index.js","scripts":{"test":"jest"},"author":{"name":"Jason Anderson","email":"jason@gearsandwires.com"},"license":"MIT","bugs":{"url":"https://github.com/anderjason/eslint-plugin-import-boundary/issues"},"repository":{"type":"git","url":"git+https://github.com/anderjason/eslint-plugin-import-boundary.git"},"homepage":"https://github.com/anderjason/eslint-plugin-import-boundary","devDependencies":{"eslint":"^7.32.0","jest":"^29.6.2"},"gitHead":"da6afe22cb1ff376fcb3c57316395e6b7eb9f6a3","_id":"@anderjason/eslint-plugin-import-boundary@0.1.1","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-OUyAdu3vhBPDQs8XOeqBHEPcf0AZ3OiWzlg+yHNDfOVnW1EONjPX8zV87+s2X3OVev+sJIE8Bw3J/Tkt5CSQOw==","shasum":"eed506906ea41c92bd741eeb3b798be9e3b53a9e","tarball":"https://registry.npmjs.org/@anderjason/eslint-plugin-import-boundary/-/eslint-plugin-import-boundary-0.1.1.tgz","fileCount":5,"unpackedSize":10933,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFG9NfIo8WxPIWiULnUuukdzQRAiGkjwcPSCmxI40/a/AiEA1olyrQTUiphUtTVBq+O/H9zEPw8GFcf8Kz17Nvm6610="}]},"_npmUser":{"name":"anderjason","email":"jason@gearsandwires.com"},"directories":{},"maintainers":[{"name":"anderjason","email":"jason@gearsandwires.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin-import-boundary_0.1.1_1690911348420_0.39483406448932246"},"_hasShrinkwrap":false},"0.1.2":{"name":"@anderjason/eslint-plugin-import-boundary","version":"0.1.2","description":"An ESLint plugin to enforce import boundaries. Disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.","main":"index.js","scripts":{"test":"jest"},"author":{"name":"Jason Anderson","email":"jason@gearsandwires.com"},"license":"MIT","bugs":{"url":"https://github.com/anderjason/eslint-plugin-import-boundary/issues"},"repository":{"type":"git","url":"git+https://github.com/anderjason/eslint-plugin-import-boundary.git"},"homepage":"https://github.com/anderjason/eslint-plugin-import-boundary","devDependencies":{"eslint":"^7.32.0","jest":"^29.6.2"},"gitHead":"82da7d4a9380318b2c0b7813b17fb35c8cf53cd4","_id":"@anderjason/eslint-plugin-import-boundary@0.1.2","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-k8DBjnT2XggRNKp65FN9fUx+Qt4C2ZFY1EOzPr5Cjf1oKo/xIjFIC70VyPDCxf0H/+LqN6w2VYo152sIui2XuQ==","shasum":"1fd57e74d4085741665ddefb48977a18aa86ce05","tarball":"https://registry.npmjs.org/@anderjason/eslint-plugin-import-boundary/-/eslint-plugin-import-boundary-0.1.2.tgz","fileCount":5,"unpackedSize":15246,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXxd9RuNEaMfhE4g9q+704CIzfUP3DsKLNxzeDCfRzIQIgIfPGx4vEUXWHECK3hxxfvbAJ5KZDpF8FebMvebA15sE="}]},"_npmUser":{"name":"anderjason","email":"jason@gearsandwires.com"},"directories":{},"maintainers":[{"name":"anderjason","email":"jason@gearsandwires.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin-import-boundary_0.1.2_1690928078803_0.13904386507384303"},"_hasShrinkwrap":false},"0.1.3":{"name":"@anderjason/eslint-plugin-import-boundary","version":"0.1.3","description":"An ESLint plugin to enforce import boundaries. Disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.","main":"index.js","scripts":{"test":"jest"},"author":{"name":"Jason Anderson","email":"jason@gearsandwires.com"},"license":"MIT","bugs":{"url":"https://github.com/anderjason/eslint-plugin-import-boundary/issues"},"repository":{"type":"git","url":"git+https://github.com/anderjason/eslint-plugin-import-boundary.git"},"homepage":"https://github.com/anderjason/eslint-plugin-import-boundary","devDependencies":{"eslint":"^7.32.0","jest":"^29.6.2"},"gitHead":"90a6dae606c6c54cc8d488809965247a1a7a5624","_id":"@anderjason/eslint-plugin-import-boundary@0.1.3","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-+AUvJ1PmUU4/iL6TWf0/YSmupAptSrzzxngHeOVSlmaiPHnO7dOrTil0YeKe7AMzt9W/I+Hi9FEQrlHdDZf/6w==","shasum":"f067ddfd991f2c14d09ff03dffee5921732f6d16","tarball":"https://registry.npmjs.org/@anderjason/eslint-plugin-import-boundary/-/eslint-plugin-import-boundary-0.1.3.tgz","fileCount":5,"unpackedSize":15588,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzbCuXVEBavlAtDIwTcU9cJEnIvn5zyl6rhnL+I4pSAwIgf4MphoOaPRNx5z95trzn93lvE2DFp6S+ZlGFeYCEvjw="}]},"_npmUser":{"name":"anderjason","email":"jason@gearsandwires.com"},"directories":{},"maintainers":[{"name":"anderjason","email":"jason@gearsandwires.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-plugin-import-boundary_0.1.3_1690949005095_0.3070766702593162"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-01T16:47:11.203Z","0.1.0":"2023-08-01T16:47:11.443Z","modified":"2023-08-02T04:03:25.346Z","0.1.1":"2023-08-01T17:35:48.627Z","0.1.2":"2023-08-01T22:14:38.994Z","0.1.3":"2023-08-02T04:03:25.245Z"},"maintainers":[{"name":"anderjason","email":"jason@gearsandwires.com"}],"description":"An ESLint plugin to enforce import boundaries. Disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.","homepage":"https://github.com/anderjason/eslint-plugin-import-boundary","repository":{"type":"git","url":"git+https://github.com/anderjason/eslint-plugin-import-boundary.git"},"author":{"name":"Jason Anderson","email":"jason@gearsandwires.com"},"bugs":{"url":"https://github.com/anderjason/eslint-plugin-import-boundary/issues"},"license":"MIT","readme":"# @anderjason/eslint-plugin-import-boundary\n\nThis ESLint plugin provides a rule to enforce import boundaries in a project. It disallows the use of private (underscore-prefixed) directory names following a public directory name in an import path.\n\n## Rule: No Cross-Boundary Imports\n\nIn an import path, a private name (starting with an underscore) cannot follow a public name. You can have multiple public or private names in a row, and you can use the '..' syntax freely. Violation of these rules leads to an ESLint error.\n\nThese same rules apply to exports, so if a file would not be able to import from a path, it cannot export from that path either.\n\n### Examples\n\nAssuming our project structure is as follows:\n\n```\nsrc\n│\n└─── toolbar\n│   │   index.ts (Exports specific things meant to be used across boundaries)\n│   │\n│   └─── _components\n│   │   └─── Toolbar.tsx\n│   │   └─── SomePrivateToolbarButton.tsx\n│   │   └─── SomePrivateToolbarIcon.tsx\n│       └─── ...\n│   │\n│   └─── __helpers\n│       └─── toolbarHelpers.ts\n│       └─── somePrivateHelpers.ts\n│       └─── ...\n│\n└─── core\n    │   index.ts (Exports specific things meant to be used across boundaries)\n│   │\n│   └─── _components\n│   │   └─── Button.tsx\n│   │   └─── SomePrivateComponent.tsx\n│       └─── ...\n│   │\n│   └─── _hooks\n│       └─── useKeyboardShortcut.ts\n│       └─── useSomePrivateHook.ts\n│       └─── ...\n```\n\n```javascript\n// In src/toolbar/index.ts, we export the Toolbar component to make it public\nexport { Toolbar } from \"./_components/Toolbar\";\n\n// Then, we can import the Toolbar component from anywhere\n✅ import { Toolbar } from \"../../toolbar\";\n\n// However, we cannot import a private component from the toolbar area\n❌ import { SomePrivateToolbarButton } from \"../toolbar/_components/SomePrivateToolbarButton\";\n\n// Similarly, in src/core/index.ts:\n\nexport { Button } from \"./_components/Button\";\nexport { useKeyboardShortcut } from \"./_utils/someUtil\";\n\n// Then, we can import the Button component from anywhere\n✅ import { Button } from \"./core\";\n\n// We can also import the useKeyboardShortcut hook from anywhere\n✅ import { useKeyboardShortcut } from \"../../../core\";\n\n// However, any file outside of the core area cannot import a private utility from inside the core area\n❌ import { useSomePrivateHook } from \"../core/_utils/useSomePrivateHook\";\n```\n\nPrivate folders can appear at any level in the folder tree, and they can be nested. Private folders can have any name that starts with an underscore.\n\n```javascript\nsrc\n│\n└─── core\n│   │   index.ts\n│   │\n│   └─── _components\n│   │   │\n│   │   └─── Modal\n│   │   │   │   index.ts\n│   │   │   │\n│   │   │   └─── _private\n│   │   │   │   └─── Modal.tsx\n│   │   │   │   └─── Overlay.tsx\n│   │   │   │   └─── modalHelpers.ts\n│   │   │   │   └─── ...\n\n// In this example, we want other components to be able to import\n// Modal, but not be able to import Overlay or modalHelpers.\n\n// In src/core/_components/Modal/index.ts,\n// we make Modal available to other components in the core area:\nexport { Modal } from \"./_private/Modal\"\n\n// Then we can import the Modal component from anywhere in the core area,\n// for example from other core components:\n✅ import { Modal } from \"../Modal\";\n\n// We cannot currently import Modal from outside the core folder:\n❌ import { Modal } from \"../core/_components/Modal\";\n\n// We cannot import the Overlay component from outside the Modal folder\n❌ import { Overlay } from \"../core/_components/Modal/_private/Overlay\";\n\n// If we wanted to make Modal public outside of core, we could either:\n\n// Move it to a public folder like src/core/components/Modal,\n// and then import it from anywhere:\n✅ import { Modal } from \"../../core/components/Modal\";\n\n// Or, export it from src/core/index.ts:\nexport { Modal } from \"./_components/Modal\";\n\n// And then we could import Modal from anywhere\n✅ import { Modal } from \"../../../core\";\n```\n\nNesting private folders is optional and depends on the overall structure and needs of your project.\n\n## Installation\n\nAssuming you already have ESLint installed, run:\n\n```bash\nnpm install @anderjason/eslint-plugin-import-boundary --save-dev\n```\n\n## Usage\n\nAdd `@anderjason/import-boundary` to the plugins section of your .eslintrc configuration file, and configure the rule under the rules section.\n\n```javascript\nmodule.exports = {\n  plugins: [\"@anderjason/import-boundary\"],\n  rules: {\n    \"@anderjason/import-boundary/no-cross-boundary-imports\": \"error\",\n  },\n};\n```\n\n## Running Tests\n\n```bash\nnpm test\n```\n\n## Contributing\n\nIf you're interested in contributing, please open a pull request with your changes. Ensure that your changes pass the tests and adhere to the existing coding style.\n","readmeFilename":"README.md"}