diff --git a/package.json b/package.json index a78bc250d4..d8b75b1871 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "postinstall": "rm -rf node_modules/markdownlint-cli/node_modules/markdownlint", "install:config": "cd packages/eslint-config-airbnb && npm prune && npm install", "install:config:base": "cd packages/eslint-config-airbnb-base && npm prune && npm install", - "lint": "markdownlint --config linters/.markdownlint.json README.md */README.md", + "lint": "markdownlint --config linters/.markdownlint.json README.md */README.md && eslint -c linters/.eslintrc . --ext .js --ext .jsx --ext .mjs", "pretest": "npm run --silent lint", "test": "npm run --silent test:config && npm run --silent test:config:base", "test:config": "cd packages/eslint-config-airbnb; npm test", @@ -40,6 +40,7 @@ }, "homepage": "https://github.com/airbnb/javascript", "devDependencies": { + "eslint": "^8.57.1", "markdownlint": "^0.29.0", "markdownlint-cli": "^0.35.0" } diff --git a/packages/eslint-config-airbnb-base/README.md b/packages/eslint-config-airbnb-base/README.md index 6ddc34dac1..0570045b17 100644 --- a/packages/eslint-config-airbnb-base/README.md +++ b/packages/eslint-config-airbnb-base/README.md @@ -62,6 +62,16 @@ Our default export contains all of our ESLint rules, including ECMAScript 6+. It 2. Add `"extends": "airbnb-base"` to your .eslintrc. +> **Note**: ESLint only lints `.js` files by default. + + If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI: + + ```sh + eslint . --ext .js, .jsx, .mjs + ``` + + Without this, JSX-related rules will not apply to `.jsx` files. + ### eslint-config-airbnb-base/legacy Lints ES5 and below. Requires `eslint` and `eslint-plugin-import`. diff --git a/packages/eslint-config-airbnb/README.md b/packages/eslint-config-airbnb/README.md index 3b3f43196d..b0597cd58f 100644 --- a/packages/eslint-config-airbnb/README.md +++ b/packages/eslint-config-airbnb/README.md @@ -58,6 +58,15 @@ If you don't need React, see [eslint-config-airbnb-base](https://npmjs.com/eslin 2. Add `"extends": "airbnb"` to your `.eslintrc` +> **Note**: ESLint only lints `.js` files by default. + If your project uses `.jsx` (or `.tsx` with TypeScript), you need to pass extensions to the CLI: + + ```sh + eslint . --ext .js, .jsx, .mjs + ``` + + Without this, JSX-related rules will not apply to `.jsx` files. + ### eslint-config-airbnb/hooks This entry point enables the linting rules for React hooks (requires v16.8+). To use, add `"extends": ["airbnb", "airbnb/hooks"]` to your `.eslintrc`.