eslint.config.mjs•1.66 kB
import pluginJs from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';
/** @type {import('eslint').Linter.Config[]} */
export default [
pluginJs.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
eslintPluginPrettierRecommended,
{
files: ['**/*.{js,mjs,cjs,ts}'],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-duplicate-imports': ['error', { includeExports: true }],
quotes: ['error', 'single', { avoidEscape: true }],
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
{
files: ['tests/**/*.ts'],
rules: {
'no-console': 'off',
},
},
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
},
},
},
{
ignores: ['node_modules/**', 'build/**', 'docs/.docusaurus/**', 'docs/build/**'],
},
{
plugins: {
'simple-import-sort': simpleImportSort,
},
},
];