65 lines
1.9 KiB
JavaScript
Executable File
65 lines
1.9 KiB
JavaScript
Executable File
import eslint from '@eslint/js'
|
|
import eslintConfigPrettier from 'eslint-config-prettier'
|
|
import importX from 'eslint-plugin-import-x'
|
|
import eslintPluginPrettier from 'eslint-plugin-prettier'
|
|
import globals from 'globals'
|
|
|
|
export default [
|
|
{
|
|
ignores: ['node_modules/**'],
|
|
},
|
|
eslint.configs.recommended,
|
|
importX.flatConfigs.recommended,
|
|
{
|
|
files: ['**/*.{js,mjs,cjs}'],
|
|
languageOptions: {
|
|
globals: { ...globals.node, ...globals.es2021 },
|
|
},
|
|
rules: {
|
|
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
|
|
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
|
|
'max-len': [
|
|
'warn',
|
|
{
|
|
code: 120,
|
|
ignoreStrings: true,
|
|
ignoreTrailingComments: true,
|
|
ignoreTemplateLiterals: true,
|
|
ignoreComments: true,
|
|
},
|
|
],
|
|
'import-x/extensions': 'off',
|
|
'import-x/prefer-default-export': 'off',
|
|
'import-x/no-extraneous-dependencies': 'off',
|
|
'import-x/no-cycle': 'warn',
|
|
'import-x/order': [
|
|
'warn',
|
|
{
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
'newlines-between': 'never',
|
|
alphabetize: { order: 'asc', caseInsensitive: true },
|
|
},
|
|
],
|
|
'no-unused-vars': ['error', { args: 'none' }],
|
|
'no-shadow': 'off',
|
|
'consistent-return': 'off',
|
|
'no-use-before-define': 'error',
|
|
'no-empty-function': 'warn',
|
|
'class-methods-use-this': 'warn',
|
|
},
|
|
},
|
|
{
|
|
plugins: { prettier: eslintPluginPrettier },
|
|
rules: { 'prettier/prettier': ['warn', { endOfLine: 'lf' }] },
|
|
},
|
|
eslintConfigPrettier,
|
|
{
|
|
files: ['eslint.config.js'],
|
|
rules: {
|
|
'import-x/no-unresolved': 'off',
|
|
'import-x/no-named-as-default': 'off',
|
|
'import-x/no-named-as-default-member': 'off',
|
|
},
|
|
},
|
|
]
|