railbird-gql/.eslintrc.js
2024-02-19 13:19:21 -08:00

54 lines
1.7 KiB
JavaScript

module.exports = {
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
es2021: true,
node: true,
},
extends: ["plugin:react/recommended", "prettier"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint", "react", "react-hooks", "react-native"],
rules: {
// Best Practices
eqeqeq: ["error", "always"], // Enforce '===' instead of '=='
curly: ["error", "multi-line", "consistent"], // Require curly braces for all control statements
"no-unused-vars": "off", // Not needed with TypeScript
// React Specific
"react/jsx-filename-extension": [1, { extensions: [".tsx"] }], // Allow jsx syntax in .tsx files
"react/react-in-jsx-scope": "off", // Not necessary with React 17+
"react/prop-types": "off", // Not needed with TypeScript
// React-Native Specific
"react-native/no-unused-styles": "warn", // Warn about unused styles
"react-native/split-platform-components": "warn", // Encourage splitting of React Native components into platform-specific files
// TypeScript Specific
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], // Warn about variables that are declared but not used
// Hooks Specific
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
},
};