-
Notifications
You must be signed in to change notification settings - Fork 53
@w-7791882@ -TypeScript scanner throws "X is undefined" errors for elements of mocha/jasmine/chai etc. #133
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
Conversation
src/lib/eslint/BaseEslintEngine.ts
Outdated
| 'webextensions': true // Chrome | ||
| }; | ||
| export function overrideDefaultEnv(overrideEnv: LooseObject): void { | ||
| DEFAULT_ENV_VARS = {...DEFAULT_ENV_VARS, ...overrideEnv}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your innovative approach here.
Also, wanted to point out that Mike had used an Object.assign(sourceObject, destinationObject) call to assign contents of one Json object into another. Using that approach, here we would do something like:
Object.assign(DEFAULT_ENV_VARS, overrideEnv) and DEFAULT_ENV_VARS would get all the new key/values.
However, for type definition, we were using Record<string, any> and had to add @typescript-eslint/no-explicit-any before each call.
Just wanted to lay this out here so that you had another path to consider and choose whichever you liked.
rmohan20
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
ranekere-sfdc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfeingold35 - Please change the docs for Run command (--help section) with the new flag and also the help message. https://github.com/forcedotcom/sfdx-scanner/blob/dev/docs/_articles/en/scanner-commands/run.md
…e language in the comments.
src/lib/eslint/BaseEslintEngine.ts
Outdated
| // options.baseConfig. Configuration object, extended by all configurations used with this instance. | ||
| // You can use this option to define the default settings that will be used if your configuration files don't configure it. | ||
| // If they don't already have a baseConfig property, we'll need to instantiate one. | ||
| config['baseConfig'] = config['baseConfig'] || {'env': {}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of stylistic nitpicks:
- Can we declare constants (module level should be good enough) for "baseConfig" and "env" so we don't have accidental typos while making changes to this code another time?
- How about extracting the new portion into a method of its own? That way code readability will be focused.
No description provided.