Skip to content

Commit

Permalink
infra: add eslint and handle floating promises
Browse files Browse the repository at this point in the history
  • Loading branch information
AviVahl committed Sep 10, 2024
1 parent 7e4b479 commit d64602c
Show file tree
Hide file tree
Showing 5 changed files with 3,008 additions and 230 deletions.
43 changes: 43 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pluginJs from "@eslint/js";
import configPrettier from "eslint-config-prettier";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginTypescript from "typescript-eslint";

for (const config of pluginTypescript.configs.recommendedTypeChecked) {
config.files = ["**/*.{ts,tsx,mts,cts}"]; // ensure config only targets TypeScript files
}

/** @type {import('eslint').Linter.Config[]} */
export default [
{ ignores: ["dist/", "out/"] },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
{ settings: { react: { version: "detect" } } },
{ plugins: { "react-hooks": pluginReactHooks } },
{
rules: {
"no-undef": "off",
"no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
},
},
...pluginTypescript.configs.recommendedTypeChecked,
{ languageOptions: { parserOptions: { projectService: true } } },
{
files: ["**/*.{ts,tsx,mts,cts}"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
},
configPrettier,
];
Loading

0 comments on commit d64602c

Please sign in to comment.