Skip to content

Commit

Permalink
migrate to eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkev committed Jul 23, 2024
1 parent 93b22f1 commit f54753a
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 191 deletions.
69 changes: 69 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { fixupConfigRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ["**/dist", "**/.eslintrc.cjs"],
},
...fixupConfigRules(
compat.extends(
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime"
)
),
{
plugins: {
"react-refresh": reactRefresh,
},
languageOptions: {
globals: {
...globals.browser,
},
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
project: [
"./tsconfig.node.json",
"./packages/site/tsconfig.json",
"./packages/site/tsconfig.node.json",
"./packages/webgpu-waveform/tsconfig.json",
"./packages/webgpu-waveform/tsconfig.node.json",
],
tsconfigRootDir: __dirname,
},
},

settings: {
react: {
version: "detect",
},
},

rules: {
"react/no-unescaped-entities": "off",
"react-refresh/only-export-components": [
"warn",
{
allowConstantExport: true,
},
],
},
},
];
Loading

0 comments on commit f54753a

Please sign in to comment.