Skip to content

Commit

Permalink
update rules lint
Browse files Browse the repository at this point in the history
  • Loading branch information
theandersonn committed Jul 10, 2022
1 parent 364de97 commit 470851d
Show file tree
Hide file tree
Showing 27 changed files with 169 additions and 170 deletions.
79 changes: 38 additions & 41 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
{
"env": {
"jest": true,
"browser": true,
"es2021": true
"env": {
"jest": true,
"browser": true,
"es2021": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"extends": [
"airbnb",
"prettier",
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"extends": [
"airbnb",
"prettier",
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"react-hooks"
],
"rules": {
"react/function-component-definition": 0,
"react/react-in-jsx-scope": "off",
"no-unused-vars": "warn",
"import/prefer-default-export": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }]
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"]
}
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "react-hooks"],
"rules": {
"react/function-component-definition": 0,
"react/react-in-jsx-scope": "off",
"no-unused-vars": "warn",
"import/prefer-default-export": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }]
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"]
}
}
}
}
7 changes: 4 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"trailingComma": "none",
"semi": false,
"singleQuote": true
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"endOfLine": "auto"
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ yarn start
yarn test
```

Made with 💜 by theandersonn
Made with 💜 by theandersonn
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"test:watch": "react-scripts test --watch",
"test:coverage": "react-scripts test --coverage --watchAll=false",
"eject": "react-scripts eject",
"lint": "eslint src --max-warnings=0"
"lint": "eslint ./src --ext .jsx,.js",
"prettier:fix": "prettier --write ."
},
"browserslist": {
"production": [
Expand Down
20 changes: 10 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ThemeProvider } from 'styled-components'
import GlobalStyles from 'styles/global'
import theme from 'styles/theme'
import { ThemeProvider } from 'styled-components';
import GlobalStyles from 'styles/global';
import theme from 'styles/theme';

import Main from 'components/Main'
import Header from 'components/Header'
import ScreenWrapper from 'components/ScreenWrapper'
import Footer from 'components/Footer'
import GithubCorner from 'react-github-corner'
import Main from 'components/Main';
import Header from 'components/Header';
import ScreenWrapper from 'components/ScreenWrapper';
import Footer from 'components/Footer';
import GithubCorner from 'react-github-corner';

const App = () => (
<ThemeProvider theme={theme}>
Expand All @@ -22,6 +22,6 @@ const App = () => (
/>
</Main>
</ThemeProvider>
)
);

export default App
export default App;
16 changes: 8 additions & 8 deletions src/components/Footer/__tests__/test.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { screen } from '@testing-library/react'
import { render } from 'utils/test-utils'
import { screen } from '@testing-library/react';
import { render } from 'utils/test-utils';

import Footer from '..'
import Footer from '..';

describe('<Footer />', () => {
it('should render correctly', () => {
const { container } = render(<Footer />)
const { container } = render(<Footer />);

expect(screen.getByRole('link', { name: /theandersonn/i })).toHaveAttribute(
'href',
'https://github.com/theandersonn'
)
);

expect(container.firstChild).toMatchSnapshot()
})
})
expect(container.firstChild).toMatchSnapshot();
});
});
10 changes: 5 additions & 5 deletions src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TiHeart as HeartIcon } from 'react-icons/ti'
import { TiHeart as HeartIcon } from 'react-icons/ti';

import * as S from './styles'
import * as S from './styles';

const Footer = () => {
return (
Expand All @@ -14,7 +14,7 @@ const Footer = () => {
theandersonn
</a>
</S.Wrapper>
)
}
);
};

export default Footer
export default Footer;
4 changes: 2 additions & 2 deletions src/components/Footer/styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css } from 'styled-components'
import styled, { css } from 'styled-components';

export const Wrapper = styled.footer`
${({ theme }) => css`
Expand All @@ -22,4 +22,4 @@ export const Wrapper = styled.footer`
}
}
`}
`
`;
16 changes: 8 additions & 8 deletions src/components/Header/__tests__/test.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { screen } from '@testing-library/react'
import { render } from 'utils/test-utils'
import { screen } from '@testing-library/react';
import { render } from 'utils/test-utils';

import Header from '..'
import Header from '..';

describe('<Header />', () => {
it('should render correctly and have title', () => {
const { container } = render(<Header />)
const { container } = render(<Header />);

expect(
screen.getByRole('heading', { name: /what is my screen resolution\?/i })
).toBeInTheDocument()
).toBeInTheDocument();

expect(container.firstChild).toMatchInlineSnapshot(`
<header
Expand All @@ -19,6 +19,6 @@ describe('<Header />', () => {
What Is My Screen Resolution?
</h1>
</header>
`)
})
})
`);
});
});
8 changes: 4 additions & 4 deletions src/components/Header/index.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as S from './styles'
import * as S from './styles';

