Skip to content

Commit

Permalink
update for eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbull committed Jan 11, 2025
1 parent f17a187 commit 772cc41
Show file tree
Hide file tree
Showing 5 changed files with 1,755 additions and 666 deletions.
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"deno.enablePaths": [
"./nbs/ts"
]
],
"eslint.workingDirectories": [
"./frontend/my-app"
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "frontend/my-app/node_modules/typescript/lib",
"eslint.enable": true,
"eslint.debug": true
}
57 changes: 57 additions & 0 deletions frontend/my-app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import js from "@eslint/js";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import { resolve } from "path";
import tseslint from "typescript-eslint";

const tsconfigRootPath = resolve("./tsconfig.json");

export default tseslint.config(
{
ignores: ["dist", "build", "node_modules"],
},
{
files: ["src/**/*.{ts,tsx}"],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser,
...globals.jest,
},
parserOptions: {
project: tsconfigRootPath,
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
settings: {
react: {
version: "detect",
},
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "error",
"no-console": "warn",
},
}
);
Loading

0 comments on commit 772cc41

Please sign in to comment.