Skip to content

Commit

Permalink
chore: switch eslint-config-eslint to the flat format
Browse files Browse the repository at this point in the history
1. convert eslint-config-eslint to the flat format.
2. export eslint-config-eslint/eslintrc (used by testing).
3. upgrade `eslint-plugin-n` v16 (added flat config supports).
4. change eslint plugins peerDependencies => dependencies.
5. change lib/eslint/eslint.js, lib/eslint/flat-eslint.js test cases
to make the ci happy.

note: it's a breaking change for eslint-config-eslint.

refs: https://eslint.org/docs/latest/use/configure/configuration-files-new
  • Loading branch information
aladdin-add committed Jun 19, 2023
1 parent 150a74b commit 14dee31
Show file tree
Hide file tree
Showing 11 changed files with 893 additions and 386 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = {
"internal-rules"
],
extends: [
"eslint"
"eslint/eslintrc"
],
parserOptions: {
ecmaVersion: 2021
Expand Down
10 changes: 2 additions & 8 deletions eslint.config.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 14dee31

Please sign in to comment.