web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.7 KiB

  1. # import/no-internal-modules
  2. Use this rule to prevent importing the submodules of other modules.
  3. ## Rule Details
  4. This rule has one option, `allow` which is an array of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns that whitelist paths and import statements that can be imported with reaching.
  5. ### Examples
  6. Given the following folder structure:
  7. ```
  8. my-project
  9. ├── actions
  10. │ └── getUser.js
  11. │ └── updateUser.js
  12. ├── reducer
  13. │ └── index.js
  14. │ └── user.js
  15. ├── redux
  16. │ └── index.js
  17. │ └── configureStore.js
  18. └── app
  19. │ └── index.js
  20. │ └── settings.js
  21. └── entry.js
  22. ```
  23. And the .eslintrc file:
  24. ```
  25. {
  26. ...
  27. "rules": {
  28. "import/no-internal-modules": [ "error", {
  29. "allow": [ "**/actions/*", "source-map-support/*" ]
  30. } ]
  31. }
  32. }
  33. ```
  34. The following patterns are considered problems:
  35. ```js
  36. /**
  37. * in my-project/entry.js
  38. */
  39. import { settings } from './app/index'; // Reaching to "./app/index" is not allowed
  40. import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed
  41. import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed
  42. export { settings } from './app/index'; // Reaching to "./app/index" is not allowed
  43. export * from './reducer/user'; // Reaching to "./reducer/user" is not allowed
  44. ```
  45. The following patterns are NOT considered problems:
  46. ```js
  47. /**
  48. * in my-project/entry.js
  49. */
  50. import 'source-map-support/register';
  51. import { settings } from '../app';
  52. import getUser from '../actions/getUser';
  53. export * from 'source-map-support/register';
  54. export { settings } from '../app';
  55. ```