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

Disable require-post-message-target-origin for TypeScript files #1415

Merged
merged 4 commits into from
Jul 13, 2021
Merged

Disable require-post-message-target-origin for TypeScript files #1415

merged 4 commits into from
Jul 13, 2021

Conversation

JounQin
Copy link
Contributor

@JounQin JounQin commented Jul 13, 2021

close #1396

index.js Outdated Show resolved Hide resolved
@@ -102,6 +102,7 @@
"eslint-remote-tester-results"
],
"rules": {
"quotes": ["error", "single"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the default value is double.

@fisker
Copy link
Collaborator

fisker commented Jul 13, 2021

Let's skip it in code, like this,

if (filename.toLowerCase().endsWith('.cjs')) {

@JounQin
Copy link
Contributor Author

JounQin commented Jul 13, 2021

Users can still enable require-post-message-target-origin for ts files if they want.

Personally, I don't think hard-coded extensions in rule is good. (.cjs for prefer-module is an exception).

@JounQin
Copy link
Contributor Author

JounQin commented Jul 13, 2021

@fisker
Copy link
Collaborator

fisker commented Jul 13, 2021

Because we use this recommended config to generate readme

eslintConfig: package_.configs.recommended,

So overrides should be in it, this is also why I suggest to use getPhysicalFilename()

@JounQin
Copy link
Contributor Author

JounQin commented Jul 13, 2021

Then I'd prefer regenerating readme.md in this PR. @sindresorhus Any thoughts?

@JounQin
Copy link
Contributor Author

JounQin commented Jul 13, 2021

@fisker Besides, getPhysicalFilename seems not good for prefer-module too.

We can have a virtual filename test.md/0.cjs in a Markdown code block, why it should be reported error?

context.getFilename() is fine for prefer-module.

@fisker
Copy link
Collaborator

fisker commented Jul 13, 2021

Good point. 👍

index.js Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title fix: disable require-post-message-target-origin for ts files Disable require-post-message-target-origin for TypeScript files Jul 13, 2021
@sindresorhus sindresorhus merged commit 741484a into sindresorhus:main Jul 13, 2021
@JounQin JounQin deleted the fix/ts branch July 13, 2021 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

require-post-message-target-origin shouldn't trigger for incompatible APIs
3 participants