You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@camc314 Hello, I have two problems and need your help.
The isolated functions support selectors , but I couldn't find a selector method that works in OXC, which prevented me from passing the test in the selector section.
When override_globals is empty, eslint-plugin-unicorn/isolated-functions will make the global variable location check for writable. I don't know if OXC has a library for storing global variables to perform this check. the current implementation will also trigger a warning for location.
eslint-plugin-unicorn
{
name: 'check globals writability',
code: outdent`
makeSynchronous(function () {
location = new URL('https://example.com');
process = {env: {}};
process.env.FOO = 'bar';
});
`,
errors: [
// Only one error, `location = new URL('https://example.com')` and `process.env.FOO = 'bar'` are fine, the problem is `process = {...}`.
error({
name: 'process',
reason: 'callee of function named "makeSynchronous" (global variable is not writable)',
}),
],
},
```
the implementation:
eslint-plugin-unicorn(isolated-functions): overrideGlobals: 'location' is a global variable, and its usage conflicts with the default property.
╭─[isolated_functions.tsx:2:17]
1 │ makeSynchronous(function () {
2 │ location = new URL('https://example.com');
· ────────
3 │ process = {env: {}};
╰────
help: add overrideGlobals option in config file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
part of #684