Custom eslint rule for disallowing cross-package references

Summary:
Added infra for writing and using custom eslint rules and created a rule for disallowing cross-package file imports. Such imports are anti-pattern and they also break standalone plugin bundling.

We still have a bunch of places where Flipper core references code directly from plugins. I've ignored these places for now and added task T71355623 to revisit them.

Reviewed By: passy

Differential Revision: D22998955

fbshipit-source-id: d04cff8fc115ba1300a7e6830306ec134046e927
This commit is contained in:
Anton Nikolaev
2020-08-07 10:19:34 -07:00
committed by Facebook GitHub Bot
parent 6989fa608d
commit 4a1c2a9ece
17 changed files with 428 additions and 72 deletions

View File

@@ -38,6 +38,7 @@ module.exports = {
'import',
'node',
'react-hooks',
'flipper',
],
rules: {
// disable rules from eslint-config-fbjs
@@ -69,6 +70,7 @@ module.exports = {
'import/no-unresolved': [2, {commonjs: true, amd: true}],
'node/no-extraneous-import': [2, {allowModules: builtInModules}],
'node/no-extraneous-require': [2, {allowModules: builtInModules}],
'flipper/no-relative-imports-across-packages': [2],
},
settings: {
'import/resolver': {