Skip to content

Commit

Permalink
chore(lint): configure lint and prittier
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-ahmadbilal committed Aug 28, 2024
1 parent 27a3944 commit 8841e56
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}
49 changes: 49 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
export default [
{
files: ['**/*.{js,mjs,cjs,ts}'],
rules: {
// Enforce 2-space indentation
indent: ['error', 2],

// Enforce semicolons at the end of statements
semi: ['error', 'always'],

// Prefer single quotes for strings
quotes: ['error', 'single', { avoidEscape: true }],

// Enforce consistent spacing before function parentheses
'space-before-function-paren': ['error', 'never'],

// Disallow unused variables
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],

// Prefer `const` over `let` where possible
'prefer-const': 'error',

// Disallow `console` except for warning or error messages
'no-console': ['warn', { allow: ['warn', 'error'] }],

// Encourage using `arrow functions` where appropriate
'prefer-arrow-callback': 'error',

// Disallow `var` (use `let` or `const`)
'no-var': 'error',

// Enforce consistent spacing around operators
'space-infix-ops': 'error',

// Encourage the use of strict equality (`===`)
eqeqeq: ['error', 'always'],

// '@typescript-eslint/no-explicit-any': 'off',
},
},
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
];

0 comments on commit 8841e56

Please sign in to comment.