[go: nahoru, domu]

Skip to content

Commit

Permalink
chore: enable no-dynamic-delete internally (#7954)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jan 7, 2024
1 parent 687f73c commit ce6143b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
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

0 comments on commit ce6143b

Please sign in to comment.