diff --git a/change/@fluentui-react-checkbox-14a22af0-b249-4d10-b439-677ef71d976a.json b/change/@fluentui-react-checkbox-14a22af0-b249-4d10-b439-677ef71d976a.json new file mode 100644 index 00000000000000..b28142e7392796 --- /dev/null +++ b/change/@fluentui-react-checkbox-14a22af0-b249-4d10-b439-677ef71d976a.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Migration to new dx: ts style config", + "packageName": "@fluentui/react-checkbox", + "email": "tkrasniqi@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/react-checkbox/.babelrc.json b/packages/react-checkbox/.babelrc.json new file mode 100644 index 00000000000000..b51a5457ced106 --- /dev/null +++ b/packages/react-checkbox/.babelrc.json @@ -0,0 +1,3 @@ +{ + "plugins": ["module:@fluentui/babel-make-styles", "annotate-pure-calls", "@babel/transform-react-pure-annotations"] +} diff --git a/packages/react-checkbox/.npmignore b/packages/react-checkbox/.npmignore index fa2d3a7f5111ca..e719afb921bc93 100644 --- a/packages/react-checkbox/.npmignore +++ b/packages/react-checkbox/.npmignore @@ -1,4 +1,3 @@ -.cache/ .storybook/ .vscode/ bundle-size/ diff --git a/packages/react-checkbox/.storybook/main.js b/packages/react-checkbox/.storybook/main.js index ec377d98606fa9..18a60b265c2cfb 100644 --- a/packages/react-checkbox/.storybook/main.js +++ b/packages/react-checkbox/.storybook/main.js @@ -1,12 +1,14 @@ const rootMain = require('../../../.storybook/main'); -module.exports = /** @type {Pick} */ ({ +module.exports = /** @type {Omit} */ ({ + ...rootMain, stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], addons: [...rootMain.addons], webpackFinal: (config, options) => { const localConfig = { ...rootMain.webpackFinal(config, options) }; + // add your own webpack tweaks if needed + return localConfig; }, - previewHead: rootMain.previewHead, }); diff --git a/packages/react-checkbox/.storybook/tsconfig.json b/packages/react-checkbox/.storybook/tsconfig.json index 3bd9adcd2ee05e..29aa16f2f178f3 100644 --- a/packages/react-checkbox/.storybook/tsconfig.json +++ b/packages/react-checkbox/.storybook/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "outDir": "", "allowJs": true, - "checkJs": true + "checkJs": true, + "types": ["static-assets", "environment", "inline-style-expand-shorthand", "storybook__addons"] }, - "exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], - "include": ["../src/**/*", "*.js"] + "include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"] } diff --git a/packages/react-checkbox/config/api-extractor.local.json b/packages/react-checkbox/config/api-extractor.local.json index c2ea401c1c3685..7974a129e8a337 100644 --- a/packages/react-checkbox/config/api-extractor.local.json +++ b/packages/react-checkbox/config/api-extractor.local.json @@ -1,5 +1,5 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "extends": "./api-extractor.json", - "mainEntryPointFilePath": "/dist//src/index.d.ts" + "mainEntryPointFilePath": "/dist/packages//src/index.d.ts" } diff --git a/packages/react-checkbox/jest.config.js b/packages/react-checkbox/jest.config.js index 8b82a75996d4f1..b7f149c7fe024d 100644 --- a/packages/react-checkbox/jest.config.js +++ b/packages/react-checkbox/jest.config.js @@ -8,7 +8,7 @@ module.exports = { preset: '../../jest.preset.js', globals: { 'ts-jest': { - tsConfig: '/tsconfig.json', + tsConfig: '/tsconfig.spec.json', diagnostics: false, }, }, diff --git a/packages/react-checkbox/package.json b/packages/react-checkbox/package.json index ac303611ff8eb3..7730f10fb9fddc 100644 --- a/packages/react-checkbox/package.json +++ b/packages/react-checkbox/package.json @@ -18,10 +18,11 @@ "just": "just-scripts", "lint": "just-scripts lint", "start": "yarn storybook", - "test": "jest", + "test": "jest --passWithNoTests", "docs": "api-extractor run --config=config/api-extractor.local.json --local", - "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-checkbox/src && yarn docs", - "storybook": "start-storybook" + "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-checkbox/src && yarn docs", + "storybook": "start-storybook", + "type-check": "tsc -b tsconfig.json" }, "devDependencies": { "@fluentui/eslint-plugin": "*", @@ -38,7 +39,8 @@ "enzyme-adapter-react-16": "^1.15.0", "react": "16.8.6", "react-dom": "16.8.6", - "react-test-renderer": "^16.3.0" + "react-test-renderer": "^16.3.0", + "@fluentui/babel-make-styles": "9.0.0-beta.4" }, "dependencies": { "@fluentui/react-make-styles": "9.0.0-beta.4", diff --git a/packages/react-checkbox/tsconfig.json b/packages/react-checkbox/tsconfig.json index 534e2b72108bd3..affceae1828ae1 100644 --- a/packages/react-checkbox/tsconfig.json +++ b/packages/react-checkbox/tsconfig.json @@ -1,17 +1,25 @@ { "extends": "../../tsconfig.base.json", - "include": ["src"], "compilerOptions": { "target": "ES2019", - "module": "CommonJS", - "lib": ["ES2019", "DOM"], - "outDir": "dist", - "jsx": "react", - "declaration": true, - "experimentalDecorators": true, + "noEmit": true, + "isolatedModules": true, "importHelpers": true, + "jsx": "react", "noUnusedLocals": true, - "preserveConstEnums": true, - "types": ["jest", "custom-global", "inline-style-expand-shorthand", "storybook__addons"] - } + "preserveConstEnums": true + }, + "include": [], + "files": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" + } + ] } diff --git a/packages/react-checkbox/tsconfig.lib.json b/packages/react-checkbox/tsconfig.lib.json new file mode 100644 index 00000000000000..b83999c31f8a32 --- /dev/null +++ b/packages/react-checkbox/tsconfig.lib.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "lib": ["ES2019", "dom"], + "outDir": "dist", + "declaration": true, + "types": ["static-assets", "environment", "inline-style-expand-shorthand"] + }, + "exclude": [ + "./src/common/**", + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.stories.ts", + "**/*.stories.tsx" + ], + "include": ["./src/**/*.ts", "./src/**/*.tsx"] +} diff --git a/packages/react-checkbox/tsconfig.spec.json b/packages/react-checkbox/tsconfig.spec.json new file mode 100644 index 00000000000000..28fa5226de4204 --- /dev/null +++ b/packages/react-checkbox/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist", + "types": ["jest", "node", "inline-style-expand-shorthand"] + }, + "include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"] +}