Skip to content

Commit

Permalink
feat(react-hooks): add support do react hooks eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
andrefelipeschulle committed Nov 7, 2024
1 parent f33a8bf commit 32b721f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brainylab/eslint-config",
"version": "2.8.0",
"version": "2.9.0",
"description": "ESLint config for BrainyLab projects",
"keywords": [
"eslint",
Expand Down
4 changes: 0 additions & 4 deletions src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import * as _pluginNode from 'eslint-plugin-n';
export const pluginNode: typeof import('eslint-plugin-n') =
interopDefault(_pluginNode);

// import * as _pluginReact from 'eslint-plugin-react';
// export const pluginReact: typeof import('eslint-plugin-react') =
// interopDefault(_pluginReact);

import pluginNext from '@next/eslint-plugin-next';
export { pluginNext };

Expand Down
17 changes: 16 additions & 1 deletion src/presets/react.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';

export const react: any[] = [
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
files: ['**/*.{jsx,tsx}'],
...reactPlugin.configs.flat?.recommended,
languageOptions: {
...reactPlugin.configs.flat?.recommended.languageOptions,
Expand All @@ -25,4 +26,18 @@ export const react: any[] = [
'react/no-unknown-property': ['error', { ignore: ['tw'] }],
},
},
{
files: ['**/*.{jsx,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: 'detect' } },
...reactHooksPlugin.configs['recommended-latest'],
},
];

0 comments on commit 32b721f

Please sign in to comment.