diff --git a/README.md b/README.md index eccc0e1..0461bf3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Some configs extend other configs, as illustrated below. So, for example, extend node --extends--> javascript angular --extends--> typescript ngrx --extends--> angular + react --extends--> javascript graphql --extends--> node ``` diff --git a/docs/react.md b/docs/react.md index 6ecfdd0..b805b79 100644 --- a/docs/react.md +++ b/docs/react.md @@ -20,7 +20,9 @@ Config for **React** projects. export default tseslint.config(...react); ``` -## ๐Ÿ“ Rules (101) +## ๐Ÿ“ Rules (391) + +**290** rules are included from [`javascript` config](./javascript.md#๐Ÿ“-rules-290). For brevity, only the **101** additional rules are listed in this document. > ๐Ÿ”ง Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).
๐Ÿ’ก Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
๐Ÿงช๐Ÿšซ Disabled for [test files](../README.md#๐Ÿงช-test-overrides).
๐Ÿงชโš ๏ธ Severity lessened to warning for [test files](../README.md#๐Ÿงช-test-overrides). diff --git a/src/configs/react.js b/src/configs/react.js index ff2ec4d..9eb5b9b 100644 --- a/src/configs/react.js +++ b/src/configs/react.js @@ -6,8 +6,9 @@ import reactHooks from 'eslint-plugin-react-hooks'; import globals from 'globals'; import tseslint from 'typescript-eslint'; import { REACT_FILE_PATTERNS } from '../lib/patterns.js'; +import javascript from './javascript.js'; -export default tseslint.config({ +export default tseslint.config(...javascript, { files: REACT_FILE_PATTERNS, languageOptions: { globals: globals.browser, diff --git a/tests/configs/react.spec.js b/tests/configs/react.spec.js index 7ebd6c8..64cbbad 100644 --- a/tests/configs/react.spec.js +++ b/tests/configs/react.spec.js @@ -20,6 +20,11 @@ describe('react config', () => { expect(Object.keys(config.rules ?? {}).join(',')).toContain('react/'); }); + it('should have rule from extended javascript config', async () => { + const config = await loadConfig('components/Button.tsx'); + expect(config.rules).toHaveProperty('@typescript-eslint/no-unused-vars'); + }); + it('should have rule from extended recommended react config', async () => { const config = await loadConfig(); expect(config.rules).toHaveProperty('react/jsx-key');