Skip to content

Instantly share code, notes, and snippets.

@fatihkayan20
Last active October 28, 2024 08:30
Show Gist options
  • Save fatihkayan20/5f13d020c779cad5900363b9d5e075a2 to your computer and use it in GitHub Desktop.
Save fatihkayan20/5f13d020c779cad5900363b9d5e075a2 to your computer and use it in GitHub Desktop.
Expo eslint configuration
// https://docs.expo.dev/guides/using-eslint/
module.exports = {
extends: "expo",
plugins: [
"react-hooks",
"@typescript-eslint",
"check-file",
"@stylistic/js",
"no-relative-import-paths",
],
rules: {
"no-console": "error",
"max-lines": ["error", 250],
"react-hooks/exhaustive-deps": "error",
"react/display-name": "off",
"@typescript-eslint/no-unused-vars": "error",
"import/no-unused-modules": [
"error",
{ unusedExports: true, ignoreExports: ["src/app", "app.config.ts"] },
],
"import/export": "error", // Ensures there's only one export per file
"import/no-default-export": "error", // Disallows default exports
"check-file/filename-naming-convention": [
"error",
{
"src/**/(?!hooks/**/*.{jsx,tsx,ts,js}": "PASCAL_CASE",
"src/**/hooks/**/use*.{ts,tsx}": "CAMEL_CASE",
},
],
"check-file/folder-naming-convention": [
"error",
{
"src/**/(?!app/|app/**/*/)/**/": "KEBAB_CASE",
},
],
"import/order": [
"error",
{
pathGroups: [
{
pattern: "@/**/types/**",
group: "type",
},
{
pattern: "@/**/lib/**",
group: "internal",
position: "after",
},
{
pattern: "@/**/components/**",
group: "internal",
position: "after",
},
{
pattern: "@/**/stores/**",
group: "internal",
position: "after",
},
{
pattern: "@/**/utils/**",
group: "internal",
position: "after",
},
{
pattern: "@/**/hooks/**",
group: "internal",
position: "after",
},
],
groups: [
"builtin",
"external",
"type",
"internal",
"parent",
"sibling",
"index",
],
"newlines-between": "always",
alphabetize: { order: "asc", caseInsensitive: true },
},
],
"@typescript-eslint/no-explicit-any": "error",
"react/jsx-no-bind": ["error", { allowArrowFunctions: true }],
"react/jsx-key": "error",
"react/jsx-curly-brace-presence": [
"error",
{ props: "never", children: "never" },
],
"lines-around-comment": [
"error",
{
beforeLineComment: true,
beforeBlockComment: true,
allowBlockStart: true,
allowClassStart: true,
allowObjectStart: true,
allowArrayStart: true,
},
],
"import/newline-after-import": [
"error",
{
count: 1,
},
],
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
"space-before-function-paren": [
"error",
{
anonymous: "always",
asyncArrow: "always",
named: "never",
},
],
"space-before-blocks": "error",
curly: "error",
"padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "*", next: "return" },
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
{
blankLine: "any",
prev: ["singleline-const", "let", "var"],
next: ["singleline-const", "let", "var"],
},
{ blankLine: "always", prev: "directive", next: "*" },
{ blankLine: "any", prev: "directive", next: "directive" },
],
"no-relative-import-paths/no-relative-import-paths": ["warn"],
},
overrides: [
{
files: ["src/app/**", "app.config.ts"],
rules: {
"import/no-default-export": "off",
},
},
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment