Skip to content

Commit 27f729c

Browse files
build: use external eslint, prettier configs
1 parent 6dad8e6 commit 27f729c

File tree

6 files changed

+56
-152
lines changed

6 files changed

+56
-152
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,3 @@
11
module.exports = {
2-
env: {
3-
browser: true,
4-
es6: true,
5-
node: true,
6-
},
7-
extends: [
8-
'eslint:recommended',
9-
'plugin:@typescript-eslint/recommended',
10-
'plugin:react/recommended',
11-
'plugin:react-hooks/recommended',
12-
'plugin:react/jsx-runtime',
13-
'prettier',
14-
'plugin:storybook/recommended',
15-
],
16-
parser: '@typescript-eslint/parser',
17-
parserOptions: {
18-
ecmaFeatures: {
19-
jsx: true,
20-
},
21-
ecmaVersion: 'latest',
22-
sourceType: 'module',
23-
},
24-
plugins: [
25-
'react',
26-
'@typescript-eslint',
27-
'eslint-plugin-react-hooks',
28-
'i18next',
29-
'unused-imports',
30-
'simple-import-sort',
31-
'eslint-plugin-import',
32-
],
33-
root: true,
34-
rules: {
35-
curly: 'error',
36-
'i18next/no-literal-string': 'warn',
37-
'react/jsx-no-bind': ['error', { allowBind: true }],
38-
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
39-
'react-hooks/exhaustive-deps': 'error',
40-
'no-var': 'error',
41-
'brace-style': 'error',
42-
'prefer-template': 'error',
43-
'import/no-duplicates': 'error',
44-
radix: 'error',
45-
'space-before-blocks': 'error',
46-
'import/prefer-default-export': 'off',
47-
'@typescript-eslint/no-unused-vars': 'off',
48-
'unused-imports/no-unused-imports': 'error',
49-
'unused-imports/no-unused-vars': [
50-
'warn',
51-
{
52-
vars: 'all',
53-
varsIgnorePattern: '^_',
54-
args: 'after-used',
55-
argsIgnorePattern: '^_',
56-
},
57-
],
58-
'@typescript-eslint/ban-ts-comment': 'warn',
59-
'@typescript-eslint/no-explicit-any': 'warn',
60-
'@typescript-eslint/no-empty-interface': [
61-
'error',
62-
{
63-
allowSingleExtends: true,
64-
},
65-
],
66-
'@typescript-eslint/consistent-type-imports': [
67-
'error',
68-
{
69-
prefer: 'type-imports',
70-
fixStyle: 'separate-type-imports',
71-
disallowTypeAnnotations: true,
72-
},
73-
],
74-
'@typescript-eslint/no-import-type-side-effects': 'error',
75-
'simple-import-sort/imports': 'error',
76-
'simple-import-sort/exports': 'error',
77-
'no-restricted-syntax': [
78-
'error',
79-
{
80-
message: 'React\'s `memo` strips types from generic components. Use `typedMemo` instead.',
81-
selector: 'CallExpression[callee.name="memo"]',
82-
},
83-
],
84-
},
85-
overrides: [
86-
{
87-
files: ['*.stories.tsx'],
88-
rules: {
89-
'i18next/no-literal-string': 'off',
90-
},
91-
},
92-
],
93-
settings: {
94-
react: {
95-
version: 'detect',
96-
},
97-
},
2+
extends: ['@invoke-ai/eslint-config-react'],
983
};

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto-install-peers=true

.prettierrc.cjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
module.exports = {
2-
trailingComma: 'es5',
3-
printWidth: 120,
4-
tabWidth: 2,
5-
semi: true,
6-
singleQuote: true,
7-
endOfLine: 'auto',
2+
...require('@invoke-ai/prettier-config-react'),
83
};

lib/util/typed-memo.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
13
import type React from 'react';
24
import { memo } from 'react';
35

46
/**
57
* A typed version of React.memo, useful for components that take generics.
68
*/
7-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
89
export const typedMemo: <T extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>>(
910
component: T,
1011
propsAreEqual?: (prevProps: React.ComponentProps<T>, nextProps: React.ComponentProps<T>) => boolean

package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
"@emotion/react": "^11.11.3",
6868
"@emotion/styled": "^11.11.0",
6969
"@fontsource-variable/inter": "^5.0.16",
70+
"@invoke-ai/eslint-config-react": "^0.0.4",
71+
"@invoke-ai/prettier-config-react": "^0.0.3",
7072
"@nanostores/react": "^0.7.1",
7173
"@storybook/addon-essentials": "^7.6.9",
7274
"@storybook/addon-interactions": "^7.6.9",
@@ -80,20 +82,9 @@
8082
"@types/node": "^20.11.5",
8183
"@types/react": "^18.2.48",
8284
"@types/react-dom": "^18.2.18",
83-
"@typescript-eslint/eslint-plugin": "^6.19.0",
84-
"@typescript-eslint/parser": "^6.19.0",
8585
"@vitejs/plugin-react": "^4.2.1",
8686
"chakra-react-select": "^4.7.6",
8787
"eslint": "^8.56.0",
88-
"eslint-config-prettier": "^9.1.0",
89-
"eslint-plugin-i18next": "^6.0.3",
90-
"eslint-plugin-import": "^2.29.1",
91-
"eslint-plugin-react": "^7.33.2",
92-
"eslint-plugin-react-hooks": "^4.6.0",
93-
"eslint-plugin-react-refresh": "^0.4.5",
94-
"eslint-plugin-simple-import-sort": "^10.0.0",
95-
"eslint-plugin-storybook": "^0.6.15",
96-
"eslint-plugin-unused-imports": "^3.0.0",
9788
"framer-motion": "^10.18.0",
9889
"glob": "^10.3.10",
9990
"lodash-es": "^4.17.21",

pnpm-lock.yaml

Lines changed: 49 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)