Git Product home page Git Product logo

dx-platform's Introduction

build status

dx-platform

Contribution Prerequisites

  • You have Node installed at v8.0.0+ and Yarn at v1.2.0+.

Development Workflow

dx-platform is a monorepo project.

After cloning, run yarn to fetch dependencies for all packages. Then, run yarn lerna run prepare to build all packages.

Also you can run several commands:

  • yarn test — checks codestyle and run tests for all packages.
  • yarn lerna run watch --parallel — runs watch task for each package in parallel. You can manage scope of packages using --scope [glob] flag (see lerna documentation for details)

Commit name convention

https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits

Publish

--conventional-commit flag enabled by lerna.json file. It forces bump version to next major if breaking changes was introduced. To avoid this behaviour during 0.x phase use yarn lerna publish --cd-version <minor|patch> --force-publish=* for publishing.

dx-platform's People

Contributors

baric60 avatar dependabot[bot] avatar devexperts-bot avatar dramoturg avatar green176 avatar igoralekseev avatar jeeronimoo avatar mankdev avatar mikhailkilin avatar raveclassic avatar scink avatar serg046 avatar sergeymakoveev avatar session-knip avatar sky161 avatar sutarmin avatar tanyus avatar vkamotin avatar zeihlis avatar znack avatar zugaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dx-platform's Issues

Fix build warnings

We have annoying warnings like

@devexperts/[email protected]" has unmet peer dependency "@types/react@>=16.3.16"

when yarn installs dependencies.
Need to fix them.

Hide external dependencies behind local interfaces/implementations

Hi all.

Recent update to platform show that we have too much external dependencies in the code. Refactoring gets too complicated and requires lot of unnecessary changes. For example, if we need to migrate from rxjs to mostjs we need to rewrite the whole codebase. However if we had a proxy/wrapper in utils (e.g. Stream) we could only change its implementation and don't touch the code. The same applies to libraries such as fp-ts. We could have local interfaces and implementations just forwarding calls to fp-ts and the rest of the code would be library agnostic.

So this ticket is going to track the upcoming migration.

add some tslint rules

i suggest to add next rules:

  1. adjacent-overload-signatures - Enforces function overloads to be consecutive.
  2. arrow-return-shorthand - Suggests to convert () => { return x; } to () => x.
  3. ban-comma-operator - Disallows the comma operator to be used. Read more about the comma operator here.
  4. binary-expression-operand-order - In a binary expression, a literal should always be on the right-hand side if possible. For example, prefer ‘x + 1’ over ‘1 + x’.
  5. eofline - Ensures the file ends with a newline.
  6. file-name-casing - Enforces a consistent file naming convention.
  7. indent - Enforces indentation with tabs or spaces.
  8. max-classes-per-file - A file may not contain more than the specified number of classes.
  9. member-access - Requires explicit visibility declarations for class members.
  10. no-any - Disallows usages of any as a type declaration.
  11. no-boolean-literal-compare - Warns on comparison to a boolean literal, as in x === true.
  12. no-construct - Disallows access to the constructors of String, Number, and Boolean.
  13. no-console - Bans the use of specified console methods.
  14. no-debugger - Disallows debugger statements.
  15. no-default-export - Disallows default exports in ES6-style modules.
  16. no-duplicate-super - Warns if super() appears twice in a constructor.
  17. no-duplicate-switch-case - Prevents duplicate cases in switch statements.
  18. no-duplicate-variable - Disallows duplicate variable declarations in the same block scope.
  19. no-empty - Disallows empty blocks.
  20. no-empty-interface - Forbids empty interfaces.
  21. no-for-in-array - Disallows iterating over an array with a for-in loop.
  22. no-magic-numbers - Disallows the use constant number values outside of variable assignments. When no list of allowed values is specified, -1, 0 and 1 are allowed by default.
  23. no-namespace - Disallows use of internal modules and namespaces.
  24. no-non-null-assertion - Disallows non-null assertions using the ! postfix operator.
  25. no-require-imports - Disallows invocation of require().
  26. no-shadowed-variable - Disallows shadowing variable declarations.
  27. no-use-before-declare - Disallows usage of variables before their declaration.
  28. no-var-keyword - Disallows usage of the var keyword.
  29. object-literal-shorthand - Enforces/disallows use of ES6 object literal shorthand.
  30. prefer-const - Requires that variable declarations use const instead of let and var if possible.
  31. prefer-switch - Prefer a switch statement to an if statement with simple === comparisons.
  32. radix - Requires the radix parameter to be specified when calling parseInt.
  33. restrict-plus-operands - When adding two variables, operands must both be of type number or of type string.
  34. triple-equals - Requires === and !== in place of == and !=.

Change return type of WithRXSelector

