Skip to content

Commit 5d3535f

Browse files
docs: add note about ESLint --ext for .jsx files
1 parent 11f986f commit 5d3535f

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"install:config": "cd packages/eslint-config-airbnb && npm prune && npm install",
99
"install:config:base": "cd packages/eslint-config-airbnb-base && npm prune && npm install",
1010
"lint": "markdownlint --config linters/.markdownlint.json README.md */README.md",
11+
"lint:js": "eslint -c linters/.eslintrc . --ext .js --ext .jsx",
1112
"pretest": "npm run --silent lint",
1213
"test": "npm run --silent test:config && npm run --silent test:config:base",
1314
"test:config": "cd packages/eslint-config-airbnb; npm test",
@@ -40,6 +41,7 @@
4041
},
4142
"homepage": "https://github.com/airbnb/javascript",
4243
"devDependencies": {
44+
"eslint": "^8.57.1",
4345
"markdownlint": "^0.29.0",
4446
"markdownlint-cli": "^0.35.0"
4547
}

packages/eslint-config-airbnb-base/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ Our default export contains all of our ESLint rules, including ECMAScript 6+. It
6262

6363
2. Add `"extends": "airbnb-base"` to your .eslintrc.
6464

65+
⚠️ **Note**: ESLint only lints `.js` files by default.
66+
67+
If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI:
68+
69+
```sh
70+
eslint . --ext .js,.jsx
71+
```
72+
73+
Without this, JSX-related rules will not apply to `.jsx` files.
74+
6575
### eslint-config-airbnb-base/legacy
6676

6777
Lints ES5 and below. Requires `eslint` and `eslint-plugin-import`.

packages/eslint-config-airbnb/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ If you don't need React, see [eslint-config-airbnb-base](https://npmjs.com/eslin
5858

5959
2. Add `"extends": "airbnb"` to your `.eslintrc`
6060

61+
⚠️ **Note**: ESLint only lints `.js` files by default.
62+
If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI:
63+
64+
```sh
65+
eslint . --ext .js,.jsx
66+
```
67+
68+
Without this, JSX-related rules will not apply to `.jsx` files.
69+
6170
### eslint-config-airbnb/hooks
6271

6372
This entry point enables the linting rules for React hooks (requires v16.8+). To use, add `"extends": ["airbnb", "airbnb/hooks"]` to your `.eslintrc`.

0 commit comments

Comments
 (0)