Skip to content

chore: enable no-dynamic-delete internally #7954

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ module.exports = {
'deprecation/deprecation': 'error',

// TODO(#7338): Investigate enabling these soon ✨
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',

// TODO(#7130): Investigate changing these in or removing these from presets
Expand Down
1 change: 1 addition & 0 deletions packages/rule-tester/src/RuleTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export class RuleTester extends TestFramework {
const itemConfig: Record<string, unknown> = { ...item };

for (const parameter of RULE_TESTER_PARAMETERS) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete itemConfig[parameter];
}

Expand Down
2 changes: 2 additions & 0 deletions packages/typescript-estree/tools/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export function omitDeep<T = UnknownObject>(
for (const prop in node) {
if (Object.prototype.hasOwnProperty.call(node, prop)) {
if (shouldOmit(prop, node[prop]) || node[prop] === undefined) {
// Filter out omitted and undefined props from the node
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete node[prop];
continue;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/website/src/components/config/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ function ConfigEditor({
(name: string, value: unknown): void => {
const newConfig = { ...values };
if (value === '' || value == null) {
// Filter out falsy values from the new config
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete newConfig[name];
} else {
newConfig[name] = value;
Expand Down