saas_app/eslint.config.mjs

85 lines
2.5 KiB
JavaScript

import js from "@eslint/js";
import reactPlugin from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import jsxA11y from "eslint-plugin-jsx-a11y";
import importPlugin from "eslint-plugin-import";
import tseslint from "typescript-eslint";
export default [
// Configuração base JavaScript
js.configs.recommended,
// Configurações recomendadas para TypeScript
...tseslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
ignores: [
"node_modules/**",
".next/**",
"out/**",
"dist/**"
],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.json",
},
globals: {
React: true,
JSX: true,
},
},
plugins: {
react: reactPlugin,
"react-hooks": reactHooks,
"jsx-a11y": jsxA11y,
import: importPlugin,
},
settings: {
react: { version: "detect" },
"import/resolver": {
node: { extensions: [".js", ".jsx", ".ts", ".tsx"] },
typescript: {},
},
},
rules: {
/* React */
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
"react/jsx-uses-vars": "warn",
/* Hooks */
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
/* Importação e organização */
"import/order": [
"error",
{
groups: [
["builtin", "external"],
["internal"],
["parent", "sibling", "index"],
],
pathGroups: [
{
pattern: "@/**",
group: "internal",
position: "after",
},
],
alphabetize: { order: "asc", caseInsensitive: true },
"newlines-between": "always",
},
],
"import/no-duplicates": "error",
"import/newline-after-import": ["error", { count: 1 }],
/* Gerais */
"no-unused-vars": "warn",
},
},
];