const Header = () => {
return (
<S.Wrapper>
<h1>What Is My Screen Resolution?</h1>
</S.Wrapper>
)
}
);
};

export default Header
export default Header;
6 changes: 3 additions & 3 deletions src/components/Header/styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css } from 'styled-components'
import media from 'styled-media-query'
import styled, { css } from 'styled-components';
import media from 'styled-media-query';

export const Wrapper = styled.header`
${({ theme }) => css`
Expand All @@ -18,4 +18,4 @@ export const Wrapper = styled.header`
font-size: ${theme.font.sizes.xxlarge};
`}
`}
`
`;
12 changes: 6 additions & 6 deletions src/components/Main/__tests__/test.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { render } from 'utils/test-utils'
import { render } from 'utils/test-utils';

import Main from '..'
import Main from '..';

describe('<Main />', () => {
it('should render correctly', () => {
const { container } = render(<Main>Children</Main>)
const { container } = render(<Main>Children</Main>);

expect(container.firstChild).toMatchInlineSnapshot(`
<main
class="sc-bczRLJ iRpuYl"
>
Children
</main>
`)
})
})
`);
});
});
14 changes: 7 additions & 7 deletions src/components/Main/index.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import PropTypes from 'prop-types'
import PropTypes from 'prop-types';

import * as S from './styles'
import * as S from './styles';

const Main = ({ children }) => {
return <S.Wrapper>{children}</S.Wrapper>
}
return <S.Wrapper>{children}</S.Wrapper>;
};

Main.propTypes = {
children: PropTypes.node.isRequired
}
children: PropTypes.node.isRequired,
};

export default Main
export default Main;
4 changes: 2 additions & 2 deletions src/components/Main/styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css } from 'styled-components'
import styled, { css } from 'styled-components';

export const Wrapper = styled.main`
${({ theme }) => css`
Expand All @@ -12,4 +12,4 @@ export const Wrapper = styled.main`
height: 100vh;
background-color: ${theme.colors.primary};
`}
`
`;
8 changes: 4 additions & 4 deletions src/components/ScreenResolution/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as S from './styles'
import * as S from './styles';

const ScreenResolution = () => {
return (
Expand All @@ -13,7 +13,7 @@ const ScreenResolution = () => {
</p>
</S.Description>
</S.Wrapper>
)
}
);
};

export default ScreenResolution
export default ScreenResolution;
10 changes: 5 additions & 5 deletions src/components/ScreenResolution/styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css } from 'styled-components'
import media from 'styled-media-query'
import styled, { css } from 'styled-components';
import media from 'styled-media-query';

export const Wrapper = styled.article`
${({ theme }) => css`
Expand All @@ -14,7 +14,7 @@ export const Wrapper = styled.article`
margin-top: ${theme.spacings.xxsmall};
}
`}
`
`;

export const Title = styled.h2`
${({ theme }) => css`
Expand All @@ -23,7 +23,7 @@ export const Title = styled.h2`
border-bottom: 0.1rem solid ${theme.colors.white};
padding: ${theme.spacings.xxsmall} ${theme.spacings.xsmall};
`}
`
`;

export const Description = styled.div`
${({ theme }) => css`
Expand All @@ -37,4 +37,4 @@ export const Description = styled.div`
color: ${theme.colors.secondary};
}
`}
`
`;
Loading

0 comments on commit 470851d

Please sign in to comment.