Skip to content

Commit

Permalink
Fix eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
pkolt committed Jun 7, 2024
1 parent eafcefd commit 4d820c3
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 442 deletions.
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierrc.cjs → .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
printWidth: 120,
tabWidth: 2,
useTabs: false,
Expand Down
61 changes: 61 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';

import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import reactRefresh from 'eslint-plugin-react-refresh';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['**/dist', '**/eslint.config.js'],
},
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
),
),
{
plugins: {
'react-refresh': reactRefresh,
'@typescript-eslint': fixupPluginRules(typescriptEslint),
},

languageOptions: {
parser: tsParser,
},

settings: {
react: {
version: 'detect',
},
},

rules: {
'react-refresh/only-export-components': [
'error',
{
allowConstantExport: true,
},
],

'no-console': ['error'],
'react/react-in-jsx-scope': ['off'],
'object-shorthand': ['error', 'properties'],
},
},
];
Loading

0 comments on commit 4d820c3

Please sign in to comment.