Skip to content

Commit f39881d

Browse files
committed
Extend javascript config in react config
1 parent d155b53 commit f39881d

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Some configs extend other configs, as illustrated below. So, for example, extend
3333
node --extends--> javascript
3434
angular --extends--> typescript
3535
ngrx --extends--> angular
36+
react --extends--> javascript
3637
graphql --extends--> node
3738
```
3839

docs/react.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Config for **React** projects.
2020
export default tseslint.config(...react);
2121
```
2222

23-
## 📏 Rules (101)
23+
## 📏 Rules (391)
24+
25+
**290** rules are included from [`javascript` config](./javascript.md#📏-rules-290). For brevity, only the **101** additional rules are listed in this document.
2426

2527
> 🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).<br>💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).<br>🧪🚫 Disabled for [test files](../README.md#🧪-test-overrides).<br>🧪⚠️ Severity lessened to warning for [test files](../README.md#🧪-test-overrides).
2628

src/configs/react.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import reactHooks from 'eslint-plugin-react-hooks';
66
import globals from 'globals';
77
import tseslint from 'typescript-eslint';
88
import { REACT_FILE_PATTERNS } from '../lib/patterns.js';
9+
import javascript from './javascript.js';
910

10-
export default tseslint.config({
11+
export default tseslint.config(...javascript, {
1112
files: REACT_FILE_PATTERNS,
1213
languageOptions: {
1314
globals: globals.browser,

tests/configs/react.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ describe('react config', () => {
2020
expect(Object.keys(config.rules ?? {}).join(',')).toContain('react/');
2121
});
2222

23+
it('should have rule from extended javascript config', async () => {
24+
const config = await loadConfig('components/Button.tsx');
25+
expect(config.rules).toHaveProperty('@typescript-eslint/no-unused-vars');
26+
});
27+
2328
it('should have rule from extended recommended react config', async () => {
2429
const config = await loadConfig();
2530
expect(config.rules).toHaveProperty('react/jsx-key');

0 commit comments

Comments
 (0)