Good day! Can you help me please with my situation. I have a folder structure:
my-project
|----- node_modules.private
|----- src
│ |----- main
| |----- api.1
| |----- api.2
| |----- components
| |------ScreenLogin.js
In my project I have a hierarchical API structure. And I need to limit import of entities from ./node_modules.private and from ./src/main/api1 in ./src/main/components. That means I have to get the error in the case if import look like this if the current file being linted is ./src/main/components/ScreenLogin.js:
import { AccountService } from '../../../node-modules.private';
import { ChatService } from '../api.1';
And in my case the rule is set like this in .eslintrc.js:
'rules': {
'import/no-restricted-paths': [
'error',
{
'zones': [
{ 'target': './src/main/components', 'from': './node_modules.private' },
{ 'target': './src/main/components', 'from': './src/main/api.1' },
],
}
],
},
And interesting thing that the first zone is working and I get the error:
27:37 error Unexpected path "../../../node_modules.private/broker" imported in restricted zone import/no-restricted-paths
But it is not possible to get the error from the second zone. Can you recommend me please how can I do it? I have tried many variants, but nothing is working for me.