Skip to content

Commit

Permalink
Go back to default eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alhassanalbadri committed Nov 30, 2024
1 parent 0f6c0f9 commit 30bead3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 184 deletions.
175 changes: 1 addition & 174 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,176 +1,3 @@
{
"extends": [
"next/core-web-vitals",
"next/typescript"
],
"rules": {
// Code Style
"semi": [
"error",
"always"
], // Require semicolons
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
], // Prefer single quotes
"indent": [
"error",
"tab"
], // Use tabs for indentation
"no-trailing-spaces": "error", // Disallow trailing spaces
"eol-last": [
"error",
"always"
], // Require newline at the end of files
"comma-dangle": [
"error",
"always-multiline"
], // Require dangling commas for multiline
"object-curly-spacing": [
"error",
"always"
], // Require spaces inside curly braces
"array-bracket-spacing": [
"error",
"never"
], // Disallow spaces inside array brackets
// Best Practices
"eqeqeq": [
"error",
"always"
], // Require strict equality
"no-console": [
"warn",
{
"allow": [
"warn",
"error"
]
}
], // Warn about console.logs but allow warn and error
"no-debugger": "error", // Disallow debugger
"curly": [
"error",
"all"
], // Require braces for all control statements
"no-param-reassign": [
"error",
{
"props": true
}
], // Disallow parameter reassignment
"consistent-return": "error", // Enforce consistent return statements
// Variables
"no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
], // Ignore unused variables starting with _
"no-shadow": "error", // Disallow variable shadowing
"no-var": "error", // Disallow var in favor of let/const
"prefer-const": "error", // Prefer const when variables are not reassigned
"no-underscore-dangle": [
"error",
{
"allow": [
"_id",
"_t"
]
}
], // Allow specific underscores (e.g., MongoDB fields)
// Functions
"arrow-body-style": [
"error",
"as-needed"
], // Enforce concise arrow function bodies
"func-names": [
"error",
"as-needed"
], // Require named functions only when needed
"no-unused-expressions": "error", // Disallow unused expressions
"prefer-arrow-callback": "error", // Prefer arrow functions as callbacks
// React/Next.js
"react/jsx-uses-react": "off", // Not required in React 17+
"react/react-in-jsx-scope": "off", // Not required in Next.js
"react/jsx-boolean-value": [
"error",
"never"
], // Omit boolean values in props
"react/jsx-curly-spacing": [
"error",
{
"when": "always",
"children": true
}
], // Require spacing in JSX curly braces
"react/self-closing-comp": "error", // Enforce self-closing tags when no children
"react/no-array-index-key": "warn", // Warn about using array index as key
"react/prop-types": "off", // Disable prop-types since you're using TypeScript
// Imports
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
], // Enforce sorted imports
"import/no-duplicates": "error", // Disallow duplicate imports
"import/prefer-default-export": "off", // Allow single named exports
"import/extensions": [
"error",
"never",
{
"json": "always"
}
], // Disallow file extensions except for JSON
// TypeScript Specific
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
], // Ignore unused variables starting with _
"@typescript-eslint/explicit-module-boundary-types": "off", // Disable forcing return type definitions
"@typescript-eslint/no-explicit-any": "warn", // Warn against using `any`
"@typescript-eslint/no-inferrable-types": "off", // Allow explicit types even if inferred
"@typescript-eslint/consistent-type-imports": "error", // Enforce consistent type imports
// Accessibility
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": [
"Link"
],
"specialLink": [
"hrefLeft",
"hrefRight"
],
"aspects": [
"invalidHref",
"preferButton"
]
}
], // Ensure <a> tags are valid
"jsx-a11y/alt-text": "error", // Enforce alt text on media elements
"jsx-a11y/no-static-element-interactions": "warn", // Warn against clickable non-interactive elements
"jsx-a11y/click-events-have-key-events": "warn" // Warn if click events lack key event equivalents
}
"extends": ["next", "prettier"]
}
3 changes: 0 additions & 3 deletions components/CustomEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ interface Edge {
type: string;
data: {
label: string;
// eslint-disable-next-line no-unused-vars
onLabelChange: (id: string, newLabel: string) => void;
};
}
Expand All @@ -33,9 +32,7 @@ interface CustomEdgeProps {
targetY: number;
};
nodes?: Node[];
// eslint-disable-next-line no-unused-vars
onDeleteEdge?: (id: string) => void;
// eslint-disable-next-line no-unused-vars
setSelectedEdgeId: (id: string | null) => void;
selectedEdgeId: string | null;
}
Expand Down
3 changes: 0 additions & 3 deletions components/CustomNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const CustomNode: React.FC<CustomNodeProps> = React.memo(
}, [label]);

useEffect(() => {
// eslint-disable-next-line no-param-reassign
data.isEditing = isEditing;
if (isEditing && textAreaRef.current) {
textAreaRef.current.focus();
Expand Down Expand Up @@ -275,7 +274,6 @@ const CustomNode: React.FC<CustomNodeProps> = React.memo(
onKeyDown={ handleKeyDown }
/>
) : (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
className="content w-full overflow-hidden text-lg font-semibold text-center whitespace-pre-wrap break-words cursor-pointer"
style={ {
Expand Down Expand Up @@ -311,7 +309,6 @@ const CustomNode: React.FC<CustomNodeProps> = React.memo(

{ /* Output Handle - Bottom-Center */ }
{ isConnectable && (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
ref={ outputHandleRef }
className={ `handle handle-source absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 w-3 h-3 border-2 border-white rounded-full cursor-pointer ${isConnectionSource ? 'bg-red-500' : 'bg-blue-500'
Expand Down
1 change: 0 additions & 1 deletion components/FSMHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ interface Edge {
type: string;
data: {
label: string;
// eslint-disable-next-line no-unused-vars
onLabelChange: (id: string, newLabel: string) => void;
};
}
Expand Down
2 changes: 0 additions & 2 deletions components/FlowControl.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-unused-vars */
import { Save, RotateCcw, Trash2, MoreHorizontal } from 'lucide-react';
import { useState, useRef } from 'react';

Expand Down
1 change: 0 additions & 1 deletion components/GrammarInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';

interface GrammarInputProps {
// eslint-disable-next-line no-unused-vars
onParse: (grammarRules: string[]) => void;
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.16",
"eslint-config-prettier": "^9.1.0",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
Expand Down
13 changes: 13 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30bead3

Please sign in to comment.