1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

lint fixes & package updates

This commit is contained in:
Matthias Kretschmann 2019-02-07 11:28:04 +01:00
parent 7d4261cec1
commit 9bdcf8fb6b
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 2032 additions and 5010 deletions

View File

@ -6,10 +6,11 @@
"extends": [ "extends": [
"oceanprotocol", "oceanprotocol",
"oceanprotocol/react", "oceanprotocol/react",
"plugin:prettier/recommended",
"prettier/react", "prettier/react",
"prettier/standard", "prettier/standard",
"plugin:@typescript-eslint/recommended" "plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
], ],
"plugins": ["@typescript-eslint", "prettier"], "plugins": ["@typescript-eslint", "prettier"],
"rules": { "rules": {
@ -20,6 +21,8 @@
] ]
}, },
"env": { "env": {
"es6": true,
"browser": true,
"jest": true "jest": true
} }
} }

View File

@ -49,7 +49,7 @@ See the section about [running tests](https://facebook.github.io/create-react-ap
For linting and auto-formatting you can use: For linting and auto-formatting you can use:
```bash ```bash
# auto format all ts & css with tslint & stylelint # auto format all ts & css with eslint & stylelint
npm run lint npm run lint
# auto format all ts & css with prettier, taking all configs into account # auto format all ts & css with prettier, taking all configs into account

6971
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,41 +15,38 @@
"lint": "npm run lint:js && npm run lint:css" "lint": "npm run lint:js && npm run lint:css"
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/squid": "^0.2.7", "@oceanprotocol/squid": "^0.2.8",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"query-string": "^6.2.0", "query-string": "^6.2.0",
"react": "^16.7.0", "react": "^16.8.1",
"react-dom": "^16.7.0", "react-dom": "^16.8.1",
"react-router-dom": "^4.3.1", "react-router-dom": "^4.3.1",
"web3": "^1.0.0-beta.37" "web3": "^1.0.0-beta.43"
}, },
"devDependencies": { "devDependencies": {
"@types/classnames": "^2.2.7", "@types/classnames": "^2.2.7",
"@types/jest": "23.3.13", "@types/jest": "^24.0.0",
"@types/node": "10.12.19", "@types/node": "^10.12.21",
"@types/query-string": "^6.2.0", "@types/query-string": "^6.2.0",
"@types/react": "16.7.22", "@types/react": "^16.8.2",
"@types/react-dom": "16.0.11", "@types/react-dom": "^16.8.0",
"@types/react-router-dom": "^4.3.1", "@types/react-router-dom": "^4.3.1",
"@types/web3": "^1.0.18", "@types/web3": "^1.0.18",
"@typescript-eslint/eslint-plugin": "^1.2.0", "@typescript-eslint/eslint-plugin": "^1.2.0",
"@typescript-eslint/parser": "^1.2.0", "@typescript-eslint/parser": "^1.2.0",
"eslint-config-oceanprotocol": "^1.3.0", "eslint-config-oceanprotocol": "^1.3.0",
"eslint-config-prettier": "^3.3.0", "eslint-config-prettier": "^4.0.0",
"eslint-plugin-prettier": "^3.0.0", "eslint-plugin-prettier": "^3.0.1",
"node-sass": "^4.11.0", "node-sass": "^4.11.0",
"prettier": "^1.16.2", "prettier": "^1.16.4",
"prettier-stylelint": "^0.4.2", "prettier-stylelint": "^0.4.2",
"react-scripts": "2.1.3", "react-scripts": "^2.1.3",
"stylelint": "^9.10.1", "stylelint": "^9.10.1",
"stylelint-config-bigchaindb": "^1.2.1", "stylelint-config-bigchaindb": "^1.2.1",
"stylelint-config-css-modules": "^1.3.0", "stylelint-config-css-modules": "^1.3.0",
"stylelint-config-standard": "^18.2.0", "stylelint-config-standard": "^18.2.0",
"typescript": "3.2.4" "typescript": "3.2.4"
}, },
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [ "browserslist": [
">0.2%", ">0.2%",
"not dead", "not dead",

View File

@ -12,7 +12,7 @@ import Styleguide from './pages/Styleguide'
const Routes = () => ( const Routes = () => (
<Router> <Router>
<Switch> <Switch>
<Route exact={true} component={Home} path="/" /> <Route exact component={Home} path="/" />
<Route component={Styleguide} path="/styleguide" /> <Route component={Styleguide} path="/styleguide" />
<Route component={About} path="/about" /> <Route component={About} path="/about" />
<Route component={Publish} path="/publish" /> <Route component={Publish} path="/publish" />

View File

@ -7,7 +7,7 @@ it('Button renders without crashing', () => {
ReactDOM.render( ReactDOM.render(
<> <>
<Button>I am a button</Button> <Button>I am a button</Button>
<Button primary={true}>I am a primary button</Button> <Button primary>I am a primary button</Button>
<Button href="https://hello.com">I am a button</Button> <Button href="https://hello.com">I am a button</Button>
</>, </>,
div div

View File

@ -6,12 +6,12 @@ import styles from './Input.module.scss'
import Label from './Label' import Label from './Label'
import Row from './Row' import Row from './Row'
interface IOptionProps { interface OptionProps {
value: string value: string
label: string label: string
} }
interface IInputProps { interface InputProps {
name: string name: string
label: string label: string
placeholder?: string placeholder?: string
@ -20,11 +20,11 @@ interface IInputProps {
tag?: string tag?: string
type?: string type?: string
small?: boolean small?: boolean
options?: IOptionProps[] options?: OptionProps[]
additionalComponent?: void additionalComponent?: void
} }
interface IInputState { interface InputState {
isFocused: boolean isFocused: boolean
} }
@ -38,8 +38,8 @@ const Tag = ({ ...props }) => {
} }
} }
export default class Input extends PureComponent<IInputProps, IInputState> { export default class Input extends PureComponent<InputProps, InputState> {
public state: IInputState = { isFocused: false } public state: InputState = { isFocused: false }
public inputWrapClasses() { public inputWrapClasses() {
if (this.props.type === 'search') { if (this.props.type === 'search') {
@ -64,7 +64,6 @@ export default class Input extends PureComponent<IInputProps, IInputState> {
required, required,
type, type,
help, help,
small,
tag, tag,
additionalComponent, additionalComponent,
children, children,
@ -80,7 +79,6 @@ export default class Input extends PureComponent<IInputProps, IInputState> {
{type === 'radio' || type === 'checkbox' ? ( {type === 'radio' || type === 'checkbox' ? (
<div className={styles.radioGroup}> <div className={styles.radioGroup}>
{/* tslint:disable-next-line:jsx-no-multiline-js */}
{options && {options &&
options.map((option, index) => ( options.map((option, index) => (
<div className={styles.radioWrap} key={index}> <div className={styles.radioWrap} key={index}>
@ -111,7 +109,6 @@ export default class Input extends PureComponent<IInputProps, IInputState> {
onFocus={this.toggleFocus} onFocus={this.toggleFocus}
onBlur={this.toggleFocus} onBlur={this.toggleFocus}
> >
{/* tslint:disable-next-line:jsx-no-multiline-js */}
{tag === 'select' {tag === 'select'
? options && ? options &&
options.map((option, index) => ( options.map((option, index) => (

View File

@ -213,7 +213,7 @@ class Publish extends Component<{}, PublishState> {
/> />
</div> </div>
<User.Consumer> <User.Consumer>
{(states /* tslint:disable-next-line */) => ( {states => (
<div> <div>
{states.isLogged ? ( {states.isLogged ? (
<div> <div>

View File

@ -27,7 +27,7 @@ class Styleguide extends Component {
<h1>Styleguide</h1> <h1>Styleguide</h1>
<Button>I am a button</Button> <Button>I am a button</Button>
<Button primary={true}>I am a primary button</Button> <Button primary>I am a primary button</Button>
<Button href="https://hello.com"> <Button href="https://hello.com">
I am a link disguised as a button I am a link disguised as a button
</Button> </Button>

View File

@ -1,12 +0,0 @@
{
"defaultSeverity": "error",
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"object-literal-sort-keys": false,
"semicolon": [true, "never"]
},
"linterOptions": {
"exclude": ["node_modules/**/*.{ts,tsx}"]
}
}