Lint rule to prevent imports of modules from lib/* (#2604)

Summary:
Adds a lint rule that rejects imports such as the following:

```js
import ECMAScriptSourceFunctionValue from "../../lib/values/ECMAScriptSourceFunctionValue.js";
```

The path should contain `src` instead of `lib`.
Pull Request resolved: https://github.com/facebook/prepack/pull/2604

Differential Revision: D10432286

Pulled By: sb98052

fbshipit-source-id: 55542de99643a7bf49f8a290a35af35f9b795c7b
This commit is contained in:
Sapan Bhatia 2018-10-17 12:54:20 -07:00 committed by Facebook Github Bot
parent 7207bfd361
commit f97ccf38d5
2 changed files with 10 additions and 0 deletions

View File

@ -218,6 +218,11 @@
"parser": "flow",
"trailingComma": "es5",
"printWidth": 120,
}],
// Reject imports from lib/*
"no-restricted-imports": ["error", {
"patterns": ["**/../lib/**"]
}]
}
}

5
scripts/.eslintrc Normal file
View File

@ -0,0 +1,5 @@
{
"rules": {
"no-restricted-imports": "off"
}
}