Skip to content

Commit

Permalink
Merge pull request #2 from arhamkhnz/chore/eslint-config-update
Browse files Browse the repository at this point in the history
feat: remove Airbnb config & update ESLint to latest version
  • Loading branch information
arhamkhnz authored Nov 11, 2024
2 parents fd016ff + b493ed9 commit 599456f
Show file tree
Hide file tree
Showing 6 changed files with 727 additions and 802 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

101 changes: 0 additions & 101 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"tabWidth": 2,
Expand Down
87 changes: 87 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { FlatCompat } from "@eslint/eslintrc";
import pluginJs from "@eslint/js";
import pluginImport from "eslint-plugin-import";
import pluginReact from "eslint-plugin-react";
import tailwind from "eslint-plugin-tailwindcss";
import globals from "globals";
import tseslint from "typescript-eslint";

const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
{ ignores: [".github/", ".husky/", "node_modules/", ".next/", "src/components/ui", "*.config.ts"] },
{
languageOptions: { globals: globals.browser },
settings: {
react: {
version: "detect",
},
},
plugins: {
import: pluginImport,
tailwindcss: tailwind,
},
},
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
...tseslint.configs.recommended,
...tailwind.configs["flat/recommended"],
...compat.extends("next/core-web-vitals", "next/typescript"),
{
rules: {
// Custom Rules (Not covered by plugins)
"spaced-comment": ["error", "always", { exceptions: ["-", "+"] }],
"key-spacing": ["error", { beforeColon: false, afterColon: true }],
"no-useless-rename": "error",

// Import/Export Rules
"import/no-mutable-exports": "error",
"import/order": [
"error",
{
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
pathGroups: [
{
pattern: "react",
group: "external",
position: "before",
},
{
pattern: "{next,next/**}",
group: "external",
position: "before",
},
],
pathGroupsExcludedImportTypes: [],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"import/newline-after-import": "error",

// Whitespace and Punctuation (Style Rules)
"no-trailing-spaces": "error",
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1 }],
"space-before-function-paren": ["error", "never"],
"space-in-parens": ["error", "never"],
"array-bracket-spacing": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"func-call-spacing": ["error", "never"],
"computed-property-spacing": ["error", "never"],

// Naming Conventions
"no-underscore-dangle": ["error", { allow: ["_id", "__dirname"] }],

// Unused Variables
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn"],
},
},
];
Loading

0 comments on commit 599456f

Please sign in to comment.