1
1
mirror of https://github.com/theoludwig/eslint-config-conventions.git synced 2024-10-05 03:36:10 +02:00

feat: add @typescript-eslint/no-require-imports

Not considered breaking, as `@typescript-eslint/no-var-requires` is already there.
You should already not use, `require` in your codebase.
It was a mistake to not include this rule.

However, the newly added rule, will now report an error for the following example code:
```tsx
const [loaded, error] = useFonts({
  CustomFont: require("../assets/fonts/CustomFont.ttf")
})
```

Must read: "Every change breaks someones workflow", https://xkcd.com/1172/
This commit is contained in:
Théo LUDWIG 2024-02-16 20:02:41 +01:00
parent 256a5024d6
commit 6e6a8d7aa1
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -321,6 +321,7 @@
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unsafe-unary-minus": "error",
"@typescript-eslint/no-array-delete": "error",
"@typescript-eslint/prefer-as-const": "error",