Skip to content

Commit

Permalink
chore: configure lint libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Santiago committed Oct 12, 2021
1 parent c7aeacb commit 9a91c66
Show file tree
Hide file tree
Showing 13 changed files with 1,048 additions and 42 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
51 changes: 51 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint",
"react-hooks"
],
"rules": {
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react/jsx-filename-extension": [
"warn",
{
"extensions": [".tsx"]
}
],
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never"
}
],
"react/react-in-jsx-scope": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/prefer-default-export": "off"
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
32 changes: 21 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@fontsource/roboto": "^4.5.1",
"@material-ui/core": "^5.0.0-beta.5",
"@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
},
"scripts": {
Expand All @@ -22,12 +22,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand All @@ -39,5 +33,21 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.28",
"@types/react-dom": "^17.0.9",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"typescript": "^4.1.2"
}
}
10 changes: 5 additions & 5 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from "@testing-library/react";
import App from "./App";
import { render } from '@testing-library/react';
import App from './App';

test("renders app", () => {
const {container} = render(<App />);
test('renders app', () => {
const { container } = render(<App />);

expect(container.firstChild).toBeInTheDocument();
});
});
22 changes: 14 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const App = () => {
return (
<div>
<h1>Salve</h1>
</div>
)
}
import { MenuItem, Navigation } from 'components';

export default App
import '@fontsource/roboto/300.css';
import '@fontsource/roboto/400.css';
import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';

const App = (): JSX.Element => (
<div>
<Navigation />
<MenuItem />
</div>
);

export default App;
7 changes: 7 additions & 0 deletions src/components/MenuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

export const MenuItem = (): JSX.Element => (
<div>
MenuItem
</div>
);
5 changes: 5 additions & 0 deletions src/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const Navigation = (): JSX.Element => (
<div>
Navigation
</div>
);
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { MenuItem } from './MenuItem/MenuItem';
export { Navigation } from './Navigation/Navigation';
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
);

// If you want to start measuring performance in your app, pass a function
Expand Down
6 changes: 4 additions & 2 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ReportHandler } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
const reportWebVitals = (onPerfEntry?: ReportHandler): void => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
import('web-vitals').then(({
getCLS, getFID, getFCP, getLCP, getTTFB,
}) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"baseUrl": "src"
},
"include": [
"src"
Expand Down
Loading

0 comments on commit 9a91c66

Please sign in to comment.