Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
eslint-config-ooo
Advanced tools
Unified Code Style config based on Airbnb's JavaScript Code Style for OOO JavaScript-based application.
// .eslintrc.js
module.exports = {
extends: ['ooo'],
};
// @flow
import { ApolloClient } from 'apollo-client';
import { createHttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import type { MyType } from '../types';
import Config from './Config';
import { someUtility } from '../utils';
// @flow
import React, { Component } from 'react';
import { withApollo } from 'react-apollo';
import { Col, Row } from 'react-grid-system';
import MyDialog from '../MyDialog';
import MyFloatInput from '../MyFloatInput';
import * as Styled from './styledComponents';
import type { MyType } from '../../types.js';
import ImageLogo from '../../../assets/my-logo';
import { Normalizer } from '../../utils';
Styled
// styledComponents.js
export const MyDiv = styled.div`
color: 'red';
`;
export const MySpan = styled.span`
color: 'black';
`;
// index.jsx - use in Component
// ... other imports
import * as Styled from './styledComponents';
// usage
<Styled.MyDiv>Yay!</Styled.MyDiv>
- located in folder `__test__`
- `{fileNameWhichWeAreTesting}.test.js(x)`
- Use `test` for Test cases implementation
someFolder/
MyComponent/
index.jsx
graphql.js
styledComponents.js
__test__/
index.test.jsx
// test example
describe('<MyComponent />', () => {
test('Renders successfully', () => {
// ...
)
})
async
/ await
in try catch
construct to handle asynchronous operationsrender()
method, you can define it outside.jsx
extension on files which contains JSX syntax.jsx
:(const example = ’example’;
Prettier
// @flow
import React, { Component } from 'react';
import { withApollo } from 'react-apollo';
import { Col, Row } from 'react-grid-system';
import MyDialog from '../MyDialog';
import MyFloatInput from '../MyFloatInput';
import * as Styled from './styledComponents';
import type { MyType } from '../../types.js';
import ImageLogo from '../../../assets/my-logo';
import { Normalizer } from '../../utils';
type Props = {
someNiceText: string,
someNestedStructure: MyType,
};
type State = {
isOpen: boolean,
};
// sometimes we need to export not-connected component (for tests, ...)
export class ExampleComponent extends Component<Props, State> {
static defaultProps = {
someNiceText: 'Das ist sauberer Code!',
someNestedStructure: {},
};
state = {
isOpen: false;
};
toggleDialog = () =>
this.setState(state => ({ isOpen: !state.isOpen }));
render() {
const { someNiceText, someNestedStructure } = this.props;
const { isOpen } = this.state;
return (
<Styled.Container>
<Styled.Logo imgSrc={ImageLogo} />
{isOpen && <MyDialog toggle={this.toggleDialog} />}
<Styled.Something>
{someNiceText}
</Styled.Something>
{someNestedStructure.text}
<Row>
<Col xs={6}>My float input:</Col>
<Col xs={6}>
<MyFloatInput
fullWidth
normalize={Normalizer.normalizeFloat}
/>
</Col xs>
</Row>
</Styled.Container>
);
}
}
// export connected component
export default withApollo(ExampleComponent);
FAQs
ESLint configuration for OOO JavaScript-based applications
The npm package eslint-config-ooo receives a total of 4 weekly downloads. As such, eslint-config-ooo popularity was classified as not popular.
We found that eslint-config-ooo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.