Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
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
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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.