Currently WithRXSelector return Observable of partial props. This allows to track subscription when mounting/unmounting. But this subscription holds only input props and effects are not handled. Such effects are manually subscribed in selector which may lead to memory leaks and even more they are not unsubscribed (cancelled or stopped) on container unmount.

WithRXSelector return type should be changed to smth like this: type WithRXSelectorResult<P> = { input$: Observable<Partial<P>>, output$: Observable<void> }

Popovers with Scrollable inside are immediately closed when opened

Looks like recent updates to popover tracking on container scoll (with capturing) break popovers with scrollable inside.

  • popover is opened
  • scrollCapture handler is attached to container (window by default)
  • Scrollable is mounted and resize-detector is attached using ScrollStrategy which emits scroll event when installed
  • scroll event inside popover is captured by handler
  • popover is immediately closed

InfiniteLoader component

  • wait #44
  • should be a wrapper around controlled Scrollable
  • should detect resize of Scrollable content/scroll of Scrollable component
  • should accept threshold prop and call onRequest callback on initial mount and on resize/scroll

Migrate to eslint from tslint

  • use existing config for CRA applications (or just eslint-config-react-hooks)
  • replicate existing tslint config with eslint rules

DateInput should support custom date format

  • investigate if it's possible to handle different formats in a general way (via strategy)
  • if it's not possible (or too hard to implement), just support enum of two values: latin (MM/DD/YYYY) and russian (DD/MM/YYYY) formats

Update fp-ts to 1.18.*

I think we need update fp-ts to 1.18.* because new RemoteData use this version. If I upgrade RemoteData, in lock file be two version fp-ts and type check going out of memory.

Improve Numeric Stepper

For now.
Handler onValueChange in Numeric Stepper (NS) runs only 1) when buttons +/- click 2) input's onBlur

The problem.
I've got an issue when my NS gets value and handler from props. The component has changable data every second (doesn't matter, but fast). So if I try to change the value in input manually and do not have enough time it (value) resets to the last one from props. It works with buttons +/- because its click runs onValueChange handler.

Issue
Run onValueChange handler during manual input value change

tools: Reexport storybook modules

Recently we removed utils/sotrybook.ts and decided that we should use direct imports instead. But here is the thing: this package allows us not to have @storybook/* as a direct dependencies of our projects, just leaving dx-tools storybook as an interface to run storybook.

How correct is that in our projects to import stuff from @storybook/* packages when they are not listed in project dependencies?
From this perspective, having utils/storybook.ts with reexports makes sense to me.

Make lint/.prettierrc extendable in outside

Rename lint/.prettierrc to lint/.prettierrc.json for use it in side-projects.
For example:

side_project/.prettierrc.js:

const base = require('@devexperts/lint/.prettierrc');
const overrides = {
  "overrides": [
    {
      "files": ["*.js", "*.jsx"],
      "options": {
        "parser": "babylon"
      }
    }
  ]
};

module.exports = Object.assign(base, overrides);

react-kit: Deprecate getRenderRemoteData

i had a need to overwrite one of states of RenderRemoteData (RRD) that was passed within getRenderRemoteData (gRRD). but after a long offline discussion about PR expanding the model of RRD from cRRD ( #130 ) i realized, that i can use withDefaults (wD) instead of gRRD.
i believe we should use wD and deprecate gRRD

Make Scrollable component controlled

  • needed for granular control for components like InfiniteLoader (wrapper around Scrollable)
  • possibly provide uncontrolled version using stateful HOC

Add prettier to react-kit

Add prettier to react-kit package.
I suggest following .prettierrc (from one of our projects, may be discussed):

{
  "bracketSpacing": true,
  "jsxBracketSameLine": true,
  "parser": "typescript",
  "printWidth": 120,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 4,
  "trailingComma": "all",
  "useTabs": true
}

This task includes following steps in the root of the repo:

  1. npm i prettier
  2. adding .prettierrc to the root folder (content above)
  3. adding scripts npm run prettier and npm run prettier:fix to package.json
  4. run npm run prettier:fix . Please commit the result separately. Same branch, but separate commit. This will make review easier.

Migrate to `lower-dash-case` in file names across all packages

Lower case in path input/Input.tsx can cause build fail on CI(Teamcity for example) sometimes because it lets Windows to neglect mistaken font case and also it doesn't look like consistent naming of platform components.

  • check all packages
  • force casing with a tslint/eslint rule (depends on the package used)

react-kit: Props typings for native elements wrappers

there are a lot of components that just a wrapper around native elements like https://github.com/devex-web-frontend/dx-platform/blob/master/packages/react-kit/src/components/Button/Button.tsx. A lot of props are duplicated from native props of react elements. Is there any sense to duplicate it manualy instead of merging with JSX typings ?
for example with typings for Button component:

export type TFullButtonProps = JSX.IntrinsicElements['input'] & { ...customProps }

Replace WithRXSelector return type by dictionary of observables

Currently WithRXSelector should return an observable of partial props objects. This is messy and requires a ton of boilerplate around using toKeyValue each time.
WithRXSelector should now return an object of partial props where values are actual observables. WithRX in turn should traverse this dictionary and produce a single observable.

Migrate to CSS-in-JS

This is going to track an upcoming migration to a css-in-js solution. Which one is to be decided but I suggest styled-components because one of our teams has experience of using it in a production-running project.

Any thoughts?

/cc @sutarmin @igoralekseev @mankdev @dramoturg

UPD:

  • migrate to styled-components
  • migrate to lower-dash-case in file names #84

tools: Deprecating @devexperts/tools

This is an issue to discuss whether we need to keep maintaining @devexperts/tools package. As @raveclassic stated in other issue (comment link):

Furthermore I'd think about dropping tools at all. It's a useless layer of abstraction introduced for the sake of abstraction. Newcomers should not only learn nuances of npm/yarn build/start steps, how to use storybook, how to configure CRA, but also this package. Is there any good reason to force this abstraction with leaking details like storybook internals anyway?

My opinion is that(copying from the same issue):

  1. Webpack configs: another way we should copy them from project to project
  2. Easier maintainability of build dependencies: upgrade one time in tools instead of upgrading in every other project.
  3. A consistent approach with this abstraction across different projects makes moving developers from project to project easier.
  4. Scaffolding of new projects is easier as well.

But AFAIK all the recent projects was scaffolded without @devexperts/tools, but with just using CRA and that may be a good argument to stop maintaining tools if we have convenient approach there.

What is the approach with webpack config overloading and working with storybook in a recent projects, @raveclassic , @scink , @mankdev ? Is it just a manual copy-pasting of those custom build files?

@devex-web-frontend/team any opinions are appreciated.

Create README.md pages for packages

Now we have only root README.md so published on npm packages from this monorepo does not have any description. Some of the users of our packages want these packages to be documented. For start, it would be enough to create packages/*/README.md files with a brief explanation of the purposes of each package.

