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.1
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.2
Choose a head ref
  • 4 commits
  • 5 files changed
  • 3 contributors

Commits on Aug 1, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6827766 View commit details

Commits on Aug 2, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6cfa046 View commit details

Commits on Aug 5, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6745421 View commit details

Commits on Aug 11, 2023

  1. chore: release 2.1.2 (#124)

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

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    242d569 View commit details
Showing with 116 additions and 33 deletions.
  1. +0 −21 .github/workflows/add-to-triage.yml
  2. +13 −0 CHANGELOG.md
  3. +8 −2 lib/flat-compat.js
  4. +9 −9 package.json
  5. +86 −1 tests/lib/flat-compat.js
21 changes: 0 additions & 21 deletions .github/workflows/add-to-triage.yml

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

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


### Bug Fixes

* Ensure environments in overrides respect files patterns ([#126](https://github.com/eslint/eslintrc/issues/126)) ([6745421](https://github.com/eslint/eslintrc/commit/67454216a9dc4ecb850fd80d67ae39cf5799986d)), closes [#125](https://github.com/eslint/eslintrc/issues/125)


### Chores

* Remove add-to-triage ([#123](https://github.com/eslint/eslintrc/issues/123)) ([6827766](https://github.com/eslint/eslintrc/commit/6827766123137592b13c16c2ddd241fea42aae10))
* standardize npm script names ([#122](https://github.com/eslint/eslintrc/issues/122)) ([6cfa046](https://github.com/eslint/eslintrc/commit/6cfa0466c192f5c2aff1cdf9554836acd4fcce68))

## [2.1.1](https://github.com/eslint/eslintrc/compare/v2.1.0...v2.1.1) (2023-07-27)


10 changes: 8 additions & 2 deletions lib/flat-compat.js
Original file line number Diff line number Diff line change
@@ -168,14 +168,20 @@ function translateESLintRC(eslintrcConfig, {
if (environments.has(envName)) {

// built-in environments should be defined first
configs.unshift(...translateESLintRC(environments.get(envName), {
configs.unshift(...translateESLintRC({
criteria: eslintrcConfig.criteria,
...environments.get(envName)
}, {
resolveConfigRelativeTo,
resolvePluginsRelativeTo
}));
} else if (pluginEnvironments.has(envName)) {

// if the environment comes from a plugin, it should come after the plugin config
configs.push(...translateESLintRC(pluginEnvironments.get(envName), {
configs.push(...translateESLintRC({
criteria: eslintrcConfig.criteria,
...pluginEnvironments.get(envName)
}, {
resolveConfigRelativeTo,
resolvePluginsRelativeTo
}));
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint/eslintrc",
"version": "2.1.1",
"version": "2.1.2",
"description": "The legacy ESLintRC config file format for ESLint",
"type": "module",
"main": "./dist/eslintrc.cjs",
@@ -26,16 +26,16 @@
"access": "public"
},
"scripts": {
"prepare": "npm run build",
"build": "rollup -c",
"lint": "eslint . --report-unused-disable-directives",
"fix": "npm run lint -- --fix",
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'",
"generate-release": "eslint-generate-release",
"generate-alpharelease": "eslint-generate-prerelease alpha",
"generate-betarelease": "eslint-generate-prerelease beta",
"generate-rcrelease": "eslint-generate-prerelease rc",
"publish-release": "eslint-publish-release"
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
"release:generate:rc": "eslint-generate-prerelease rc",
"release:publish": "eslint-publish-release",
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'"
},
"repository": "eslint/eslintrc",
"funding": "https://opencollective.com/eslint",
87 changes: 86 additions & 1 deletion tests/lib/flat-compat.js
Original file line number Diff line number Diff line change
@@ -215,6 +215,92 @@ describe("FlatCompat", () => {
});
});

it("should translate builtin env with files", () => {
const result = compat.config({
rules: {
foo: "error"
},
overrides: [
{
files: "*.jsx",
env: {
amd: true
}
}
]
});

assert.strictEqual(result.length, 3);

assert.deepStrictEqual(result[0], {
rules: {
foo: "error"
}
});

assert.deepStrictEqual(result[1].languageOptions, {
...environments.get("amd")
});
assert.typeOf(result[1].files[0], "function");
assert.isTrue(result[1].files[0]("/usr/eslint/foo.jsx"));
assert.isFalse(result[1].files[0]("/usr/eslint/foo.js"));

assert.typeOf(result[2].files[0], "function");
assert.isTrue(result[2].files[0]("/usr/eslint/foo.jsx"));
assert.isFalse(result[2].files[0]("/usr/eslint/foo.js"));
});

it("should translate plugin env with files", () => {
const result = compat.config({
rules: {
foo: "error"
},
overrides: [
{
files: "*.jsx",
plugins: ["fixture3"],
env: {
"fixture3/a": true,
"fixture3/b": true
}
}
]
});

assert.strictEqual(result.length, 4);

assert.deepStrictEqual(result[0], {
rules: {
foo: "error"
}
});

assert.deepStrictEqual(result[1].languageOptions, {
globals: {
foo: true
}
});
assert.typeOf(result[1].files[0], "function");
assert.isTrue(result[1].files[0]("/usr/eslint/foo.jsx"));
assert.isFalse(result[1].files[0]("/usr/eslint/foo.js"));

assert.deepStrictEqual(result[2].languageOptions, {
globals: {
bar: false
}
});
assert.typeOf(result[2].files[0], "function");
assert.isTrue(result[2].files[0]("/usr/eslint/foo.jsx"));
assert.isFalse(result[2].files[0]("/usr/eslint/foo.js"));

assert.deepStrictEqual(result[3].plugins, {
fixture3: pluginFixture3
});
assert.typeOf(result[3].files[0], "function");
assert.isTrue(result[3].files[0]("/usr/eslint/foo.jsx"));
assert.isFalse(result[3].files[0]("/usr/eslint/foo.js"));
});

});

describe("extends", () => {
@@ -957,7 +1043,6 @@ describe("FlatCompat", () => {

});


describe("plugins()", () => {

let compat;