Skip to content
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

chore: migrate @types/node to 14 to align with our supported node version #25510

Merged
merged 12 commits into from
Nov 9, 2022
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
2 changes: 1 addition & 1 deletion apps/ts-minbar-test-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function performTest() {

// Install dependencies, using the minimum TS version supported for consumers
const dependencies = [
'@types/node',
'@types/node@14',
'@types/react@17',
'@types/react-dom@17',
'react@17',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "fix(typings): fix type errors exposed by node 14 typings",
"packageName": "@fluentui/bundle-size",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of these are a mistake - #25531

"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-accordion",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-alert",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-badge",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-button",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-card",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-checkbox",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-conformance",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test(react): clean up persona-coin test and use isConformant without side-effects",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-divider",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-image",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-input",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-label",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-link",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-select",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-slider",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-table",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-tabs",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test: replace deprecated module.parent with require.main within isConformance",
"packageName": "@fluentui/react-text",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"@types/loader-utils": "2.0.3",
"@types/markdown-table": "2.0.0",
"@types/micromatch": "4.0.2",
"@types/node": "10.17.55",
"@types/node": "14.18.32",
"@types/node-fetch": "2.5.7",
"@types/prettier": "2.2.3",
"@types/progress": "2.0.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/bundle-size/src/utils/buildFixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ module.exports = async function buildFixture(preparedFixture, quiet) {
/* eslint-enable @typescript-eslint/naming-convention */
]);

await fs.writeFile(webpackOutputPath, terserOutput.code);
await fs.writeFile(terserOutputPath, terserOutputMinified.code);
await fs.writeFile(webpackOutputPath, terserOutput.code ?? '');
await fs.writeFile(terserOutputPath, terserOutputMinified.code ?? '');

if (!quiet) {
console.log(
Expand Down
7 changes: 6 additions & 1 deletion packages/bundle-size/src/utils/prepareFixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const ajv = new Ajv();
/** @typedef {{ name: string }} FixtureMetadata */
/** @typedef {{ absolutePath: string, relativePath: string, name: string }} PreparedFixture */

/**
* @template T
* @typedef {NonNullable<T> & {[P in keyof T]-?: NonNullable<T[P]>;}} RequiredNonNullableRecord<T>
*/

/**
* Prepares a fixture file to be compiled with Webpack, grabs data from a default export and removes it.
*
Expand Down Expand Up @@ -59,7 +64,7 @@ module.exports = async function prepareFixture(fixture) {

/**
* @param {typeof result} value
* @return {value is Required<NonNullable<typeof result>> & {metadata: FixtureMetadata}}
* @return {value is RequiredNonNullableRecord<typeof result> & {metadata: FixtureMetadata}}
*/
function isTransformedFixtureResultHasMetadata(value) {
return Boolean(value && value.metadata && Object.keys(value.metadata).length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,

// Field-specific defaults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would prefer to use require.main! as you expect that to be always set. The test should rather throw than run with componentPath: undefined if require.main is not set.

Copy link
Contributor Author

@Hotell Hotell Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using ! is a red flag and antipattern ( also not recommended to use by TS team since optional chaining was ratified by ECMA ) . if componenPath will be undefined it will throw anyway

extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function isConformant<TProps = {}>(
testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & { componentPath?: string },
) {
const defaultOptions: Partial<IsConformantOptions<TProps>> = {
componentPath: module!.parent!.filename.replace('.test', ''),
componentPath: require.main?.filename.replace('.test', ''),
extraTests: griffelTests as TestObject<TProps>,
};

Expand Down
Loading