diff --git a/eslint.config.js b/eslint.config.js index d7c26c2..ffc4369 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -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'; @@ -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'], }, ]; diff --git a/package-lock.json b/package-lock.json index c783787..fc2aa9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,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", @@ -2085,6 +2086,73 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-2.6.1.tgz", + "integrity": "sha512-iLOiVzcvqzDGD9U0EuVOX680v+XOPiPAjkxWj+Q6iV2GLOM5NB27tKVOpJY7AzBhidwpRbaLTgg3T4UzYx09jw==", + "dev": true, + "dependencies": { + "@types/eslint": "^9.6.0", + "acorn": "^8.12.1", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-js/node_modules/@types/eslint": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.0.tgz", + "integrity": "sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@stylistic/eslint-plugin-js/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@stylistic/eslint-plugin-ts": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-2.6.1.tgz", + "integrity": "sha512-Mxl1VMorEG1Hc6oBYPD0+KIJOWkjEF1R0liL7wWgKfwpqOkgmnh5lVdZBrYyfRKOE4RlGcwEFTNai1IW6orgVg==", + "dev": true, + "dependencies": { + "@stylistic/eslint-plugin-js": "2.6.1", + "@types/eslint": "^9.6.0", + "@typescript-eslint/utils": "^8.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-ts/node_modules/@types/eslint": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.0.tgz", + "integrity": "sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, "node_modules/@szmarczak/http-timer": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", diff --git a/package.json b/package.json index e034db6..0da2e7b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 008f5a9..49d32af 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -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(() => { diff --git a/src/data/spacecraft.ts b/src/data/spacecraft.ts index 787e767..84df220 100644 --- a/src/data/spacecraft.ts +++ b/src/data/spacecraft.ts @@ -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, diff --git a/src/pages/dashboard/dashboard.tsx b/src/pages/dashboard/dashboard.tsx index 754e4ac..736640c 100644 --- a/src/pages/dashboard/dashboard.tsx +++ b/src/pages/dashboard/dashboard.tsx @@ -20,14 +20,14 @@ export const Dashboard = (): React.ReactElement => { } = useQuery({ 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), diff --git a/src/pages/details/details.tsx b/src/pages/details/details.tsx index 6659daf..0151a92 100644 --- a/src/pages/details/details.tsx +++ b/src/pages/details/details.tsx @@ -15,9 +15,9 @@ export const Details = (): React.ReactElement => { const { isLoading, error, data } = useQuery({ 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( diff --git a/src/pages/search-results/search-results.tsx b/src/pages/search-results/search-results.tsx index 8c289fc..508cac8 100644 --- a/src/pages/search-results/search-results.tsx +++ b/src/pages/search-results/search-results.tsx @@ -13,14 +13,14 @@ export const SearchResults = (): React.ReactElement => { const { error, data: items } = useQuery({ 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)),