Skip to content

Commit

Permalink
fix: properly enable React/recommended rules (#276)
Browse files Browse the repository at this point in the history
React/recommended weren't enabled in the last commit moving to flat
ESLint config. This commit re-enables it.

Co-authored-by: Hà Trung Kiên <htk0901htk@gmail.com>
  • Loading branch information
Kamii0909 and Hà Trung Kiên committed Apr 11, 2024
1 parent 91c28ff commit 4c9dbeb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-check
import eslint from '@eslint/js'
import stylistic from '@stylistic/eslint-plugin'
import reactHook from 'eslint-plugin-react-hooks'
import reactRecommended from 'eslint-plugin-react/configs/recommended.js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import reactHook from 'eslint-plugin-react-hooks'
import stylistic from '@stylistic/eslint-plugin'

// config is a helper from typescript-eslint to provide type information for
// eslint file, similar to vite defineConfig. Fun fact: This file is also linted
Expand Down Expand Up @@ -43,9 +43,13 @@ const config = tseslint.config(
},
{
// These files are React specific. Applying this is similar to extends
// 'plugin:react/recommended' and apply plugin 'react' and 'react-hooks'
// 'plugin:react/recommended' and apply plugin 'react'
...reactRecommended,
files: ['src/**/*.{jsx,tsx}'],
},
{
// Also apply plugin 'react-hooks'
files: ['src/**/*.{jsx,tsx}'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
Expand Down Expand Up @@ -91,7 +95,6 @@ const config = tseslint.config(
/**
* @param {RuleLevel} level
* @return {StylisticRules | ESLintRules}
*
*/
function styleRules(level) {
return {
Expand Down

0 comments on commit 4c9dbeb

Please sign in to comment.