Skip to content

Commit

Permalink
ESLint enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackyliang committed Jan 21, 2025
1 parent 3a5a285 commit 375063b
Showing 1 changed file with 69 additions and 17 deletions.
86 changes: 69 additions & 17 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import globals from 'globals';
*/
const eslintConfig = [
{
name: 'preferred-rules',
name: 'all-rules',
files: [
'**/*.js',
'**/*.mjs',
Expand All @@ -34,20 +34,10 @@ const eslintConfig = [
...globals.node,
NodeJS: 'readonly',
},
parser: typescriptParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: './tsconfig.json',
sourceType: 'module',
},
},
plugins: {
'@stylistic': stylisticPlugin,
'@typescript-eslint': typescriptPlugin,
'import': importPlugin,
import: importPlugin,
'jsx-a11y': jsxA11yPlugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
Expand All @@ -69,20 +59,82 @@ const eslintConfig = [
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
...stylisticPlugin.configs['recommended-flat'].rules,
...typescriptPlugin.configs.recommended.rules,
'@stylistic/arrow-parens': ['error', 'always'],
'@stylistic/brace-style': ['error', '1tbs'],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/member-delimiter-style': ['error', { singleline: { requireLast: true } }],
'@stylistic/member-delimiter-style': ['error', {
singleline: {
requireLast: true,
},
}],
'@stylistic/multiline-ternary': ['off'],
'@stylistic/quote-props': ['error', 'as-needed'],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': ['error', 'always'],
'import/newline-after-import': ['error', {
count: 1,
}],
'import/no-named-as-default': ['off'],
'import/order': ['error', {
alphabetize: {
order: 'asc',
},
}],
'no-console': ['warn', {
allow: [
'error',
'info',
'warn',
],
}],
'no-irregular-whitespace': ['error', {
skipComments: true,
}],
'object-curly-newline': ['error', {
ObjectExpression: {
minProperties: 4,
multiline: true,
consistent: true,
},
ObjectPattern: {
minProperties: 4,
multiline: true,
consistent: true,
},
ImportDeclaration: {
minProperties: 4,
multiline: true,
consistent: true,
},
}],
},
},
{
name: 'typescript-rules',
files: [
'**/*.ts',
'**/*.mts',
'**/*.cts',
'**/*.tsx',
],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: './tsconfig.json',
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
},
rules: {
...typescriptPlugin.configs.recommended.rules,
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/no-unused-vars': ['error'],
'import/order': ['error', { alphabetize: { order: 'asc' } }],
'no-console': ['warn', { allow: ['error', 'info', 'warn'] }],
'no-irregular-whitespace': ['error', { skipComments: true }],
'no-unused-vars': ['off'],
},
},
Expand Down

0 comments on commit 375063b

Please sign in to comment.