2023-02-04 00:36:31 +00:00
|
|
|
module.exports = {
|
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
es6: true,
|
|
|
|
node: true,
|
|
|
|
},
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
'plugin:react/recommended',
|
|
|
|
'plugin:react-hooks/recommended',
|
|
|
|
'plugin:react/jsx-runtime',
|
2023-08-22 05:12:32 +00:00
|
|
|
'prettier',
|
2023-12-08 08:50:33 +00:00
|
|
|
'plugin:storybook/recommended',
|
2023-02-04 00:36:31 +00:00
|
|
|
],
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
parserOptions: {
|
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
|
|
|
ecmaVersion: 2018,
|
|
|
|
sourceType: 'module',
|
|
|
|
},
|
2023-11-25 03:46:19 +00:00
|
|
|
plugins: [
|
|
|
|
'react',
|
|
|
|
'@typescript-eslint',
|
|
|
|
'eslint-plugin-react-hooks',
|
|
|
|
'i18next',
|
2023-11-27 05:10:20 +00:00
|
|
|
'path',
|
2023-12-08 06:00:08 +00:00
|
|
|
'unused-imports',
|
2023-12-28 13:03:21 +00:00
|
|
|
'simple-import-sort',
|
|
|
|
'eslint-plugin-import',
|
2023-12-29 05:52:29 +00:00
|
|
|
// These rules are too strict for normal usage, but are useful for optimizing rerenders
|
|
|
|
// '@arthurgeron/react-usememo',
|
2023-11-25 03:46:19 +00:00
|
|
|
],
|
2023-02-04 00:36:31 +00:00
|
|
|
root: true,
|
|
|
|
rules: {
|
2023-11-27 05:10:20 +00:00
|
|
|
'path/no-relative-imports': ['error', { maxDepth: 0 }],
|
2023-08-21 01:35:56 +00:00
|
|
|
curly: 'error',
|
2023-12-28 13:03:21 +00:00
|
|
|
'i18next/no-literal-string': 'warn',
|
2023-11-12 23:01:14 +00:00
|
|
|
'react/jsx-no-bind': ['error', { allowBind: true }],
|
2023-08-21 01:35:56 +00:00
|
|
|
'react/jsx-curly-brace-presence': [
|
|
|
|
'error',
|
|
|
|
{ props: 'never', children: 'never' },
|
|
|
|
],
|
2023-02-04 00:36:31 +00:00
|
|
|
'react-hooks/exhaustive-deps': 'error',
|
|
|
|
'no-var': 'error',
|
|
|
|
'brace-style': 'error',
|
|
|
|
'prefer-template': 'error',
|
2023-12-28 13:03:21 +00:00
|
|
|
'import/no-duplicates': 'error',
|
2023-02-04 00:36:31 +00:00
|
|
|
radix: 'error',
|
|
|
|
'space-before-blocks': 'error',
|
|
|
|
'import/prefer-default-export': 'off',
|
2023-12-08 06:00:08 +00:00
|
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
|
|
'unused-imports/no-unused-imports': 'error',
|
|
|
|
'unused-imports/no-unused-vars': [
|
2023-03-06 09:02:40 +00:00
|
|
|
'warn',
|
2023-12-08 06:00:08 +00:00
|
|
|
{
|
|
|
|
vars: 'all',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
args: 'after-used',
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
},
|
2023-03-06 09:02:40 +00:00
|
|
|
],
|
2023-12-29 05:52:29 +00:00
|
|
|
// These rules are too strict for normal usage, but are useful for optimizing rerenders
|
|
|
|
// '@arthurgeron/react-usememo/require-usememo': [
|
|
|
|
// 'warn',
|
|
|
|
// {
|
|
|
|
// strict: false,
|
|
|
|
// checkHookReturnObject: false,
|
|
|
|
// fix: { addImports: true },
|
|
|
|
// checkHookCalls: false,
|
|
|
|
|
|
|
|
// },
|
|
|
|
// ],
|
|
|
|
// '@arthurgeron/react-usememo/require-memo': 'warn',
|
2023-03-06 13:23:16 +00:00
|
|
|
'@typescript-eslint/ban-ts-comment': 'warn',
|
2023-07-13 20:31:10 +00:00
|
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
2023-07-03 14:09:18 +00:00
|
|
|
'@typescript-eslint/no-empty-interface': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowSingleExtends: true,
|
|
|
|
},
|
|
|
|
],
|
2023-12-28 13:03:21 +00:00
|
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
prefer: 'type-imports',
|
|
|
|
fixStyle: 'separate-type-imports',
|
|
|
|
disallowTypeAnnotations: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
|
|
'simple-import-sort/imports': 'error',
|
|
|
|
'simple-import-sort/exports': 'error',
|
2024-01-20 00:04:19 +00:00
|
|
|
// Prefer @invoke-ai/ui components over chakra
|
|
|
|
'no-restricted-imports': 'off',
|
|
|
|
'@typescript-eslint/no-restricted-imports': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
paths: [
|
|
|
|
{
|
|
|
|
name: '@chakra-ui/react',
|
|
|
|
message: "Please import from '@invoke-ai/ui' instead.",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '@chakra-ui/layout',
|
|
|
|
message: "Please import from '@invoke-ai/ui' instead.",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '@chakra-ui/portal',
|
|
|
|
message: "Please import from '@invoke-ai/ui' instead.",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2023-02-04 00:36:31 +00:00
|
|
|
},
|
2023-12-28 13:03:21 +00:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: ['*.stories.tsx'],
|
|
|
|
rules: {
|
|
|
|
'i18next/no-literal-string': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2023-02-04 00:36:31 +00:00
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: 'detect',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|