diff --git a/build/gulp/plugins/gulp-component-menu-behaviors.ts b/build/gulp/plugins/gulp-component-menu-behaviors.ts index 67f8cecb29..c1fedef805 100644 --- a/build/gulp/plugins/gulp-component-menu-behaviors.ts +++ b/build/gulp/plugins/gulp-component-menu-behaviors.ts @@ -20,8 +20,8 @@ type BehaviorMenuItem = { } const getTextFromCommentToken = (commentTokens, tokenTitle): string => { - const token = commentTokens.find(token => token.title === tokenTitle) - return token ? token.description : '' + const resultToken = commentTokens.find(token => token.title === tokenTitle) + return resultToken ? resultToken.description : '' } export default () => { diff --git a/build/gulp/tasks/docs.ts b/build/gulp/tasks/docs.ts index 491889e85f..16a550b7f9 100644 --- a/build/gulp/tasks/docs.ts +++ b/build/gulp/tasks/docs.ts @@ -25,10 +25,10 @@ const { paths } = config const g = require('gulp-load-plugins')() const { colors, log } = g.util -const handleWatchChange = path => log(`File ${path} was changed, running tasks...`) -const handleWatchUnlink = (group, path) => { - log(`File ${path} was deleted, running tasks...`) - remember.forget(group, path) +const handleWatchChange = changedPath => log(`File ${changedPath} was changed, running tasks...`) +const handleWatchUnlink = (group, changedPath) => { + log(`File ${changedPath} was deleted, running tasks...`) + remember.forget(group, changedPath) } // ---------------------------------------- @@ -227,7 +227,7 @@ task('watch:docs', cb => { // rebuild example menus watch(examplesIndexSrc, series('build:docs:example-menu')) .on('change', handleWatchChange) - .on('unlink', path => handleWatchUnlink('example-menu', path)) + .on('unlink', changedPath => handleWatchUnlink('example-menu', changedPath)) watch(examplesSrc, series('build:docs:example-sources')) .on('change', handleWatchChange) @@ -244,7 +244,7 @@ task('watch:docs', cb => { watch(behaviorSrc, series('build:docs:component-menu-behaviors')) .on('change', handleWatchChange) - .on('unlink', path => handleWatchUnlink('component-menu-behaviors', path)) + .on('unlink', changedPath => handleWatchUnlink('component-menu-behaviors', changedPath)) // rebuild images watch(`${config.paths.docsSrc()}/**/*.{png,jpg,gif}`, series('build:docs:images')).on( diff --git a/build/gulp/tasks/perf.ts b/build/gulp/tasks/perf.ts index dcbd6d16e3..5bff8a6aee 100644 --- a/build/gulp/tasks/perf.ts +++ b/build/gulp/tasks/perf.ts @@ -72,9 +72,9 @@ const normalizeMeasures = (measures: ProfilerMeasureCycle[]): NormalizedMeasures {}, ) - return _.mapValues(perExampleMeasures, (measures: ProfilerMeasure[]) => ({ - actualTime: reduceMeasures(measures, 'actualTime'), - baseTime: reduceMeasures(measures, 'baseTime'), + return _.mapValues(perExampleMeasures, (profilerMeasures: ProfilerMeasure[]) => ({ + actualTime: reduceMeasures(profilerMeasures, 'actualTime'), + baseTime: reduceMeasures(profilerMeasures, 'baseTime'), })) } diff --git a/build/gulp/tasks/stats.ts b/build/gulp/tasks/stats.ts index 73b10125e9..3e0b760d18 100644 --- a/build/gulp/tasks/stats.ts +++ b/build/gulp/tasks/stats.ts @@ -46,9 +46,9 @@ const semverCmp = (a, b) => { return 0 } -function webpackAsync(config): Promise { +function webpackAsync(webpackConfig): Promise { return new Promise((resolve, reject) => { - const compiler = webpack(config) + const compiler = webpack(webpackConfig) compiler.run((err, stats) => { const statsJson = stats.toJson() const { errors, warnings } = statsJson @@ -73,14 +73,14 @@ function webpackAsync(config): Promise { async function compileOneByOne(allConfigs) { let assets = [] - for (const config of allConfigs) { - log('Compiling', config.output.filename) + for (const webpackConfig of allConfigs) { + log('Compiling', webpackConfig.output.filename) try { - const result = await webpackAsync(config) + const result = await webpackAsync(webpackConfig) assets = [...assets, ...result.assets] log('Done', result.assets[0].name) // All builds should produce just single asset } catch (err) { - log('Error', config.output.filename) + log('Error', webpackConfig.output.filename) throw err } } diff --git a/build/gulp/tasks/test-projects.tsx b/build/gulp/tasks/test-projects.tsx index 747f4c422e..cb24e86104 100644 --- a/build/gulp/tasks/test-projects.tsx +++ b/build/gulp/tasks/test-projects.tsx @@ -23,7 +23,7 @@ const log = (context: string) => (message: string) => { console.log('='.repeat(80)) } -export const runIn = path => cmd => sh(`cd ${path} && ${cmd}`) +export const runIn = targetPath => cmd => sh(`cd ${targetPath} && ${cmd}`) const addResolutionPathsForStardustPackages = async ( testProjectDir: string, @@ -136,7 +136,6 @@ task('test:projects:cra-ts', async () => { const logger = log('test:projects:cra-ts') const scaffoldPath = paths.base.bind(null, 'build/gulp/tasks/test-projects/cra') - //////// CREATE TEST REACT APP /////// logger('STEP 1. Create test React project with TSX scripts..') const testAppPath = paths.withRootAt( @@ -146,7 +145,6 @@ task('test:projects:cra-ts', async () => { const runInTestApp = runIn(testAppPath()) logger(`Test React project is successfully created: ${testAppPath()}`) - //////// ADD STARDUST AS A DEPENDENCY /////// logger('STEP 2. Add Stardust dependency to test project..') const packedPackages = await packStardustPackages(logger) @@ -154,11 +152,9 @@ task('test:projects:cra-ts', async () => { await runInTestApp(`yarn add ${packedPackages['@stardust-ui/react']}`) logger(`✔️Stardust UI packages were added to dependencies`) - //////// REFERENCE STARDUST COMPONENTS IN TEST APP's MAIN FILE /////// logger("STEP 3. Reference Stardust components in test project's App.tsx") fs.copyFileSync(scaffoldPath('App.tsx'), testAppPath('src', 'App.tsx')) - //////// BUILD TEST PROJECT /////// logger('STEP 4. Build test project..') await runInTestApp(`yarn build`) diff --git a/build/gulp/tasks/test-vulns.ts b/build/gulp/tasks/test-vulns.ts index b20351292e..5e141ebfe1 100644 --- a/build/gulp/tasks/test-vulns.ts +++ b/build/gulp/tasks/test-vulns.ts @@ -14,9 +14,9 @@ const SCAN_RESULTS_DIR_PATH = paths.base(SCAN_RESULTS_DIR_NAME) const log = message => debug.log(message) log.success = message => debug.log(`✔ ${message}`) -const ensureDirExists = path => { - if (!fs.existsSync(path)) { - sh(`mkdir -p ${path}`) +const ensureDirExists = directoryPath => { + if (!fs.existsSync(directoryPath)) { + sh(`mkdir -p ${directoryPath}`) } } diff --git a/docs/src/app.tsx b/docs/src/app.tsx index 779023692c..4ac8f53420 100644 --- a/docs/src/app.tsx +++ b/docs/src/app.tsx @@ -1,5 +1,4 @@ import * as React from 'react' -import * as _ from 'lodash' import { Provider, themes } from '@stardust-ui/react' import { mergeThemes } from 'src/lib' diff --git a/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx b/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx index 321e9cc63d..36e43bb489 100644 --- a/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx +++ b/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx @@ -43,13 +43,13 @@ export default class ComponentPropsRow extends React.Component { {/* TODO change these according to the react-docgen-typescript generated json */} - {/**/} - {/**/} + {/* */} + {/* */} ) diff --git a/docs/src/components/ComponentDoc/PerfChart/PerfDataProvider.tsx b/docs/src/components/ComponentDoc/PerfChart/PerfDataProvider.tsx index 49a56b1de7..2daf920d4d 100644 --- a/docs/src/components/ComponentDoc/PerfChart/PerfDataProvider.tsx +++ b/docs/src/components/ComponentDoc/PerfChart/PerfDataProvider.tsx @@ -27,8 +27,8 @@ const PerfDataProvider: React.FC = ({ children }) => { setData(responseJson) setLoading(false) }) - .catch(error => { - setError(error) + .catch(e => { + setError(e) setLoading(false) }) } diff --git a/docs/src/components/ComponentPlayground.tsx b/docs/src/components/ComponentPlayground.tsx index 75b86c237a..5a24012dfe 100644 --- a/docs/src/components/ComponentPlayground.tsx +++ b/docs/src/components/ComponentPlayground.tsx @@ -13,12 +13,12 @@ type ComponentPlaygroundProps = { } const ComponentPlayground: React.FunctionComponent = props => { - const playgroundPath = _.find(playgroundPaths, playgroundPath => + const resultPath = _.find(playgroundPaths, playgroundPath => _.includes(playgroundPath, `/${props.componentName}/`), ) - if (playgroundPath) { - const PlaygroundComponent: React.FunctionComponent = examplePlaygroundContext(playgroundPath) + if (resultPath) { + const PlaygroundComponent: React.FunctionComponent = examplePlaygroundContext(resultPath) .default return ( diff --git a/docs/src/components/DocsBehaviorRoot.tsx b/docs/src/components/DocsBehaviorRoot.tsx index abcdb97c72..50fc48cf0a 100644 --- a/docs/src/components/DocsBehaviorRoot.tsx +++ b/docs/src/components/DocsBehaviorRoot.tsx @@ -61,8 +61,8 @@ class DocsBehaviorRoot extends React.Component { <> Description:
- {variation.description.split('\n').map((splittedText, keyValue) => ( - + {variation.description.split('\n').map((splittedText, key) => ( + {splittedText}
@@ -74,8 +74,8 @@ class DocsBehaviorRoot extends React.Component { {variation.description &&
} Specification:
- {variation.specification.split('\n').map((splittedText, keyValue) => ( - + {variation.specification.split('\n').map((splittedText, key) => ( + {splittedText}
diff --git a/docs/src/components/ExternalExampleLayout.tsx b/docs/src/components/ExternalExampleLayout.tsx index b34e83e58e..d653971564 100644 --- a/docs/src/components/ExternalExampleLayout.tsx +++ b/docs/src/components/ExternalExampleLayout.tsx @@ -47,10 +47,10 @@ class ExternalExampleLayout extends React.Component< const { exampleName } = this.props.match.params const exampleFilename = exampleKebabNameToSourceFilename(exampleName) - const examplePath = _.find(examplePaths, path => { - const { exampleName } = parseExamplePath(path) - return exampleFilename === exampleName - }) + const examplePath = _.find( + examplePaths, + path => exampleFilename === parseExamplePath(path).exampleName, + ) if (!examplePath) return diff --git a/docs/src/examples/components/Chat/Content/ChatExampleReactionGroupMeReacting.shorthand.tsx b/docs/src/examples/components/Chat/Content/ChatExampleReactionGroupMeReacting.shorthand.tsx index f4dfd7a1e0..3afd93aa39 100644 --- a/docs/src/examples/components/Chat/Content/ChatExampleReactionGroupMeReacting.shorthand.tsx +++ b/docs/src/examples/components/Chat/Content/ChatExampleReactionGroupMeReacting.shorthand.tsx @@ -1,5 +1,4 @@ import * as React from 'react' -import * as _ from 'lodash' import { Avatar, Chat } from '@stardust-ui/react' const reactions = [ diff --git a/docs/src/examples/components/Provider/Types/ProviderExample.shorthand.tsx b/docs/src/examples/components/Provider/Types/ProviderExample.shorthand.tsx index ba99eda4c1..8fb355134a 100644 --- a/docs/src/examples/components/Provider/Types/ProviderExample.shorthand.tsx +++ b/docs/src/examples/components/Provider/Types/ProviderExample.shorthand.tsx @@ -1,10 +1,10 @@ import * as React from 'react' import { Provider } from '@stardust-ui/react' -const theme = { siteVariables: { brand: 'cornflowerblue' } } +const customTheme = { siteVariables: { brand: 'cornflowerblue' } } const ProviderExampleShorthand = () => ( - +

Use the Provider.Consumer to access the theme: diff --git a/docs/src/prototypes/chatPane/services/dateUtils.ts b/docs/src/prototypes/chatPane/services/dateUtils.ts index 103ac7711a..4ad1904ca0 100644 --- a/docs/src/prototypes/chatPane/services/dateUtils.ts +++ b/docs/src/prototypes/chatPane/services/dateUtils.ts @@ -22,8 +22,8 @@ export const getRandomDates = (count, daysAgo: number): Date[] => { ].slice(0, count) } -export const getTimestamp = (date: Date): { short: string; long: string } => { - const dateMoment = moment(date) +export const getTimestamp = (inputDate: Date): { short: string; long: string } => { + const dateMoment = moment(inputDate) const timeString = dateMoment.format('LT') return { @@ -32,17 +32,17 @@ export const getTimestamp = (date: Date): { short: string; long: string } => { } } -export const getFriendlyDateString = (date: Date): string => { +export const getFriendlyDateString = (inputDate: Date): string => { const momentNow = moment() - if (areMomentsSameDay(momentNow, date)) { + if (areMomentsSameDay(momentNow, inputDate)) { return 'Today' } - if (areMomentsSameDay(momentNow.subtract(1, 'd'), date)) { + if (areMomentsSameDay(momentNow.subtract(1, 'd'), inputDate)) { return 'Yesterday' } - return moment(date).format('LL') + return moment(inputDate).format('LL') } export const areSameDay = (d1: Date, d2: Date): boolean => areMomentsSameDay(moment(d1), d2) diff --git a/docs/src/prototypes/chatPane/services/messageFactoryMock.tsx b/docs/src/prototypes/chatPane/services/messageFactoryMock.tsx index b96439e9b9..ff6b470987 100644 --- a/docs/src/prototypes/chatPane/services/messageFactoryMock.tsx +++ b/docs/src/prototypes/chatPane/services/messageFactoryMock.tsx @@ -87,8 +87,8 @@ function createMessageContent(message: MessageData): ShorthandValue { } function createMessageContentWithAttachments(content: string, messageId: string): JSX.Element { - const menuClickHandler = content => e => { - alert(`${content} clicked`) + const menuClickHandler = message => e => { + alert(`${message} clicked`) e.stopPropagation() } diff --git a/docs/src/prototypes/mentions/MentionsDropdown.tsx b/docs/src/prototypes/mentions/MentionsDropdown.tsx index 6899313a64..3913c1ebb4 100644 --- a/docs/src/prototypes/mentions/MentionsDropdown.tsx +++ b/docs/src/prototypes/mentions/MentionsDropdown.tsx @@ -1,5 +1,4 @@ import * as React from 'react' -import * as _ from 'lodash' import { FontWeightProperty } from 'csstype' import { Dropdown, DropdownItemProps, Provider } from '@stardust-ui/react' diff --git a/packages/internal-tooling/eslint/index.js b/packages/internal-tooling/eslint/index.js index 329a4ea1b7..bd66ad3605 100644 --- a/packages/internal-tooling/eslint/index.js +++ b/packages/internal-tooling/eslint/index.js @@ -9,14 +9,16 @@ module.exports = { rules: { // False positive on arg types: // https://github.com/typescript-eslint/typescript-eslint/issues/46 - // '@typescript-eslint/no-unused-vars': ['error', { args: 'none' }], + '@typescript-eslint/no-unused-vars': ['error', { args: 'none' }], + 'import/no-unresolved': 'off', 'prettier/prettier': 'error', 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.tsx'] }], + 'no-shadow': 'off', // https://github.com/stardust-ui/react/pull/1261#pullrequestreview-231005092 + 'no-unused-vars': 'off', // we use @typescript-eslint/no-unused-vars instead semi: ['error', 'never'], // Temporary disabled rules - '@typescript-eslint/no-unused-vars': 'off', 'jsx-a11y/click-events-have-key-events': 'off', 'jsx-a11y/no-static-element-interactions': 'off', 'jsx-a11y/alt-text': 'off', @@ -83,20 +85,17 @@ module.exports = { 'no-restricted-syntax': 'off', 'no-throw-literal': 'off', 'no-sparse-arrays': 'off', - 'no-shadow': 'off', 'no-undef': 'off', 'no-undef-init': 'off', 'no-underscore-dangle': 'off', 'no-unused-expressions': 'off', 'no-useless-return': 'off', - 'no-unused-vars': 'off', 'no-empty-function': 'off', 'no-useless-constructor': 'off', 'no-useless-escape': 'off', 'no-use-before-define': 'off', 'operator-assignment': 'off', 'prefer-destructuring': 'off', - 'spaced-comment': 'off', }, overrides: [ { diff --git a/packages/react/src/components/Avatar/Avatar.tsx b/packages/react/src/components/Avatar/Avatar.tsx index 95bf8a75cb..da8ef23548 100644 --- a/packages/react/src/components/Avatar/Avatar.tsx +++ b/packages/react/src/components/Avatar/Avatar.tsx @@ -80,7 +80,7 @@ class Avatar extends UIComponent, any> { const initials = reducedName .split(' ') .filter(item => item !== '') - .map(name => name.charAt(0)) + .map(item => item.charAt(0)) .reduce((accumulator, currentValue) => accumulator + currentValue) if (initials.length > 2) { diff --git a/packages/react/src/components/Dropdown/Dropdown.tsx b/packages/react/src/components/Dropdown/Dropdown.tsx index ef74ce1b0e..e21d4e9ec9 100644 --- a/packages/react/src/components/Dropdown/Dropdown.tsx +++ b/packages/react/src/components/Dropdown/Dropdown.tsx @@ -978,7 +978,7 @@ class Dropdown extends AutoControlledComponent, Dropdo e: React.SyntheticEvent, item: ShorthandValue, predefinedProps: DropdownSelectedItemProps, - DropdownSelectedItemProps: DropdownSelectedItemProps, + dropdownSelectedItemProps: DropdownSelectedItemProps, rtl: boolean, ) { const { activeSelectedIndex, value } = this.state as { @@ -991,7 +991,7 @@ class Dropdown extends AutoControlledComponent, Dropdo switch (keyboardKey.getCode(e)) { case keyboardKey.Delete: case keyboardKey.Backspace: - this.handleSelectedItemRemove(e, item, predefinedProps, DropdownSelectedItemProps) + this.handleSelectedItemRemove(e, item, predefinedProps, dropdownSelectedItemProps) break case previousKey: if (value.length > 0 && !_.isNil(activeSelectedIndex) && activeSelectedIndex > 0) { @@ -1016,7 +1016,7 @@ class Dropdown extends AutoControlledComponent, Dropdo default: break } - _.invoke(predefinedProps, 'onKeyDown', e, DropdownSelectedItemProps) + _.invoke(predefinedProps, 'onKeyDown', e, dropdownSelectedItemProps) } private handleTriggerButtonOrListFocus = () => { @@ -1039,13 +1039,13 @@ class Dropdown extends AutoControlledComponent, Dropdo e: React.SyntheticEvent, item: ShorthandValue, predefinedProps: DropdownSelectedItemProps, - DropdownSelectedItemProps: DropdownSelectedItemProps, + dropdownSelectedItemProps: DropdownSelectedItemProps, ) { this.trySetState({ activeSelectedIndex: null }) this.removeItemFromValue(item) this.tryFocusSearchInput() this.tryFocusTriggerButton() - _.invoke(predefinedProps, 'onRemove', e, DropdownSelectedItemProps) + _.invoke(predefinedProps, 'onRemove', e, dropdownSelectedItemProps) } private removeItemFromValue(item?: ShorthandValue) { diff --git a/packages/react/src/components/Popup/Popup.tsx b/packages/react/src/components/Popup/Popup.tsx index abc1dfbe1f..4959ee5b6c 100644 --- a/packages/react/src/components/Popup/Popup.tsx +++ b/packages/react/src/components/Popup/Popup.tsx @@ -334,7 +334,7 @@ export default class Popup extends AutoControlledComponent { - const contentProps: any = {} + const contentHandlerProps: any = {} const { on } = this.props const normalizedOn = _.isArray(on) ? on : [on] @@ -343,11 +343,11 @@ export default class Popup extends AutoControlledComponent { + contentHandlerProps.onFocus = (e, contentProps) => { this.trySetOpen(true, e) predefinedProps && _.invoke(predefinedProps, 'onFocus', e, contentProps) } - contentProps.onBlur = (e, contentProps) => { + contentHandlerProps.onBlur = (e, contentProps) => { if (this.shouldBlurClose(e)) { this.trySetOpen(false, e) } @@ -359,21 +359,21 @@ export default class Popup extends AutoControlledComponent { + contentHandlerProps.onMouseEnter = (e, contentProps) => { this.setPopupOpen(true, e) predefinedProps && _.invoke(predefinedProps, 'onMouseEnter', e, contentProps) } - contentProps.onMouseLeave = (e, contentProps) => { + contentHandlerProps.onMouseLeave = (e, contentProps) => { this.setPopupOpen(false, e) predefinedProps && _.invoke(predefinedProps, 'onMouseLeave', e, contentProps) } - contentProps.onClick = (e, contentProps) => { + contentHandlerProps.onClick = (e, contentProps) => { this.setPopupOpen(true, e) predefinedProps && _.invoke(predefinedProps, 'onClick', e, contentProps) } } - return contentProps + return contentHandlerProps } shouldBlurClose = e => { diff --git a/packages/react/src/components/Popup/positioningHelper.ts b/packages/react/src/components/Popup/positioningHelper.ts index 8cec673355..92e74d367a 100644 --- a/packages/react/src/components/Popup/positioningHelper.ts +++ b/packages/react/src/components/Popup/positioningHelper.ts @@ -75,9 +75,9 @@ export const getPopupPlacement = ({ return `${computedPosition}${stringifiedAlignment}` as Placement } -///////////////////////////////// +// // OFFSET VALUES ADJUSTMENT -///////////////////////////////// +// const flipPlusMinusSigns = (offset: string): string => { return offset diff --git a/packages/react/src/lib/accessibility/FocusHandling/FocusContainer.ts b/packages/react/src/lib/accessibility/FocusHandling/FocusContainer.ts index ef2aea39bd..48880945c6 100644 --- a/packages/react/src/lib/accessibility/FocusHandling/FocusContainer.ts +++ b/packages/react/src/lib/accessibility/FocusHandling/FocusContainer.ts @@ -1,5 +1,3 @@ -import * as _ from 'lodash' - export class ContainerFocusHandler { private focusedIndex = 0 diff --git a/packages/react/src/lib/accessibility/FocusZone/FocusZone.tsx b/packages/react/src/lib/accessibility/FocusZone/FocusZone.tsx index 64863d9dfc..5f7a582e3e 100644 --- a/packages/react/src/lib/accessibility/FocusZone/FocusZone.tsx +++ b/packages/react/src/lib/accessibility/FocusZone/FocusZone.tsx @@ -793,7 +793,7 @@ export class FocusZone extends React.Component implements IFocus return distance }, - undefined /*ev*/, + undefined /* ev */, true, ) ) { @@ -832,7 +832,7 @@ export class FocusZone extends React.Component implements IFocus return distance }, - undefined /*ev*/, + undefined /* ev */, true, ) ) { diff --git a/packages/react/src/lib/accessibility/FocusZone/focusUtilities.ts b/packages/react/src/lib/accessibility/FocusZone/focusUtilities.ts index f6d83f480d..f75ec99fe5 100644 --- a/packages/react/src/lib/accessibility/FocusZone/focusUtilities.ts +++ b/packages/react/src/lib/accessibility/FocusZone/focusUtilities.ts @@ -18,9 +18,9 @@ export function getFirstFocusable( return getNextElement( rootElement, currentElement, - true /*checkNode*/, - false /*suppressParentTraversal*/, - false /*suppressChildTraversal*/, + true /* checkNode */, + false /* suppressParentTraversal */, + false /* suppressChildTraversal */, includeElementsInFocusZones, ) } @@ -38,9 +38,9 @@ export function getLastFocusable( return getPreviousElement( rootElement, currentElement, - true /*checkNode*/, - false /*suppressParentTraversal*/, - true /*traverseChildren*/, + true /* checkNode */, + false /* suppressParentTraversal */, + true /* traverseChildren */, includeElementsInFocusZones, ) } @@ -62,12 +62,12 @@ export function getFirstTabbable( return getNextElement( rootElement, currentElement, - true /*checkNode*/, - false /*suppressParentTraversal*/, - false /*suppressChildTraversal*/, + true /* checkNode */, + false /* suppressParentTraversal */, + false /* suppressChildTraversal */, includeElementsInFocusZones, - false /*allowFocusRoot*/, - true /*tabbable*/, + false /* allowFocusRoot */, + true /* tabbable */, ) } @@ -88,12 +88,12 @@ export function getLastTabbable( return getPreviousElement( rootElement, currentElement, - true /*checkNode*/, - false /*suppressParentTraversal*/, - true /*traverseChildren*/, + true /* checkNode */, + false /* suppressParentTraversal */, + true /* traverseChildren */, includeElementsInFocusZones, - false /*allowFocusRoot*/, - true /*tabbable*/, + false /* allowFocusRoot */, + true /* tabbable */, ) } diff --git a/packages/react/src/themes/teams/components/Divider/dividerVariables.ts b/packages/react/src/themes/teams/components/Divider/dividerVariables.ts index 653d857d5d..2357ce6a87 100644 --- a/packages/react/src/themes/teams/components/Divider/dividerVariables.ts +++ b/packages/react/src/themes/teams/components/Divider/dividerVariables.ts @@ -1,4 +1,3 @@ -import * as _ from 'lodash' import { FontWeightProperty } from 'csstype' import { ColorValues } from '../../../types' diff --git a/packages/react/src/themes/teams/components/Label/labelStyles.ts b/packages/react/src/themes/teams/components/Label/labelStyles.ts index a188c2dd21..7f823fc306 100644 --- a/packages/react/src/themes/teams/components/Label/labelStyles.ts +++ b/packages/react/src/themes/teams/components/Label/labelStyles.ts @@ -1,5 +1,3 @@ -import * as _ from 'lodash' - import { pxToRem } from '../../../../lib' import { ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types' import { LabelProps } from '../../../../components/Label/Label' diff --git a/packages/react/test/specs/components/Dropdown/Dropdown-test.tsx b/packages/react/test/specs/components/Dropdown/Dropdown-test.tsx index b6f4f6d68b..cc59ca1693 100644 --- a/packages/react/test/specs/components/Dropdown/Dropdown-test.tsx +++ b/packages/react/test/specs/components/Dropdown/Dropdown-test.tsx @@ -500,7 +500,6 @@ describe('Dropdown', () => { }) it('is the index of the value previously selected when opened', () => { - const onOpenChange = jest.fn() const wrapper = mountWithProvider() const triggerButton = wrapper.find(`button.${Dropdown.slotClassNames.triggerButton}`) @@ -523,7 +522,6 @@ describe('Dropdown', () => { }) it('is the index of the (value previously selected + 1) when opened by arrow down', () => { - const onOpenChange = jest.fn() const wrapper = mountWithProvider() const triggerButton = wrapper.find(`button.${Dropdown.slotClassNames.triggerButton}`) @@ -548,7 +546,6 @@ describe('Dropdown', () => { }) it('is the index of the (value previously selected - 1) when opened by arrow up', () => { - const onOpenChange = jest.fn() const wrapper = mountWithProvider() const triggerButton = wrapper.find(`button.${Dropdown.slotClassNames.triggerButton}`) @@ -1049,8 +1046,7 @@ describe('Dropdown', () => { const stopPropagation = jest.fn() const stopImmediatePropagation = jest.fn() const mockedEvent = { stopPropagation, nativeEvent: { stopImmediatePropagation } } - const items = [{ header: 'Venom', onClick }] - const wrapper = mountWithProvider() + const wrapper = mountWithProvider() const triggerButton = wrapper.find(`button.${Dropdown.slotClassNames.triggerButton}`) triggerButton.simulate('click') diff --git a/packages/react/test/specs/components/Input/Input-test.tsx b/packages/react/test/specs/components/Input/Input-test.tsx index 2bc9dcd8bb..5b882aed55 100644 --- a/packages/react/test/specs/components/Input/Input-test.tsx +++ b/packages/react/test/specs/components/Input/Input-test.tsx @@ -16,9 +16,9 @@ import Box from 'src/components/Box/Box' const testValue = 'test value' const htmlInputAttrs = ['id', 'name', 'pattern', 'placeholder', 'type', 'value'] -const getInputAttrsObject = (testValue: string) => +const getInputAttrsObject = (value: string) => htmlInputAttrs.reduce((acc, attr) => { - acc[attr] = testValue + acc[attr] = value return acc }, {}) diff --git a/packages/react/test/specs/components/Menu/MenuItem-test.tsx b/packages/react/test/specs/components/Menu/MenuItem-test.tsx index 0c77d9f504..add265d352 100644 --- a/packages/react/test/specs/components/Menu/MenuItem-test.tsx +++ b/packages/react/test/specs/components/Menu/MenuItem-test.tsx @@ -46,7 +46,7 @@ describe('MenuItem', () => { handlesAccessibility(MenuItem, { defaultRootRole: 'presentation', usesWrapperSlot: true }) handlesAccessibility(MenuItem, { defaultRootRole: 'menuitem', partSelector: 'a' }) - const accessibility: { name: string; behavior: Accessibility; expectedAnchorRole: string }[] = [ + const behaviors: { name: string; behavior: Accessibility; expectedAnchorRole: string }[] = [ { name: 'default', behavior: undefined, expectedAnchorRole: 'menuitem' }, { name: 'toolbarButtonBehavior', @@ -55,7 +55,7 @@ describe('MenuItem', () => { }, { name: 'tabBehavior', behavior: tabBehavior, expectedAnchorRole: 'tab' }, ] - accessibility.forEach(accessibility => { + behaviors.forEach(accessibility => { test(`integration test for ${accessibility.name} behavior`, () => { // accessibility functionality is covered by a combination of behavior tests and `handlesAccessibility()` // this is just an integration smoke test diff --git a/packages/react/test/specs/lib/FocusTrapZone-test.tsx b/packages/react/test/specs/lib/FocusTrapZone-test.tsx index a07c9a977b..4ba562d8d9 100644 --- a/packages/react/test/specs/lib/FocusTrapZone-test.tsx +++ b/packages/react/test/specs/lib/FocusTrapZone-test.tsx @@ -388,7 +388,7 @@ describe('FocusTrapZone', () => { expect.assertions(4) const { focusTrapZone, buttonF, buttonB, buttonZ } = setupTest( - true /*focusPreviouslyFocusedInnerElement*/, + true /* focusPreviouslyFocusedInnerElement */, ) // By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element @@ -417,7 +417,7 @@ describe('FocusTrapZone', () => { expect.assertions(4) const { focusTrapZone, buttonF, buttonB, buttonZ } = setupTest( - false /*focusPreviouslyFocusedInnerElement*/, + false /* focusPreviouslyFocusedInnerElement */, ) // By calling `componentDidMount`, FTZ will behave as just initialized and focus needed element diff --git a/packages/react/test/specs/lib/felaSanitizeCssPlugin-test.ts b/packages/react/test/specs/lib/felaSanitizeCssPlugin-test.ts index 81bd65c8a5..055d5d5fed 100644 --- a/packages/react/test/specs/lib/felaSanitizeCssPlugin-test.ts +++ b/packages/react/test/specs/lib/felaSanitizeCssPlugin-test.ts @@ -42,7 +42,7 @@ describe('felaSanitizeCssPlugin', () => { }) test('should skip excluded CSS props', () => { - const sanitize = sanitizeCss({ + const withSkip = sanitizeCss({ skip: ['propertyWithInvalidValue'], }) @@ -52,7 +52,7 @@ describe('felaSanitizeCssPlugin', () => { propertyWithInvalidValue: 'rgba(', } - expect(sanitize(style)).toEqual(style) + expect(withSkip(style)).toEqual(style) }) describe('should properly filter invalid bracket sequences', () => { diff --git a/perf/src/index.tsx b/perf/src/index.tsx index f6554d7cf3..c4ec5ca0e7 100644 --- a/perf/src/index.tsx +++ b/perf/src/index.tsx @@ -16,10 +16,10 @@ const performanceExamplesContext = require.context('docs/src/examples/', true, / // We want to randomize examples to avoid any notable issues with always first example const performanceExampleNames: string[] = _.shuffle(performanceExamplesContext.keys()) -const asyncRender = (element: React.ReactElement, mountNode: Element) => +const asyncRender = (element: React.ReactElement, container: Element) => new Promise(resolve => { - ReactDOM.render(element, mountNode, () => { - ReactDOM.unmountComponentAtNode(mountNode) + ReactDOM.render(element, container, () => { + ReactDOM.unmountComponentAtNode(container) resolve() }) }) diff --git a/perf/types.tsx b/perf/types.tsx index 23989e9e13..d0d7d4b6c8 100644 --- a/perf/types.tsx +++ b/perf/types.tsx @@ -1,5 +1,3 @@ -import * as _ from 'lodash' - declare global { interface Window { runMeasures: (filter?: string) => Promise diff --git a/types/screener.d.ts b/types/screener.d.ts index 32450e97e8..5443e84ca2 100644 --- a/types/screener.d.ts +++ b/types/screener.d.ts @@ -50,10 +50,10 @@ declare global { /** This will send the provided keys to the first element matching the provided css selector. */ keys(selector: string, key: string): ScreenerStepBuilder - /** This will pause execution for the specified number of ms.*/ + /** This will pause execution for the specified number of ms. */ wait(ms: number): ScreenerStepBuilder - /** This will override the global cssAnimations option for the current UI state. Set to true to enable CSS Animations, and set to false to disable.*/ + /** This will override the global cssAnimations option for the current UI state. Set to true to enable CSS Animations, and set to false to disable. */ cssAnimations(isEnabled: boolean): ScreenerStepBuilder /** This will set the current UI state to right-to-left direction. */ @@ -65,10 +65,10 @@ declare global { /** This will return the steps to be run. */ end(): any[] - /** This will switch the theme */ + /** This will switch the theme. */ switchTheme(themeName: ScreenerThemeName): ScreenerStepBuilder - /** This will reset the layout */ + /** This will reset the layout. */ resetExternalLayout(): ScreenerStepBuilder } diff --git a/types/simulant.d.ts b/types/simulant.d.ts index ebb7cc862d..06d8662717 100644 --- a/types/simulant.d.ts +++ b/types/simulant.d.ts @@ -1,7 +1,7 @@ declare module 'simulant' { namespace event { - function fire(el: Node, event: Event): void - function fire(el: Node, event: string, payload?: { [key: string]: any }): void + function fire(el: Node, e: Event): void + function fire(el: Node, e: string, payload?: { [key: string]: any }): void } function event(window: Window, eventName: string, payload?: { [key: string]: any }): Event