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

Bug: not all override patterns containing ".." should be rejected #16038

Closed
1 task done
fasttime opened this issue Jun 22, 2022 · 5 comments · Fixed by #16538
Closed
1 task done

Bug: not all override patterns containing ".." should be rejected #16038

fasttime opened this issue Jun 22, 2022 · 5 comments · Fixed by #16538
Assignees
Labels
bug ESLint is working incorrectly repro:needed
Projects

Comments

@fasttime
Copy link
Contributor

fasttime commented Jun 22, 2022

Environment

Node version: 18.4.0
npm version: 8.12.1
Local ESLint version: 8.18.0

What parser are you using?

Default (Espree)

What did you do?

Configuration:

{
    "overrides": [
        {
            "files": [
                "A...Z.js"
            ]
        }
    ]
}

What did you expect to happen?

I was expecting the config to be accepted.

What actually happened?

The configuration above results in an error:

Error: Invalid override pattern (expected relative path not containing '..'): A...Z.js

There is no reason to forbid override patterns containing two or more dots, unless when they refer to a parent directory, i.e. when they constitute a path segment, either found at the start or at the end of the pattern or surrounded by a path separator (/ or \).

Not sure if this classifies as a bug or an improvement. If it's too late to change the current behavior, it would be great to have this fixed in the new config system.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@fasttime fasttime added bug ESLint is working incorrectly repro:needed labels Jun 22, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Jun 22, 2022
@nzakas
Copy link
Member

nzakas commented Jul 1, 2022

Thanks for the report. Indeed we can’t fix it in the current config system at this point. We can check similar behavior in the new config system when it’s finished.

@nzakas nzakas self-assigned this Jul 1, 2022
@nzakas nzakas moved this from Needs Triage to Blocked in Triage Jul 1, 2022
@jonny64
Copy link

jonny64 commented Sep 14, 2022

let's say, I have following project structure:

