Skip to content

Commit

Permalink
chore: migrate to eslint.config.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Oct 24, 2024
1 parent b9c2521 commit 3a798bc
Show file tree
Hide file tree
Showing 3 changed files with 295 additions and 106 deletions.
77 changes: 77 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
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",
"analyzer/react/types",
"framework-plugins/react/preview/types",
"framework-plugins/vue2/preview/modules",
"framework-plugins/vue3/preview/modules",
"framework-plugins/*/tests/apps",
"**/node_modules",
],
},
...compat.extends(
"eslint-config-prettier",
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",

"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],

"@typescript-eslint/no-var-requires": "off",
"no-constant-condition": "off",
"no-inner-declarations": "off",
"no-console": "error",
"prefer-const": "off",
},
},
];
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"vite-ecosystem-ci:test": "export ONLY_REACT_VERSION=18 && turbo e2e-test --filter=@previewjs/plugin-react -- --grep-invert=error --retries=3 --workers=2"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@types/inquirer": "^9.0.7",
"@types/license-checker": "^25.0.6",
"@types/node": "^20.10.6",
Expand All @@ -37,6 +39,7 @@
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"execa": "^8.0.1",
"globals": "^15.11.0",
"inquirer": "^9.3.7",
"license-checker": "^25.0.1",
"prettier": "^2.8.8",
Expand Down
Loading

0 comments on commit 3a798bc

Please sign in to comment.