diff options
author | Vendicated <vendicated@riseup.net> | 2022-11-07 23:34:14 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-11-07 23:34:14 +0100 |
commit | f7d9be91407582fd85a70eef89c03a32e37c3c0f (patch) | |
tree | 6522f99d70491aa7f495c287a53fc02c736517ac /.eslintrc.json | |
parent | 955573d31bd1be435b95ddcc24971b47daf02c0b (diff) | |
download | Vencord-f7d9be91407582fd85a70eef89c03a32e37c3c0f.tar.gz Vencord-f7d9be91407582fd85a70eef89c03a32e37c3c0f.tar.bz2 Vencord-f7d9be91407582fd85a70eef89c03a32e37c3c0f.zip |
lint: Disallow utils index imports
This keeps leading to issues due to circular imports.
Import from specific files instead, index just reexports
Diffstat (limited to '.eslintrc.json')
-rw-r--r-- | .eslintrc.json | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index d10b872..111648c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,12 @@ "root": true, "parser": "@typescript-eslint/parser", "ignorePatterns": ["dist", "browser"], - "plugins": ["header", "simple-import-sort", "unused-imports"], + "plugins": [ + "@typescript-eslint", + "header", + "simple-import-sort", + "unused-imports" + ], "rules": { // Since it's only been a month and Vencord has already been stolen // by random skids who rebranded it to "AlphaCord" and erased all license @@ -88,6 +93,46 @@ "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", - "unused-imports/no-unused-imports": "error" + "unused-imports/no-unused-imports": "error", + + "@typescript-eslint/no-restricted-imports": [ + "error", + { + "paths": [ + // shrug, couldn't find a better way since the pattern one doesn't work: + // ["utils", "!utils/*"] + { + "name": "./utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + }, + { + "name": "../utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + }, + { + "name": "../../utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + }, + { + "name": "../../../utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + }, + { + "name": "../../../../utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + }, + { + "name": "../../../../../utils", + "message": "Do not import from index. This might cause issues. Import from the specific file instead.", + "allowTypeImports": true + } + ] + } + ] } } |