Skip to content

Commit

Permalink
Merge pull request #18 from pkolt/17-fix-eslint
Browse files Browse the repository at this point in the history
Fixed eslint
  • Loading branch information
pkolt authored Dec 10, 2024
2 parents acce5ca + ccae8b8 commit 06bf973
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 28 deletions.
48 changes: 29 additions & 19 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,52 @@ import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import reactRefresh from 'eslint-plugin-react-refresh';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginHooks from 'eslint-plugin-react-hooks';
import pluginRefresh from 'eslint-plugin-react-refresh';
import pluginImport from 'eslint-plugin-import';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ ignores: ['dist', 'coverage'] }, // It's mad: https://github.com/eslint/eslint/issues/19093
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
settings: {
react: {
version: 'detect',
},
// https://github.com/import-js/eslint-import-resolver-typescript#configuration
'import/resolver': {
typescript: true,
node: true,
},
},
languageOptions: {
globals: globals.browser,
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginRefresh.configs.recommended,
pluginReact.configs.flat.recommended,
reactRefresh.configs.recommended,

// https://github.com/facebook/react/issues/28313
pluginImport.flatConfigs.recommended,
pluginImport.flatConfigs.typescript,
...tseslint.configs.recommended,
{
plugins: {
'react-hooks': pluginReactHooks,
rules: pluginReactHooks.configs.recommended.rules,
'react-hooks': pluginHooks,
},
},

// It's mad: https://github.com/eslint/eslint/issues/19093
// { ignores: ['dist', 'node_modules', 'coverage'] },

{ files: ['**/*.{ts,tsx}'] },
{ settings: { react: { version: 'detect' } } },
{ languageOptions: { globals: globals.browser } },
{
rules: {
'react/react-in-jsx-scope': 'off',
'react-refresh/only-export-components': [
'error',
{
allowConstantExport: true,
},
],
'no-console': ['error', { allow: ['warn', 'error'] }],
'react/react-in-jsx-scope': ['off'],
'react/prop-types': ['off'],
'react/prop-types': 'off',
'object-shorthand': ['error', 'properties'],
'import/no-named-as-default-member': 'off',
...pluginHooks.configs.recommended.rules,
},
},
];
Loading

0 comments on commit 06bf973

Please sign in to comment.