Skip to content

Commit

Permalink
Merge pull request #21 from Mubashirshariq/main
Browse files Browse the repository at this point in the history
Added a Set of ESLint Rules  and remove warnings
  • Loading branch information
gemanor authored Nov 20, 2024
2 parents 2b51a74 + ba8583e commit 9733b53
Show file tree
Hide file tree
Showing 10 changed files with 5,612 additions and 1,332 deletions.
66 changes: 66 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { FlatCompat } from '@eslint/eslintrc';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import sonarjsPlugin from 'eslint-plugin-sonarjs';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierPlugin from 'eslint-plugin-prettier';
import js from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';

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

const eslintConfig = [
js.configs.recommended,
...compat.extends('plugin:react/recommended'),
prettierConfig,
];

export default [
...eslintConfig,
{
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
Headers: 'readonly',
RequestInit: 'readonly',
fetch: 'readonly',
process: 'readonly',
},
},
},
{
files: ['source/**/*.{js,ts,tsx}', '*/.{js,ts,jsx,tsx}'],
plugins: {
'@typescript-eslint': tsPlugin,
sonarjs: sonarjsPlugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
prettier: prettierPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
...tsPlugin.configs['recommended'].rules,
'no-use-before-define': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'sonarjs/no-identical-functions': 'error',
'sonarjs/no-duplicate-string': 'error',
'prettier/prettier': 'warn',
},
},
{
settings: {
react: { version: 'detect' },
},
},
];
Loading

0 comments on commit 9733b53

Please sign in to comment.