Performance: Consider removing default AnimationFrameScheduler in withRX2

Current implementation of withRX2 observers the source on animationFrame scheduler by default. This leads to a case when inactive tab is processing websocket messages delaying execution of the stream to the next animation frame. In its turn this leads to a freeze on tab activation because scheduler is trying to flush all buffered work.

We should discuss wether it's the responsibility of the end project to skip/buffer socket messages or withRX should be scheduler-agnostic and we should improve its API.

/cc @sutarmin @dramoturg

Feature: NumericStepper should support complex editing behavior for floats basing on the caret position

Not sure if it's outside of component's scope.
However let's clear some things with NS.
Consider following code to reproduce behaviour (a little bit modified NumericStepper.page.tsx example):

const dollarFormatter = (value: string | number) => `$${Number(value).toFixed(5)}`;
const dollarParser = (input: string) => {
	const newValue = Number(input.slice(1));
	return isNaN(newValue) ? 0 : newValue;
};

when entering value into NS input it's always set carete to an end.
2019-01-30_13h47_26

Seems like it's going to happen only if value has fixed amount of digits.

Is it bug or expected behaviour?

Selectbox component needs refactoring

I was trying to implement custom Selectbox with icons instead of text and faced a lot of design problems:

  1. The styling for the component is completely solid. You can't separate it into different css modules like it's implemented in other components (NumericStepper, for example). That leads us into the problem I faced: when you need to overload the Anchor, you need to use theme prop, that depends on theme you provide inside the Selectbox and create themable component.
  2. Selectbox's onValueChange handler accepts string | number | undefined type and I need to implement the function with the same signature and then cast/check types. Maybe, generics here could work better. For example, I could use string literals union type to represent my options, and I'm eager to work with this and only this set of values.
  3. The Anchor component accepts value prop as ReactText type. In my case I expect it to be just string or string literal, as soon as I'm overloading the Anchor component. So again, I need to cast types there, but it could also be generic like I mentioned above.

react-kit: DateInput. Fix mouse event callbacks signature

We have wrong types for the following DateInput props: onFocus, onBlur, onMouseEnter and onMouseLeave. Currently, their inferred type is (((event: React.MouseEvent<HTMLElement>) => void) & (() => void)) | undefined which doesn't allow us to pass a callback that requires MouseEvent (because of () => void part).

The reason is that this props declared twice: on the TFullInputProps (with correct signature) and on TDateInputOwnProps itself (wrong one). The solution here is to simply remove these props from TDateInputOwnProps and let them be inferred from TFullInputProps.

combineContext does not respect Sink's sink$

Current implementation of combineContext doesn't respect the Sink returned by project function so that we can't attach additional effects to the outer Context. This makes impossible to combine additional effects together with Context dependencies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.