-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated ESLint version & rules, then fix code across project, and fixed #212 #213
Conversation
The reason is that starting from version 1.0 of ESLint, all linting rules are turned off by default.
- already tested via `npm run test` and all tests passed. - most of code fixed across the project are about semi colon, space after if/else if/else/for statement, removed newline at the end of file, a few dangerous code statement fixed, and a few that is not needed. - ESlint is updated to version 3.17.1. The project has used version 1.x.x. This should be better. - ESLint's rules are updated to be more stricted but not too strict. See it in .eslintrc.
src/components/grid/grid.js
Outdated
@@ -2,6 +2,7 @@ import React from 'react'; | |||
import classNames from 'classnames'; | |||
import GridIcon from './grid_icon'; | |||
import GridLabel from './grid_label'; | |||
import { Link } from 'react-router'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haxpor Thanks for the PR and work to the lint!
I believe to use Link in this case will require dependency from react-router and not everyone use react-router as router even though most of the single page application do.
Can you modify it to something like Cell that people will be able to pass into their component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! That's much more robust.
I've fixed it to provide component
property to be set in Grid as similar to Cell
class.
- provided 'component' property to be able to replace component instead of using react-router, more flexible example of setting from Grid's data from code to use react-router url is as follows const data = [ { icon: <img src="./image.png" alt="image icon"/>, label: 'Label', component: function(props) { const { children, ...others } = props; return <Link to="/router-url" {...others}> { children } </Link>; } }, ]
Updated ESLint version. and its rules and fixed warnings/errors across project. Also with fixing of #212
npm run test
and all tests passed.after if/else if/else/for statement, removed newline at the end of file, a few dangerous code statement fixed, and a few that is not needed.
3.17.1
. The project has used version1.x.x
. This should be better.it in .eslintrc.
react-router
#212Fixed #212
Tested, It works fine and can provide normal
<a>
functionality to link to normal URL, orreact-router
's URL.We can use the following code in
Grid
's Data.The first two items are for
react-router
's URL, and the third one is for normal URL. When click, it takes to destination properly.Anyway, the code seems easy and straightforward but not sure it should be the approach use or not as it directly use
react-router
's<Link>
and I checkedreact-weui
already depends on it although older version.