mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 07:28:01 -05:00
4.4 KiB
4.4 KiB
Development Rules
- Put Imports at top
- Put Exports at bottom
- File / Folder structure
- Lean towards using more many files / folder vs larger files
- Nest folders inside larger ideas
- Each folder should generally have an
**/index.tsto export most everything for the folder- Exception:
./src/windowfolder. Must call methods directly.
- Exception:
- Any
window.***calls are done in./src/windowfolder only.- Add exported values / function if necessary.
- This helps keep each file self contained. Trying not to have random inputs from anywhere
- jQuery
- Always import
./src/jqueryinstead of"jquery"- Exeption: Test files. There, you can import
"jquery"directly as the browser is not available to already have jQuery loaded.
- Exeption: Test files. There, you can import
- Prevents from installing local jquery in addition to global jquery
- WAY to many packages exist on the assumption that jquery is available at run time. Therefore, it can not be removed globally. :-(
- Always import
- Anything that needs to be initialized on start must exist in the
./src/initializefolder.- No file should produce any side effects.
- To capture initializations, export a
setFoo(foo_)method that updates a locally definedfoovariable.
TODO
- √ Move everything into a single ts file. This will allow for the functions to find themselves
- √ Except the utils.js already converted
- √ es6 shiny.js
- √ Pass in version using esbuild
- √ Move all shiny files in order to main.ts
- √ validate polyfills are working by finding them in the code
- √ Produce minified shiny js
- √ Disable $ from being found without an import
- √ Using a patch with yarn v2
- √ Document
./package.jsonscripts - √ Verify that
babelis configurable- √ Use targeting browsers
- √ Verify it works on phantomjs / shinytest
- √ Set up initial jest tests
- √ Use a global shim to avoid importing jquery directly, but make testing easy to test
- Update the /tools/update*.R scripts to produce a version and install node dependencies
- √ jquery
- √ ion range slider
- √ selectize
- √ strftime
- √ bootstrap date picker
- font awesome?
- bootstrap accessibility plugin?
Round #2
- Convert registered bindings
- √ Input bindings
- √ Output bindings
- Add default value to
subscribe(callback)callback function offalse. B/c if the value was not provided, it was not truthy, therefore equivalent tofalse.- √ radio
- √ checkboxgroup
- √ daterange
- √ actionbutton
- √ bootstraptabinput
- √ snake_case to camelCase conversions.
- √ globally import strftime from
window.strftime - Remove
evtfrom jQuery.on callbacks whereevtwas not used.- √ checkbox.subscribe
- √ checkboxgroup.subscribe
- √ radio.subscribe
- √ slider.subscribe
- √ date.subscribe
- √ selectInput.subscribe
- √ actionButton.subscribe
- √ bootstraptabinput.subscribe
- Convert usage of
+xtoNumber(x)- https://stackoverflow.com/a/15872631/591574
- √ slider.getValue()
- √ number.getValue()
- √ Adjust tabinput.ts
setValue()to return eitherfalse | void, notfalse | true.- What matters is that
falseis returned, or nothing is returned. Replacedreturn true;withreturn;
- What matters is that
- Questions
- Why does
receiveMessage(data)sometimes have alabel? - Should we have a update datatables script?
- Why does
Later TODO
-
Use --strictNullChecks in tsconfig.json
-
Make
_*()methodsprivate *() -
√ Each file will be pulled out as possible into smaller files in separate PRs
-
√ Convert
FileProcessorto a true class definition -
Break up
./utilsinto many files- √ Remove any
: anytypes
- √ Remove any
-
√ Make
@typescript-eslint/explicit-module-boundary-typesan error -
√ Fix all
// eslint-disable-next-line no-prototype-builtinslines -
TypeScript other shiny files (ex: showcasemode)
-
√ Completely remove
parcelfrom./package.jsonand only useesbuild -
√ Delete 'shiny-es5' files
-
Delete 'old' folder
-
Uglify js files (like in previous Gruntfile.js)
- datepicker
- ionrangeslider
- selectize
Eventual TODO
- Use yarn PnP
- See
./patch/yarn_pnp.patch - Use esbuild
- Known problems:
@yarnpkg/esbuild-plugin-pnp@0.0.1gives full file paths, not relative file paths@testing-library/jest-dom/extend-expectcan not be found.
- See