-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infra: add eslint and handle floating promises
- Loading branch information
Showing
5 changed files
with
3,008 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
]; |
Oops, something went wrong.