Skip to content

Commit

Permalink
Change files
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed May 3, 2021
1 parent aaeab53 commit 79b4642
Show file tree
Hide file tree
Showing 69 changed files with 498 additions and 370 deletions.
6 changes: 3 additions & 3 deletions apps/codesandbox-react-template/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
Fabric,
ThemeProvider,
Checkbox,
ChoiceGroup,
Dropdown,
Expand Down Expand Up @@ -42,7 +42,7 @@ function start(): void {
}

ReactDOM.render(
<Fabric>
<ThemeProvider>
<Stack gap={8}>
<Checkbox label="Unchecked checkbox (uncontrolled)" />
<ChoiceGroup defaultSelectedKey="B" options={choicegroupOptions} label="Pick One" required />
Expand All @@ -56,7 +56,7 @@ function start(): void {
styles={dropdownStyles}
/>
</Stack>
</Fabric>,
</ThemeProvider>,
_rootDiv,
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/pr-deploy-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"clean": "just-scripts clean",
"generate:site": "just-scripts generate:site",
"lint": "eslint --ext .js,.ts ."
"lint": "eslint --ext .js,.ts --cache ."
},
"license": "MIT",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Remove unused eslint-disables",
"packageName": "@fluentui/babel-make-styles",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Update dependencies and remove eslint@6 from peer deps",
"packageName": "@fluentui/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Mark old ThemeProvider as deprecated to avoid confusion",
"packageName": "@fluentui/foundation-legacy",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update eslint-disables and rename a type param to avoid shadowing (does not affect consumers)",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Update eslint overrides in examples; replace some Fabric and Customizer usage with ThemeProvider",
"packageName": "@fluentui/react-examples",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update demo page to use ThemeProvider not Fabric",
"packageName": "@fluentui/react-monaco-editor",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Remove unused eslint-disable",
"packageName": "@fluentui/react-positioning",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "ComponentState: fix shadowing and doc syntax for type params",
"packageName": "@fluentui/react-utilities",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update eslint-disables in tests",
"packageName": "@fluentui/utilities",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Remove unused import",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "none"
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"cypress-real-events": "1.2.0",
"chalk": "2.4.2",
"danger": "^6.0.5",
"eslint": "7.25.0",
"eslint-plugin-es": "4.1.0",
"file-loader": "6.2.0",
"gulp": "^4.0.2",
Expand Down Expand Up @@ -167,6 +168,9 @@
"resolutions": {
"@types/react": "16.9.42",
"@types/react-dom": "16.9.10",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/experimental-utils": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"eslint": "^7.1.0",
"//": "pretty-format contains typing only supported by TS 3.8+ remove when support in this repo is available",
"@testing-library/dom": "7.22.3",
Expand Down
2 changes: 0 additions & 2 deletions packages/babel-make-styles/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ export const plugin = declare<never, PluginObj<BabelPluginState>>(api => {
const nodePath = styleNode.nodePath;

if (styleNode.kind === 'SPREAD') {
// eslint-disable-next-line no-shadow
const evaluationResult = (nodePath.get('argument') as NodePath<t.Expression>).evaluate();

if (!evaluationResult.confident) {
Expand All @@ -450,7 +449,6 @@ export const plugin = declare<never, PluginObj<BabelPluginState>>(api => {
}

const stylesBySlots: Record<string, MakeStyles> = evaluationResult.value;
// eslint-disable-next-line no-shadow
const resolvedStyles: ResolvedStylesBySlots<string> = {};

Object.keys(stylesBySlots).forEach(slotName => {
Expand Down
22 changes: 11 additions & 11 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
},
"license": "MIT",
"scripts": {
"lint": "eslint --ext .js src"
"build": "tsc --noEmit",
"lint": "eslint --ext .js --cache ."
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/experimental-utils": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/experimental-utils": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-deprecation": "^1.1.0",
"eslint-plugin-import": "^2.21.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-deprecation": "^1.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint-plugin-react-hooks": "^4.2.0",
"jju": "^1.4.0"
},
"devDependencies": {
"@types/eslint": "^7.2.0",
"eslint": "^7.1.0"
"@types/eslint": "7.2.10"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0",
"eslint": "^7.0.0",
"typescript": "^4.1.0"
},
"files": [
Expand Down
15 changes: 8 additions & 7 deletions packages/eslint-plugin/src/configs/react.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// @ts-check
const fs = require('fs');
const path = require('path');
const configHelpers = require('../utils/configHelpers');

const gitRoot = configHelpers.findGitRoot();

/** @type {import("eslint").Linter.Config} */
const config = {
extends: [
Expand All @@ -21,7 +25,7 @@ const config = {
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory
directory: process.cwd(),
project: [path.join(process.cwd(), 'tsconfig.json'), path.join(gitRoot, 'tsconfig.json')].filter(fs.existsSync),
},
},
},
Expand Down Expand Up @@ -304,13 +308,15 @@ const getOverrides = () => [
],
},
],
'@typescript-eslint/no-shadow': 'error',

// permanently disable due to using other rules which do the same thing
camelcase: 'off', // redundant with @typescript-eslint/naming-convention

// permanently disable due to improper TS handling or unnecessary for TS
// (and not covered by plugin:@typescript-eslint/eslint-recommended)
'no-empty-function': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'react/jsx-filename-extension': 'off',
},
Expand Down Expand Up @@ -360,12 +366,7 @@ const getOverrides = () => [
{
files: [...configHelpers.devDependenciesFiles],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
packageDir: [process.cwd(), configHelpers.findGitRoot()],
},
],
'import/no-extraneous-dependencies': ['error', { packageDir: [process.cwd(), gitRoot] }],
},
},
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
/** @type {*} */
// @ts-ignore
const util = require('@typescript-eslint/eslint-plugin/dist/util');
const { AST_NODE_TYPES } = require('@typescript-eslint/experimental-utils');
const createRule = require('../utils/createRule');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"compilerOptions": {
"noEmit": true,
"allowJs": true,
"checkJs": true,
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"strict": true
"skipLibCheck": true,
"strict": true,
"types": []
},
"include": ["src/**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const PillActionableExample = () => (
<Pill
actionable
onDismiss={(e, data) => {
// eslint-disable-next-line no-console
console.log(e, data);
}}
>
Expand Down
1 change: 1 addition & 0 deletions packages/fluentui/docs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type KnobGeneratorOptions = {
};
export type KnobDefinition = UseKnobOptions<any> & { hook: Function };

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type KnobGenerator<T> = (options: KnobGeneratorOptions) => KnobDefinition;

export type KnobComponentGenerators<P> = Partial<Record<keyof P, KnobGenerator<any>>>;
7 changes: 6 additions & 1 deletion packages/fluentui/react-bindings/src/compose/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export type Input<TElementType extends React.ElementType = 'div', TProps = {}> =
| InputComposeComponent<TProps>
| ComposeRenderFunction<TElementType, TProps & { as?: React.ElementType }>;

export type ComposeRenderFunction<TElementType extends React.ElementType = 'div', TProps = {}, _TState = TProps> = (
export type ComposeRenderFunction<
TElementType extends React.ElementType = 'div',
TProps = {},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_TState = TProps
> = (
props: TProps,
ref: React.Ref<TElementType extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TElementType] : TElementType>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
19 changes: 8 additions & 11 deletions packages/fluentui/react-builder/src/components/Designer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,14 @@ export const Designer: React.FunctionComponent = () => {
},
};

const handleKeyDown = React.useCallback(
(e: KeyboardEvent) => {
let command = '';
command += e.altKey ? 'Alt+' : '';
command += e.ctrlKey || e.metaKey ? 'Ctrl+' : '';
command += e.shiftKey ? 'Shift+' : '';
command += e.key;
hotkeys.hasOwnProperty(command) && hotkeys[command]();
},
[hotkeys],
);
const handleKeyDown = (e: KeyboardEvent) => {
let command = '';
command += e.altKey ? 'Alt+' : '';
command += e.ctrlKey || e.metaKey ? 'Ctrl+' : '';
command += e.shiftKey ? 'Shift+' : '';
command += e.key;
hotkeys.hasOwnProperty(command) && hotkeys[command]();
};

const handleOpenAddComponentDialog = React.useCallback(
(uuid: string, where: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/fluentui/react-builder/src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type ListProps = {
export const List: React.FunctionComponent<ListProps> = ({ onDragStart, style }) => {
const [filter, setFilter] = React.useState<string>('');

const filterRegexp = new RegExp(filter, 'i');
const filterRegexp = React.useMemo(() => new RegExp(filter, 'i'), [filter]);

const handleMouseDown = React.useCallback(
componentInfo => e => {
Expand Down
6 changes: 5 additions & 1 deletion packages/fluentui/react-northstar/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
},
{
"files": "src/**/*.{ts,tsx}",
"parserOptions": {
"lib": ["es2015", "dom"]
},
"globals": {
"document": "off",
"window": "off"
"window": "off",
"JSX": "readonly"
},
"rules": {
"no-undef": "error"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ export const Datepicker: ComponentWithAs<'div', DatepickerProps> &
setStart();
const inputRef = React.useRef<HTMLElement>();

// FIXME: This object is created every render, causing a cascade of useCallback/useEffect re-runs.
// Needs to be reworked by someone who understands the intent for when various updates ought to happen.
// eslint-disable-next-line react-hooks/exhaustive-deps
const dateFormatting: ICalendarStrings = {
formatDay: props.formatDay,
formatYear: props.formatYear,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type DesignProps = {
/**
* The Design component provides a theme safe subset of CSS for designing layouts.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function Design<DesignProps>({ config, children }) {
const context = useFluentContext();
const getConfig = React.useCallback(() => config, [config]);
Expand Down
2 changes: 2 additions & 0 deletions packages/fluentui/react-northstar/test/utils/withProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const EmptyThemeProvider: React.FunctionComponent<{
return <Unstable_FluentContextProvider value={value}>{children}</Unstable_FluentContextProvider>;
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const mountWithProvider = <C extends React.Component, P = C['props'], S = C['state']>(
node: React.ReactElement<P>,
options?: MountRendererProps,
Expand All @@ -34,6 +35,7 @@ export const mountWithProvider = <C extends React.Component, P = C['props'], S =
});
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const mountWithProviderAndGetComponent = <C extends React.Component, P = C['props'], S = C['state']>(
Component: ComponentType<P>,
elementToMount: React.ReactElement<P>,
Expand Down
2 changes: 1 addition & 1 deletion packages/foundation-legacy/etc/foundation-legacy.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export type IViewComponent<TViewProps> = (props: React_2.PropsWithChildren<TView

export { legacyStyled }

// @public
// @public @deprecated
export const ThemeProvider: React_2.FunctionComponent<IThemeProviderProps>;

// @public
Expand Down
Loading

0 comments on commit 79b4642

Please sign in to comment.