Skip to content

Commit

Permalink
chore: update eslint-config-eslint exports (#17336)
Browse files Browse the repository at this point in the history
* chore: update eslint-config-eslint export

* update naming in README

* main export for ESM, additional for CJS

* update usage in README

* update package.exports

* rename file

* add eslintrc export

* add `files` to simplify usage
  • Loading branch information
mdjermanovic committed Jul 10, 2023
1 parent b762632 commit 5ca9b4d
Show file tree
Hide file tree
Showing 7 changed files with 477 additions and 403 deletions.
4 changes: 2 additions & 2 deletions eslint.config.js
Expand Up @@ -31,7 +31,7 @@ const eslintPluginRulesRecommendedConfig = require("eslint-plugin-eslint-plugin/
const eslintPluginTestsRecommendedConfig = require("eslint-plugin-eslint-plugin/configs/tests-recommended");
const globals = require("globals");
const merge = require("lodash.merge");
const baseConfig = require("eslint-config-eslint");
const eslintConfigESLintCJS = require("eslint-config-eslint/cjs");

//-----------------------------------------------------------------------------
// Helpers
Expand Down Expand Up @@ -75,7 +75,7 @@ function createInternalFilesPatterns(pattern = null) {
}

module.exports = [
...baseConfig,
...eslintConfigESLintCJS,
{
ignores: [
"build/**",
Expand Down
26 changes: 24 additions & 2 deletions packages/eslint-config-eslint/README.md
Expand Up @@ -22,11 +22,33 @@ npm install eslint-config-eslint --save-dev

## Usage

### ESM (`"type":"module"`) projects

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

```js
const eslintConfig = require("eslint-config-eslint");
module.exports = eslintConfig;
import eslintConfigESLint from "eslint-config-eslint";

export default [
...eslintConfigESLint
];
```

**Note**: This configuration array contains configuration objects with the `files` property.

* `files: ["**/*.js"]`: ESM-specific configurations.
* `files: ["**/*.cjs"]`: CommonJS-specific configurations.

### CommonJS projects

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

```js
const eslintConfigESLintCJS = require("eslint-config-eslint/cjs");

module.exports = [
...eslintConfigESLintCJS
];
```

### Where to ask for help?
Expand Down

0 comments on commit 5ca9b4d

Please sign in to comment.