Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint/eslintrc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.2
Choose a base ref
...
head repository: eslint/eslintrc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.1.3
Choose a head ref
  • 3 commits
  • 4 files changed
  • 3 contributors

Commits on Oct 23, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    antfu Anthony Fu
    Copy the full SHA
    3b386f7 View commit details

Commits on Nov 1, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ad511f8 View commit details

Commits on Nov 3, 2023

  1. chore: release 2.1.3 (#131)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Nov 3, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    antfu Anthony Fu
    Copy the full SHA
    af564ff View commit details
Showing with 59 additions and 3 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +12 −0 CHANGELOG.md
  3. +45 −1 README.md
  4. +1 −1 package.json
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
node: [21.x, 20.x, 19.x, 18.x, 17.x, 16.x, 14.x, 12.x, "12.22.0"]
include:
- os: windows-latest
node: "12.x"
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [2.1.3](https://github.com/eslint/eslintrc/compare/v2.1.2...v2.1.3) (2023-11-01)


### Documentation

* Add CommonJS example to README ([#134](https://github.com/eslint/eslintrc/issues/134)) ([ad511f8](https://github.com/eslint/eslintrc/commit/ad511f80971301199b74973fef196c8f6ebd36bc)), closes [#133](https://github.com/eslint/eslintrc/issues/133)


### Chores

* run tests in Node.js 21 ([#130](https://github.com/eslint/eslintrc/issues/130)) ([3b386f7](https://github.com/eslint/eslintrc/commit/3b386f790119553fb0d800b65454abf89b56a7aa))

## [2.1.2](https://github.com/eslint/eslintrc/compare/v2.1.1...v2.1.2) (2023-08-05)


46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ npm install @eslint/eslintrc --save-dev
yarn add @eslint/eslintrc -D
```

## Usage
## Usage (ESM)

The primary class in this package is `FlatCompat`, which is a utility to translate ESLintRC-style configs into flat configs. Here's how you use it inside of your `eslint.config.js` file:

@@ -66,6 +66,50 @@ export default [
];
```
## Usage (CommonJS)
Using `FlatCompat` in CommonJS files is similar to ESM, but you'll use `require()` and `module.exports` instead of `import` and `export`. Here's how you use it inside of your `eslint.config.js` CommonJS file:
```js
const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");

const compat = new FlatCompat({
baseDirectory: __dirname, // optional; default: process.cwd()
resolvePluginsRelativeTo: __dirname, // optional
recommendedConfig: js.configs.recommended, // optional
allConfig: js.configs.all, // optional
});

module.exports = [

// mimic ESLintRC-style extends
...compat.extends("standard", "example"),

// mimic environments
...compat.env({
es2020: true,
node: true
}),

// mimic plugins
...compat.plugins("airbnb", "react"),

// translate an entire config
...compat.config({
plugins: ["airbnb", "react"],
extends: "standard",
env: {
es2020: true,
node: true
},
rules: {
semi: "error"
}
})
];
```
## License
MIT License
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint/eslintrc",
"version": "2.1.2",
"version": "2.1.3",
"description": "The legacy ESLintRC config file format for ESLint",
"type": "module",
"main": "./dist/eslintrc.cjs",