Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch eslint-config-eslint to the flat format #17247

Merged
merged 3 commits into from Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions .eslintrc.js
Expand Up @@ -6,8 +6,7 @@
* Internally, ESLint is using the eslint.config.js file to lint itself.
* This file is needed too, because:
*
* 1. There are tests that expect .eslintrc.js to be present to actually run.
* 2. ESLint VS Code extension expects eslintrc config files to be
* 1. ESLint VS Code extension expects eslintrc config files to be
* present to work correctly.
*
* Once we no longer need to support both eslintrc and flat config, we will
Expand Down Expand Up @@ -63,7 +62,7 @@ module.exports = {
"internal-rules"
],
extends: [
"eslint"
"eslint/eslintrc"
],
parserOptions: {
ecmaVersion: 2021
Expand Down
10 changes: 2 additions & 8 deletions eslint.config.js
Expand Up @@ -29,20 +29,14 @@ const path = require("path");
const internalPlugin = require("eslint-plugin-internal-rules");
const eslintPluginRulesRecommendedConfig = require("eslint-plugin-eslint-plugin/configs/rules-recommended");
const eslintPluginTestsRecommendedConfig = require("eslint-plugin-eslint-plugin/configs/tests-recommended");
const { FlatCompat } = require("@eslint/eslintrc");
const js = require("./packages/js");
const globals = require("globals");
const merge = require("lodash.merge");
const baseConfig = require("eslint-config-eslint");

//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended
});

const INTERNAL_FILES = {
CLI_ENGINE_PATTERN: "lib/cli-engine/**/*",
LINTER_PATTERN: "lib/linter/**/*",
Expand Down Expand Up @@ -81,7 +75,7 @@ function createInternalFilesPatterns(pattern = null) {
}

module.exports = [
...compat.extends("eslint"),
...baseConfig,
{
ignores: [
"build/**",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -116,7 +116,7 @@
"eslint-plugin-eslint-plugin": "^5.1.0",
"eslint-plugin-internal-rules": "file:tools/internal-rules",
"eslint-plugin-jsdoc": "^38.1.6",
"eslint-plugin-n": "^15.2.4",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-unicorn": "^42.0.0",
"eslint-release": "^3.2.0",
"eslump": "^3.0.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/eslint-config-eslint/README.md
Expand Up @@ -22,12 +22,11 @@ npm install eslint-config-eslint --save-dev

## Usage

In your `.eslintrc` file, add:
In your `eslint.config.js` file, add:

```json
{
"extends": "eslint"
}
```js
const eslintConfig = require("eslint-config-eslint");
module.exports = eslintConfig;
```

### Where to ask for help?
Expand Down