-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(lint): configure lint and prittier
- Loading branch information
1 parent
27a3944
commit 8841e56
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
]; |