back/package.json
back/lib/Content/*.js
front/package.json
slices/budget/back/package.json
slices/budget/back/lib/Content/*.js
slices/budget/front/package.json
slices/accounting/back/package.json
slices/accounting/back/lib/Content/*.js
slices/accounting/front/package.json

how do I?

cd back && eslint ./lib/**/*.js ../slices/**/lib/Content/*.js

@fasttime
Copy link
Contributor Author

@jonny64 The point here is how to specify files with two consecutive dots in their name, not files outside the current directory.

Your problem is different and seems pretty common. maybe ask in a forum or open a discussion?

@jonny64
Copy link

jonny64 commented Sep 19, 2022

started a discussion.

@nzakas nzakas moved this from Blocked to Pull Request Opened in Triage Nov 11, 2022
@nzakas
Copy link
Member

nzakas commented Nov 11, 2022

This has already been solved for flat config. I'll just add some tests to verify.

nzakas added a commit that referenced this issue Nov 11, 2022
This test just verifies that we can have `files` pattern that include
two dots in a row like "a..b.js".

Closes #16038
Triage automation moved this from Pull Request Opened to Complete Nov 11, 2022
mdjermanovic pushed a commit that referenced this issue Nov 11, 2022
This test just verifies that we can have `files` pattern that include
two dots in a row like "a..b.js".

Closes #16038
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Nov 28, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`8.27.0` -> `8.28.0`](https://renovatebot.com/diffs/npm/eslint/8.27.0/8.28.0) |

---

### Release Notes

<details>
<summary>eslint/eslint</summary>

### [`v8.28.0`](https://github.com/eslint/eslint/releases/tag/v8.28.0)

[Compare Source](eslint/eslint@v8.27.0...v8.28.0)

#### Features

-   [`63bce44`](eslint/eslint@63bce44) feat: add `ignoreClassFieldInitialValues` option to no-magic-numbers ([#&#8203;16539](eslint/eslint#16539)) (Milos Djermanovic)
-   [`8385ecd`](eslint/eslint@8385ecd) feat: multiline properties in rule `key-spacing` with option `align` ([#&#8203;16532](eslint/eslint#16532)) (Francesco Trotta)
-   [`a4e89db`](eslint/eslint@a4e89db) feat: `no-obj-calls` support `Intl` ([#&#8203;16543](eslint/eslint#16543)) (Sosuke Suzuki)

#### Bug Fixes

-   [`c50ae4f`](eslint/eslint@c50ae4f) fix: Ensure that dot files are found with globs. ([#&#8203;16550](eslint/eslint#16550)) (Nicholas C. Zakas)
-   [`9432b67`](eslint/eslint@9432b67) fix: throw error for first unmatched pattern ([#&#8203;16533](eslint/eslint#16533)) (Milos Djermanovic)
-   [`e76c382`](eslint/eslint@e76c382) fix: allow `* 1` when followed by `/` in no-implicit-coercion ([#&#8203;16522](eslint/eslint#16522)) (Milos Djermanovic)

#### Documentation

-   [`34c05a7`](eslint/eslint@34c05a7) docs: Language Options page intro and tweaks ([#&#8203;16511](eslint/eslint#16511)) (Ben Perlmutter)
-   [`3e66387`](eslint/eslint@3e66387) docs: add intro and edit ignoring files page ([#&#8203;16510](eslint/eslint#16510)) (Ben Perlmutter)
-   [`436f712`](eslint/eslint@436f712) docs: fix Header UI inconsistency ([#&#8203;16464](eslint/eslint#16464)) (Tanuj Kanti)
-   [`f743816`](eslint/eslint@f743816) docs: switch to wrench emoji for auto-fixable rules ([#&#8203;16545](eslint/eslint#16545)) (Bryan Mishkin)
-   [`bc0547e`](eslint/eslint@bc0547e) docs: improve styles for versions and languages page ([#&#8203;16553](eslint/eslint#16553)) (Nitin Kumar)
-   [`6070f58`](eslint/eslint@6070f58) docs: clarify esquery issue workaround ([#&#8203;16556](eslint/eslint#16556)) (Milos Djermanovic)
-   [`b48e4f8`](eslint/eslint@b48e4f8) docs: Command Line Interface intro and tweaks ([#&#8203;16535](eslint/eslint#16535)) (Ben Perlmutter)
-   [`b92b30f`](eslint/eslint@b92b30f) docs: Add Rules page intro and content tweaks ([#&#8203;16523](eslint/eslint#16523)) (Ben Perlmutter)
-   [`1769b42`](eslint/eslint@1769b42) docs: Integrations page introduction ([#&#8203;16548](eslint/eslint#16548)) (Ben Perlmutter)
-   [`a8d0a57`](eslint/eslint@a8d0a57) docs: make table of contents sticky on desktop ([#&#8203;16506](eslint/eslint#16506)) (Sam Chen)
-   [`a01315a`](eslint/eslint@a01315a) docs: fix route of japanese translation site ([#&#8203;16542](eslint/eslint#16542)) (Tanuj Kanti)
-   [`0515628`](eslint/eslint@0515628) docs: use emoji instead of svg for deprecated rule ([#&#8203;16536](eslint/eslint#16536)) (Bryan Mishkin)
-   [`68f1288`](eslint/eslint@68f1288) docs: set default layouts ([#&#8203;16484](eslint/eslint#16484)) (Percy Ma)
-   [`776827a`](eslint/eslint@776827a) docs: init config about specifying shared configs ([#&#8203;16483](eslint/eslint#16483)) (Percy Ma)
-   [`5c39425`](eslint/eslint@5c39425) docs: fix broken link to plugins ([#&#8203;16520](eslint/eslint#16520)) (Ádám T. Nagy)
-   [`c97c789`](eslint/eslint@c97c789) docs: Add missing no-new-native-nonconstructor docs code fence ([#&#8203;16503](eslint/eslint#16503)) (Brandon Mills)

#### Chores

-   [`e94a4a9`](eslint/eslint@e94a4a9) chore: Add tests to verify [#&#8203;16038](eslint/eslint#16038) is fixed ([#&#8203;16538](eslint/eslint#16538)) (Nicholas C. Zakas)
-   [`e13f194`](eslint/eslint@e13f194) chore: stricter validation of `meta.docs.description` in core rules ([#&#8203;16529](eslint/eslint#16529)) (Milos Djermanovic)
-   [`72dbfbc`](eslint/eslint@72dbfbc) chore: use `pkg` parameter in `getNpmPackageVersion` ([#&#8203;16525](eslint/eslint#16525)) (webxmsj)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

 **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yOS4xIiwidXBkYXRlZEluVmVyIjoiMzQuNDAuMCJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1652
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ESLint is working incorrectly repro:needed
Projects
No open projects
Triage
Complete
Development

Successfully merging a pull request may close this issue.

3 participants