stylesuxx / generator-react-webpack-redux

React Webpack Generator including Redux support
Other
552 stars 85 forks source link

linting errors on fresh install #63

Closed keithriver closed 7 years ago

keithriver commented 7 years ago

First two are related to file extensions: allowing jsx in .js files and dropping the extensions in imports. Solved by adding those two rules to .eslintrc

    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "import/extensions": 0,

Second issue is in ./src/containers/App.js:

//Prop type `object` is forbiddenat line 28 col 3
//Absolute imports should come before relative imports.at line 12 col 36
//Absolute imports should come before relative imports.at line 13 col 25

import {} from '../actions/';
import { bindActionCreators } from 'redux'; //line 12
import { connect } from 'react-redux';

App.propTypes = {
  actions: PropTypes.object.isRequired // line 28
};

Absolute imports are solved by moving them before importing from relative '../actions' path.

But propTypes seems to be related to this issue (i guess it's something new to the specs?): How can I handle react-router and redux with react/forbid-prop-types? #904

I'm a bit new to react, so i'm not sure, if actions: PropTypes.shape pattern would be appropriate or not in this case.

I know it's just a default template and creating new components seems to work fine (though for me it also failed to add react-css-modules as a dependency on install, was actually surprised that linter noticed that) and i'm free to do whatever with them, but it's a bit confusing to see linting tests fail on an empty project.

stylesuxx commented 7 years ago

Hey @keithriver, you are of course right, linter should not fail an a fresh project. I adjusted the rules and fixed the import order.

I will need to look into the forbidden prop type, technically I could leave that empty initially and populate it once when actions are added.

Thank you for pointing this out.

Regarding the css modules problem - this is related to the base generator, this should be fixed there, need to check what I have missed on my side.

stylesuxx commented 7 years ago

Actions prop is now a shape too. Reducers are now per default a shape too when added.

stylesuxx commented 7 years ago

Fixed in 1.1.0 - closing down here. Feel free to re-open if problem persists.