Skip to content

Commit

Permalink
update eslint to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yle committed Aug 15, 2024
1 parent 56007e1 commit 4cac4fe
Show file tree
Hide file tree
Showing 12 changed files with 901 additions and 1,644 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'eslint-config-kyle';
19 changes: 3 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,18 @@
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"eslint": "^8.56.0",
"eslint-config-kyle": "^17.0.2",
"eslint": "^9.9.0",
"eslint-config-kyle": "^25.0.0-beta2",
"typescript": "^5.1.6",
"vite": "^4.4.8",
"vitest": "^0.34.6"
},
"scripts": {
"lint": "eslint --ext .ts,.tsx,.js --ignore-path .gitignore . && tsc",
"lint": "eslint . && tsc",
"test": "vitest",
"start": "vite",
"build": "vite build"
},
"eslintConfig": {
"extends": "kyle",
"settings": {
"jest": {
"version": 28
}
},
"rules": {
"unicorn/no-unreadable-array-destructuring": "off",
"@typescript-eslint/no-dynamic-delete": "off",
"no-lonely-if": "off"
}
},
"prettier": "eslint-config-kyle/prettier",
"browserslist": [
">0.2%",
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import './index.css';

const getCurrentRoute = () => window.location.hash.slice(1);

// eslint-disable-next-line no-useless-assignment -- false positive
const App: React.FC = () => {
const [path, setPath] = useState<string>(getCurrentRoute());

Expand Down
1 change: 0 additions & 1 deletion src/pages/HistoryRestorer/HistoryRestorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ const HistoryRestorerInner: React.FC = () => {
<br />
<br />
Logged in as <code>{user.display_name}</code>.{' '}
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/anchor-is-valid */}
<a onClick={logout}>Logout</a>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/addressImport/AddressProgressChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const AddressProgressChart: React.FC = () => {
// .filter((cat) => cat !== 'PERFECT' && cat !== 'TOTALLY_MISSING')
.map(([_addressCategory, categoryInfo]): Serie => {
const addressCategory = _addressCategory as AddressCategory; // TS is dumb
const [, , , colour] = categoryInfo;
const colour = categoryInfo[3];

return {
id: addressCategory,
Expand Down
1 change: 0 additions & 1 deletion src/pages/upload/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ const UploadInner: React.FC = () => {
<br />
<div style={{ display: 'flex', gap: 16 }}>
<div>
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control -- rule broken */}
<label>
<input
type="checkbox"
Expand Down
1 change: 0 additions & 1 deletion src/pages/upload/components/DiffForFeature.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/control-has-associated-label */
import { useContext, useMemo } from 'react';
import TimeAgo from 'react-timeago-i18n';
import type { OsmFeature } from 'osm-api';
Expand Down
1 change: 1 addition & 0 deletions src/pages/upload/createOsmChangeFromPatchFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { OsmPatch } from '../../types';
import { type FetchCache, fetchChunked } from './util';
import { type Bbox, getGeoJsonBbox } from './helpers/bbox';

// eslint-disable-next-line unicorn/prefer-structured-clone
window.structuredClone ||= (x) => JSON.parse(JSON.stringify(x));

const TEMPLATE_OSM_FEATURE: Omit<OsmFeature, 'id' | 'type'> = {
Expand Down
1 change: 1 addition & 0 deletions src/pages/upload/helpers/bbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function getGeoJsonBbox(osmPatch: OsmPatch): Bbox {
const allCoords: number[] = [];
for (const f of osmPatch.features) {
if ('coordinates' in f.geometry) {
// eslint-disable-next-line unicorn/no-magic-array-flat-depth -- Position[][][] -> Position
const flatCoords = f.geometry.coordinates.flat(3);
allCoords.push(...flatCoords);
}
Expand Down
1 change: 1 addition & 0 deletions src/wrappers/AuthGateway.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type IAuthContext = {
logout(): void;
};
export const AuthContext = createContext({} as IAuthContext);
AuthContext.displayName = 'AuthContext';

export const AuthGateway: React.FC<PropsWithChildren> = ({ children }) => {
const [error, setError] = useState<Error>();
Expand Down
2 changes: 0 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
/* eslint-enable import/no-extraneous-dependencies */

// https://vitejs.dev/config/
export default defineConfig({
Expand Down
Loading

0 comments on commit 4cac4fe

Please sign in to comment.