Skip to content

Commit

Permalink
chore(null): autoadd already-compliant files (#3032)
Browse files Browse the repository at this point in the history
#### Description of changes

This PR just runs `yarn null:autoadd`, mostly covering new files added with the android-setup feature that are already compliant.

I also made a minor update to the autoadd script to make it write its output in a prettier-compatible format, to avoid having to manually run fastpass:fix afterwards.

#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox -->
- [x] Addresses an existing issue: #2869
- [x] Ran `yarn fastpass`
- [n/a] Added/updated relevant unit test(s) (and ran `yarn test`)
- [n/a] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage`
- [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`.
- [n/a] (UI changes only) Added screenshots/GIFs to description above
- [n/a] (UI changes only) Verified usability with NVDA/JAWS
  • Loading branch information
dbjorge authored Jul 7, 2020
1 parent 0c17ec1 commit 18c5a00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions tools/strict-null-checks/auto-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ forStrictNullCheckEligibleFiles(repoRoot, () => {}).then(async files => {
child.kill();
});

function writeTsconfigSync(tsconfigPath, content) {
let serializedContent = JSON.stringify(content, null, ' ');
serializedContent += '\n';

fs.writeFileSync(tsconfigPath, serializedContent);
}

function tryAutoAddStrictNulls(child, tsconfigPath, file) {
return new Promise(resolve => {
const relativeFilePath = path.relative(repoRoot, file).replace(/\\/g, '/');
Expand All @@ -46,7 +53,7 @@ function tryAutoAddStrictNulls(child, tsconfigPath, file) {
console.log(`Success`);
} else {
console.log(`Errors (x${errorCount}), skipped`);
fs.writeFileSync(tsconfigPath, JSON.stringify(originalConfig, null, ' '));
writeTsconfigSync(tsconfigPath, originalConfig);
}

child.stdout.removeListener('data', listener);
Expand All @@ -55,6 +62,6 @@ function tryAutoAddStrictNulls(child, tsconfigPath, file) {
};
child.stdout.on('data', listener);

fs.writeFileSync(tsconfigPath, JSON.stringify(newConfig, null, ' '));
writeTsconfigSync(tsconfigPath, newConfig);
});
}
9 changes: 6 additions & 3 deletions tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"strictNullChecks": true
},
"files": [
"./src/background/browser-message-broadcaster-factory.ts",
"./src/background/extension-details-view-controller.ts",
"./src/background/interpreter.ts",
"./src/DetailsView/bundled-details-view-styles.ts",
"./src/DetailsView/components/action-and-cancel-buttons-component.tsx",
"./src/DetailsView/components/assessment-instance-details-column.tsx",
Expand Down Expand Up @@ -57,13 +54,16 @@
"./src/assessments/timed-events/test-steps/test-steps.ts",
"./src/assessments/visible-focus-order/test-steps/test-steps.ts",
"./src/background/IndexedDBDataKeys.ts",
"./src/background/browser-message-broadcaster-factory.ts",
"./src/background/details-view-controller.ts",
"./src/background/extension-details-view-controller.ts",
"./src/background/feature-flag-checker.ts",
"./src/background/injector/content-script-injector.ts",
"./src/background/inspect-modes.ts",
"./src/background/install-data-generator.ts",
"./src/background/installation-data.ts",
"./src/background/instance-identifier-generator.ts",
"./src/background/interpreter.ts",
"./src/background/local-storage-data-keys.ts",
"./src/background/scoping-input-types.ts",
"./src/background/shortcuts-page-controller.ts",
Expand Down Expand Up @@ -158,6 +158,7 @@
"./src/electron/flux/types/scan-status.ts",
"./src/electron/flux/types/scan-store-data.ts",
"./src/electron/flux/types/window-state-store-data.ts",
"./src/electron/ipc/async-action.ts",
"./src/electron/ipc/ipc-channel-names.ts",
"./src/electron/main/main-window-config.ts",
"./src/electron/main/main-window-renderer-message-handlers.ts",
Expand All @@ -173,6 +174,7 @@
"./src/electron/views/bundled-renderer-styles.ts",
"./src/electron/views/device-connect-view/components/android-setup/android-setup-spinner.tsx",
"./src/electron/views/device-connect-view/components/android-setup/android-setup-step-layout.tsx",
"./src/electron/views/device-connect-view/components/android-setup/device-description.tsx",
"./src/electron/views/device-connect-view/components/android-setup/folder-picker.tsx",
"./src/electron/views/device-connect-view/components/device-connect-header.tsx",
"./src/electron/views/device-connect-view/components/electron-external-link.tsx",
Expand All @@ -188,6 +190,7 @@
"./src/injected/tab-order-property-bag.ts",
"./src/injected/visualization/focus-indicator.ts",
"./src/injected/visualization/point.ts",
"./src/injected/visualization/root-container-creator.ts",
"./src/injected/visualization/svg-constants.ts",
"./src/injected/visualization/tabbed-item.ts",
"./src/issue-filing/common/create-settings-getter.ts",
Expand Down

0 comments on commit 18c5a00

Please sign in to comment.