Skip to content

Commit

Permalink
Chore/eslint (#423)
Browse files Browse the repository at this point in the history
* chore: eslint v9

* chore: eslint v9

* fix: dependabot.yml 주기 변경
  • Loading branch information
ssi02014 committed Aug 20, 2024
1 parent 8ca5b69 commit f223bee
Show file tree
Hide file tree
Showing 56 changed files with 866 additions and 479 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

24 changes: 0 additions & 24 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
725 changes: 471 additions & 254 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
58 changes: 58 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tsEslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import eslintImport from 'eslint-plugin-import';

const ignores = [
'**/dist',
'**/coverage',
'eslint.config.mjs',
'scripts',
'**/*.spec.ts',
'.vscode',
'.yarn',
'dist',
'esm',
'docusaurus.config.js',
];

const rules = {
...hooksPlugin.configs.recommended.rules,
...pluginReact.configs.recommended.rules,
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'import/no-anonymous-default-export': 'off',
'no-useless-escape': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-restricted-types': 'warn',
'react/prop-types': 'off',
};

export default [
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
},
pluginJs.configs.recommended,
...tsEslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
plugins: {
import: eslintImport,
'react-hooks': hooksPlugin,
},
},
{
ignores,
},
{
rules,
},
];
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@eslint/js": "^9.9.0",
"@types/node": "^22.0.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.7.1",
"eslint": "^8.47.0",
"eslint-plugin-react": "^7.34.1",
"eslint": "^9.9.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-unused-imports": "^4.0.0",
"globals": "^15.9.0",
"lerna": "^8.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"typescript-eslint": "^8.2.0"
},
"license": "MIT",
"packageManager": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import '@testing-library/jest-dom';

declare global {
namespace Vi {
interface Assertion<T = any> extends TestingLibraryMatchers<T, void> {}
type Assertion<T = any> = TestingLibraryMatchers<T, void>;
}
}
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useMergeRefs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const mergeRefs = <T = unknown>(...refs: React.Ref<T>[]) => {
export function useMergeRefs<T = unknown>(
...refs: React.Ref<T>[]
): React.RefCallback<T> {
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line
return useCallback(mergeRefs(...refs), refs);
}
4 changes: 3 additions & 1 deletion packages/react/src/hooks/useTimeout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export function useTimeout(
}, [callbackAction, delay]);

const clear = useCallback(() => {
timeoutRef.current && clearTimeout(timeoutRef.current);
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
}, []);

const reset = useCallback(() => {
Expand Down
8 changes: 4 additions & 4 deletions packages/types/src/Reference/Reference.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ describe('Reference', () => {
const value = {} as Reference;

if (typeof value === 'object') {
// eslint-disable-next-line @typescript-eslint/ban-types
expectTypeOf(value).toEqualTypeOf<Exclude<Reference, Function>>();
expectTypeOf(value).toEqualTypeOf<
Exclude<Reference, (...args: any[]) => any>
>();
}

if (Array.isArray(value)) {
expectTypeOf(value).toEqualTypeOf<any[]>();
}

if (typeof value === 'function') {
// eslint-disable-next-line @typescript-eslint/ban-types
expectTypeOf(value).toEqualTypeOf<Function>();
expectTypeOf(value).toEqualTypeOf<Function | ((...args: any[]) => any)>();
}

if (value instanceof Set) {
Expand Down
3 changes: 1 addition & 2 deletions packages/types/src/Reference/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export type Reference =
| Record<PropertyKey, any>
| any[]
// eslint-disable-next-line @typescript-eslint/ban-types
| Function
| ((...args: any[]) => any) // Function
| Set<any>
| Map<any, any>
| WeakMap<object, any>
Expand Down
Loading

0 comments on commit f223bee

Please sign in to comment.