Skip to content

Commit

Permalink
Add more lint rules. Fix lint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouder committed Aug 6, 2024
1 parent 3f4614a commit 36d600c
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 23 deletions.
22 changes: 20 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pluginJs from '@eslint/js';
import stylisticTs from '@stylistic/eslint-plugin-ts';
import reactPlugin from 'eslint-plugin-react';
import tseslint from 'typescript-eslint';

Expand All @@ -17,15 +18,32 @@ export default [
},
},
},
plugins: {
'@stylistic/ts': stylisticTs,
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
{
rules: {
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
// Base Warnings
'no-console': 'warn',

// Stylistic Issues
'@stylistic/ts/quotes': ['error', 'single'],
'@stylistic/ts/indent': ['error', 2],
'@stylistic/ts/semi': ['error', 'always'],
'@stylistic/ts/comma-dangle': ['error', 'always-multiline'],

// TypeScript
'@typescript-eslint/no-unused-vars': 'error',
},
},
{
rules: {
'react/react-in-jsx-scope': 'off',
},
ignores: ['*.test.tsx'],
},
];
68 changes: 68 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"devDependencies": {
"@eslint/js": "^9.8.0",
"@stylistic/eslint-plugin-ts": "^2.6.1",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const Header = (): React.ReactElement => {

useEffect(() => {
const ref = document.body.style;
showMenu ? (ref.overflow = 'hidden') : (ref.overflow = 'visible');
ref.overflow = showMenu ? 'hidden' : 'visible';
}, [showMenu]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/data/spacecraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const data: Spacecraft[] = [
id: 6,
name: 'TIE Reaper',
description:
"The TIE/rp Reaper attack lander, also known simply as the TIE Reaper, was a troop carrier variant of Sienar Fleet Systems' TIE line used by the Galactic Empire. The TIE Reaper differed from the standard craft of the TIE line in that it was a troop carrier; designed for ferrying troops amidst the heat of battle, such as the death troopers on Scarif.",
'The TIE/rp Reaper attack lander, also known simply as the TIE Reaper, was a troop carrier variant of Sienar Fleet Systems\' TIE line used by the Galactic Empire. The TIE Reaper differed from the standard craft of the TIE line in that it was a troop carrier; designed for ferrying troops amidst the heat of battle, such as the death troopers on Scarif.',
affiliation: 'Galactic Empire',
dimensions: '22.5m x 16.5m x 4.3m',
appearances: 1,
Expand Down
16 changes: 8 additions & 8 deletions src/pages/dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export const Dashboard = (): React.ReactElement => {
} = useQuery<Spacecraft[], { message: string }>({
queryKey: ['dashboard'],
queryFn: () =>
// axios
// .get('/spacecraft')
// .then((response) => {
// return response.data;
// })
// .then((data) => {
// return data.items;
// }),
// axios
// .get('/spacecraft')
// .then((response) => {
// return response.data;
// })
// .then((data) => {
// return data.items;
// }),

// TODO: Remove this mock response and uncomment above if API available
Promise.resolve(mockData.items),
Expand Down
6 changes: 3 additions & 3 deletions src/pages/details/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export const Details = (): React.ReactElement => {
const { isLoading, error, data } = useQuery<Spacecraft, { message: string }>({
queryKey: ['details', id],
queryFn: () =>
// axios.get(`/spacecraft/${id}`).then((response) => {
// return response.data;
// }),
// axios.get(`/spacecraft/${id}`).then((response) => {
// return response.data;
// }),

// TODO: Remove this mock response and uncomment above if API available
Promise.resolve(
Expand Down
16 changes: 8 additions & 8 deletions src/pages/search-results/search-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export const SearchResults = (): React.ReactElement => {
const { error, data: items } = useQuery<Spacecraft[], { message: string }>({
queryKey: ['results', searchParams.get('q')],
queryFn: () =>
// axios
// .get('/search?q=' + searchParams.get('q'))
// .then((response) => {
// return response.data;
// })
// .then((data) => {
// return data.items;
// }),
// axios
// .get('/search?q=' + searchParams.get('q'))
// .then((response) => {
// return response.data;
// })
// .then((data) => {
// return data.items;
// }),

// TODO: Remove this mock response and uncomment above if API available
Promise.resolve(filterResults(mockData.items)),
Expand Down

0 comments on commit 36d600c

Please sign in to comment.