Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to ESLint v9 #684

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 0 additions & 127 deletions .eslintrc

This file was deleted.

159 changes: 159 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import importPlugin from 'eslint-plugin-import';
import prettier from 'eslint-plugin-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import js from '@eslint/js';

export default [
{
ignores: ['**/*.css', 'ui-icons/src/'],
},
...tseslint.config(js.configs.recommended, ...tseslint.configs.recommended),
eslintPluginPrettierRecommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'],
{
plugins: {
'react-hooks': reactHooksPlugin,
},

languageOptions: {
globals: {
...globals.browser,
},
},

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

rules: {
...reactHooksPlugin.configs.recommended.rules,

'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal'],

pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
],

pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',

alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],

'no-shadow': 'off',

'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],

'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/space-before-blocks': 0,

'@typescript-eslint/no-restricted-types': [
'error',
{
types: {
LegacyFilterSpecification: {
message: 'Use ExpressionFilterSpecification instead',
fixWith: 'ExpressionFilterSpecification',
},

FC: 'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177',
'React.FC':
'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177',
'React.FunctionComponent':
'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177',
'React.FunctionalComponent':
'Preact specific, useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177',
},
},
],

'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
},
],

camelcase: 0,
'no-nonoctal-decimal-escape': 0,
'no-unsafe-optional-chaining': 0,
'object-curly-newline': 0,
'react/function-component-definition': 0,
'react/no-array-index-key': 0,
'react/require-default-props': 0,
'arrow-body-style': ['error', 'as-needed'],
'global-require': 'off',

'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],

'import/no-extraneous-dependencies': 0,

'import/no-unresolved': [
2,
{
commonjs: true,
amd: true,
},
],

'jsx-a11y/click-events-have-key-events': 'off',
'linebreak-style': ['error', 'unix'],

'no-console': [
'error',
{
allow: ['info', 'debug', 'warn', 'error'],
},
],

'no-named-as-default': 'off',
'no-param-reassign': 0,
'no-use-before-define': 'off',
'prettier/prettier': ['warn'],
'react/forbid-prop-types': 'off',
'react/jsx-filename-extension': 'off',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-props-no-spreading': 0,
'react/prefer-stateless-function': 'off',
'react/static-property-placement': 0,
'vitest/prefer-to-be': 'off',
},
},
];
Loading
Loading