layershifter / babel-plugin-transform-react-handled-props Goto Github PK
View Code? Open in Web Editor NEWGenerates handledProps from defaultProps and propTypes during the build :sparkles:
License: MIT License
Generates handledProps from defaultProps and propTypes during the build :sparkles:
License: MIT License
ModuleParseError: Module parse failed: Unexpected token (102:4)
You may need an appropriate loader to handle this file type.
| };
| }
> 2657:3258.handledProps = [];
Has anyone encountered this issue?
Setup: React 16.4, Webpack 4, Babel 7 (more details coming)
Branch | Build failing ๐จ |
---|---|
Dependency | eslint-config-airbnb-base |
Current Version | 12.0.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint-config-airbnb-base is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
Branch | Build failing ๐จ |
---|---|
Dependency | eslint |
Current Version | 4.14.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
ignoreComments
option to indent
rule (fixes #9018) (#9752) (Kevin Partington)The new version differs by 14 commits.
e14ceb0
4.15.0
2dfc3bd
Build: changelog update for 4.15.0
6ab04b5
New: Add context.report({ messageId }) (fixes #6740) (#9165)
fc7f404
Docs: add url to each of the rules (refs #6582) (#9788)
fc44da9
Docs: fix sort-imports rule block language (#9805)
65f0176
New: CLIEngine#getRules() (refs #6582) (#9782)
c64195f
Update: More detailed assert message for rule-tester (#9769)
9fcfabf
Fix: no-extra-parens false positive (fixes: #9755) (#9795)
61e5fa0
Docs: Add table of contents to Node.js API docs (#9785)
4c87f42
Fix: incorrect error messages of no-unused-vars (fixes #9774) (#9791)
bbabf34
Update: add ignoreComments
option to indent
rule (fixes #9018) (#9752)
db431cb
Docs: HTTP -> HTTPS (fixes #9768) (#9768)
cbf0fb9
Docs: describe how to feature-detect scopeManager/visitorKeys support (#9764)
f7dcb70
Docs: Add note about "patch release pending" label to maintainer guide (#9763)
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
Branch | Build failing ๐จ |
---|---|
Dependency | mocha |
Current Version | 3.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As mocha is โonlyโ a devDependency of this project it might not break production or downstream projects, but โonlyโ your build or test tools โ preventing new deploys or publishes.
I recommend you give this issue a high priority. Iโm sure you can resolve this ๐ช
Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.
This week's highlights:
allowUncaught
added to commandline as --allow-uncaught
(and bugfixed)--no-warnings
and --trace-warnings
flags (@sonicdoe)The new version differs by 9 commits0.
7554b31
Add Changelog for v3.4.0
9f7f7ed
Add --trace-warnings
flag
92561c8
Add --no-warnings
flag
ceee976
lint test/integration/fixtures/simple-reporter.js
dcfc094
Revert "use semistandard
directly"
93392dd
no special case for macOS running Karma locally
4d1d91d
--allow-uncaught cli option
fb1e083
fix allowUncaught in browser
4ed3fc5
Add license report and scan status
false
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot ๐ด
handledProps
aren't defined formally in the README, and their usage + context are not fully articulatedi filed 1601 in hopes to better understand how RSUI wires all of this up. my understanding has progressed only as far to know that this transform adds a static-ish exports to a component which can be used somehow at runtime to aide in the propagation of props down the component tree.
anyway, this isn't critical or anything, I just thought that I'd share as an interested user that the README didn't get me fully there!
โ๏ธ Greenkeeperโs updated Terms of Service will come into effect on April 6th, 2018.
Branch | Build failing ๐จ |
---|---|
Dependency | babel-eslint |
Current Version | 8.2.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
babel-eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 3 commits.
aaeb46b
8.2.3
afc3c87
lock to beta.44
92202be
Save babel beta packages as exact versions (#606) [skip ci]
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
Branch | Build failing ๐จ |
---|---|
Dependency | eslint |
Current Version | 4.13.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
complexity
rule (fixes #8535) (#9754) (Kevin Partington)valid-typeof
example (#9753) (Teddy Katz)source
property a little more subtle (#9735) (Jed Fox)lines-between-class-members
(fixes #9665) (#9680) (sakabar)The new version differs by 19 commits.
8d166b4
4.14.0
5a29612
Build: changelog update for 4.14.0
be2f57e
Update: support separate requires in one-var. (fixes #6175) (#9441)
370d614
Docs: Fix typos (#9751)
8196c45
Chore: Reorganize CLI options and associated docs (#9758)
75c7419
Update: Logical-and is counted in complexity
rule (fixes #8535) (#9754)
eb4b1e0
Docs: reintroduce misspelling in valid-typeof
example (#9753)
ae51eb2
New: Add allowImplicit option to array-callback-return (fixes #8539) (#9344)
e9d5dfd
Docs: improve no-extra-parens formatting (#9747)
37d066c
Chore: Add unit tests for overrides glob matching. (#9744)
805a94e
Chore: Fix typo in CLIEngine test name (#9741)
1c2aafd
Update: Improve parser integrations (fixes #8392) (#8755)
4ddc131
Upgrade: debug@^3.1.0 (#9731)
f252c19
Docs: Make the lint message source
property a little more subtle (#9735)
5a5c23c
Docs: fix the link to contributing page (#9727)
There are 19 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
8.3.1
to 8.4.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
release-it is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 3 commits.
56ee11f
Release 8.4.0
3abbc73
Try to coerce provided increment into valid semver version
ab4c1e7
Fall back to "0.0.0" if no latest version is found
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
12.4.3
to 12.5.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
release-it is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
npm.tag
if provided when resolving tag (fixes #586) (39dcc22)npm.publishPath
(90531ab)/conf
directory (#587) (b90831a)The new version differs by 34 commits.
12c73b4
Release 12.5.0
39dcc22
Always use npm.tag
if provided when resolving tag (fixes #586)
0e62393
Fix prerelease continuation type in interactive mode (fixes #588)
90531ab
Add docs about npm.publishPath
4949a8a
Update dependencies
a11f992
Update/migrate to latest semver
5ad3e18
Update/migrate to latest @octokit/rest
cec2829
Fix links to documentation (#599)
b90831a
Move both auto-changelog recipes to the /conf
directory (#587)
da075e6
Release 12.5.0-next.3
8cc81f1
Simplify/fix debug logic in metrics (related to #574)
f818699
Fix toml example
fd67e6c
Add auto-changelog template file to be used directly from the repository (#583)
47548b5
Release 12.5.0-next.2
923a56c
Authenticate and verify as collaborator with GitLab on init
There are 34 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
Wrapping a function component with React.forwardRef
or React.memo
causes it to get ignored.
Example:
const Button = React.forwardRef((props, ref) => {
const rest = // get rest of props not handled
return (<button ref={ref} {...rest}>{props.label}</button>);
});
Button.propTypes = {
label: PropTypes.string,
};
export default Button;
Can also be chained, e.g React.memo(React.forwardRef(() => ...))
โ๏ธ Greenkeeperโs updated Terms of Service will come into effect on April 6th, 2018.
Branch | Build failing ๐จ |
---|---|
Dependency | prettier |
Current Version | 1.11.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
in
type Props = {
disabled?: boolean
}
class Demo extends React.Component<Props>{
...
}
out
Demo.handledProps = [];
I this issue I wan't collect and structure all ideas and enhancements for major release of plugin, make plan for them and implement them step-by-step.
I'm thinked about properties
option to plugin that will allow to define properties for collecting props.
{
"plugins": [
["transform-react-handled-props", {"properties": ["hiddenProps"]}]
]
}
In:
const Example = () => <div />
Example.hiddenProps = ['children']
Example.propTypes = {
className: propTypes.string
}
Out:
const Example = () => <div />
Example.handledProps = ['children', 'className']
Example.hiddenProps = ['children']
Example.propTypes = {
className: propTypes.string
}
It may be usefull for cases like SUIR's AutoControlledComponent
.
#TODO
The plugin performs the following steps to make changes:
handledProps
.It's pretty simple step and I think, that we don't need modify it at all. I think we should stick to the theorem that if there is no import, the file doesn't contain anything related to React components.
I tried using this plugin in my project but got the following error when compiling higher-order components:
We don't know what to do with this node type. We were previously a Statement but we can't fit in here?
at NodePath.insertAfter (~/babel-traverse/lib/path/modification.js:175:13)
at insertAfterPath (~/node_modules/babel-plugin-transform-react-handled-props/lib/util/appendProps.js:50:27)
at ~/node_modules/babel-plugin-transform-react-handled-props/lib/util/appendProps.js:59:5
Here is a snippet reproducing the problem:
import React from 'react';
export default function WithSauce(options = {}) {
return function createContainer(Component) {
return class Sauce extends React.Component {
render() {
return (
<Component className="sauced" />
);
}
};
};
}
I tried changing my syntax a bit and got a different problem (possibly unrelated)
export default (options) => (Component) => class WithSauce extends React.Component { [...] }
Transpiled to:
module.exports = function (options) {
return function (Component) {
return function WithSauce() { [...] }
}
}
WithSauce.handledProps = []; // Error: WithSauce is not defined.
Let me know if there is anything else I can help with to identify the root cause.
devDependency
@babel/cli was updated from 7.2.0
to 7.2.3
.devDependency
@babel/core was updated from 7.2.0
to 7.2.2
.devDependency
@babel/plugin-proposal-class-properties was updated from 7.2.3
to 7.3.0
.devDependency
@babel/plugin-proposal-object-rest-spread was updated from 7.2.0
to 7.3.0
.devDependency
@babel/preset-env was updated from 7.2.3
to 7.3.0
.dependency
@babel/types was updated from 7.2.2
to 7.3.0
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.
babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
10.0.8
to 10.0.9
.๐จ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
release-it is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
โ๏ธ Greenkeeperโs updated Terms of Service will come into effect on April 6th, 2018.
Branch | Build failing ๐จ |
---|---|
Dependency | mocha |
Current Version | 5.0.5 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 23 commits ahead by 23, behind by 2.
40d9ea3
Release v5.1.0
bf34e42
update CHANGELOG for v5.1.0 [ci skip]
63462dd
Implement API documentation using npm:documantation.
741b0bd
fix circular objects in json reporter; closes #2433 (#3318)
8010501
fix wrong version in package.json! [ci skip]
94e7289
doc precision for exclusive tests
8b6c957
optimize package-scripts.js
d71b80a
PATH workaround for Travis CI bug
7544bd3
further build improvements (#3315)
88b9882
update package-lock.json for v5.0.5 [ci skip]
4ae26b2
improve caching performance in CI (#3310)
ff9f3cf
update stages and build matrices (#3308)
f2560e7
add update-contributors script; closes #3289 (#3290)
cd1c835
upgrade eslint; lint
35dac3e
use build stages for Travis CI (#3302)
There are 23 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donโt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot ๐ด
in
import PropTypes from 'prop-types';
import React from 'react';
const propTypes={
children: PropTypes.node,
className: PropTypes.string
}
function Example() {
return <div />;
}
Example.propTypes = propTypes;
export default Example;
out
import PropTypes from 'prop-types';
import React from 'react';
const propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
function Example() {
return <div />;
}
Example.handledProps = [];
Example.propTypes = propTypes;
export default Example;
Hi,
I believe this plugin should support using spread operators in the propTypes
object.
There is a test fixture for this case: https://github.com/layershifter/babel-plugin-transform-react-handled-props/tree/master/test/fixtures/spread
But the expected result seem wrong to me. I believe handledProps
should include the active
prop meaning:
Example.handledProps = ["children", "className"
, "active"]`
Thank you,
Patrick
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.