Skip to content

Don't match path on prefix alone #68

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

heyimalex
Copy link
Contributor

Noticed that path/to/good was matching path/to/goodness-no/file.ts, so just the prefix and not the exact directory. I will maybe add tests this weekend.

@kellyrmilligan
Copy link

would love to see this merged if it passes tests. I have the same issue.

@kellyrmilligan
Copy link

if anyone else ends up here, I ended up for now just using pnpm's built in patch feature. another option if not using pnpm would be:

https://www.npmjs.com/package/patch-package

@KostkaBrukowa KostkaBrukowa merged commit 7c9d48e into allegro:master Mar 7, 2024
KostkaBrukowa added a commit that referenced this pull request Mar 7, 2024
@KostkaBrukowa
Copy link
Collaborator

Thanks for contribution! Published with 2.3.2

@solomkinmv
Copy link

solomkinmv commented Apr 1, 2024

Hey. My use case was to use exact file path like path/to/goodness-no/file.ts, but looks like this change breaks it. Now exact matches doesn't work any more

@heyimalex
Copy link
Contributor Author

@solomkinmv If you want to contribute, I think a fix would be:

const posixFilePath = getPosixFilePath(filePath);
const posixStrictPath = getPosixFilePath(absolutePathToStrictFiles);
return posixFilePath === posixStrictPath || posixFilePath.startsWith(posixStrictPath + path.posix.sep);

@floklein
Copy link

floklein commented Aug 13, 2024

This breaks every file paths. So the README.md is not accurate anymore:

{
  "compilerOptions": {
    ...
    "strict": false,
    "plugins": [
      {
        "name": "typescript-strict-plugin",
        "paths": [
          "./src",
          "/absolute/path/to/source/"
        ],
        "exclude": [
          "./src/tests",
          "./src/fileToExclude.ts"
        ],
        "excludePattern": [
          "**/*.spec.ts"
        ]
      }
    ]
  }
}

@floklein
Copy link

floklein commented Aug 13, 2024

Submitted a PR (#86) to fix this. Thanks @heyimalex!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants