简体   繁体   中英

How to disable TSLint Warning - deep imports

I am getting this warning when compiling an angular universal app:

Warning: Entry point 'my-module' contains deep imports into '/src/app/mocks/myModule.ts'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

I have a paths change in tsconfig, which works and is my desired functionality. I would like to be able to disable this particular warning. I assume there is some change I can make to tslint.json to allow deep imports all together, or to allow it in this particular case.

ESlint seems to have nx-enforce-module-boundaries , but I don't think that is applicable to me since this project uses TSLint. However, I tried it anyway with no success:

{
  "extends": "tslint:recommended",
  "rules": {
    "nx-enforce-module-boundaries": [
      true,
      {
        "allow": [
          ["/src/app/mocks/myModule.ts"]
        ]
      }
    ],
    ...

I can't find anything in TSLint Rules that seem to help me. Any ideas?

I ended up just using a custom webpack, as I could not figure out how to disable to warning. Webpack has no deep-import warnings:

module.exports = {
    plugins: [
        new webpack.NormalModuleReplacementPlugin(/^myModule$/, path.join(__dirname, './src/app/mocks/myModule.mock.server.ts')),
    ]
}

https://github.com/just-jeb/angular-builders/tree/master/packages/custom-webpack

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM