Skip to content

Commit

Permalink
Configure eslint 🧾.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed May 23, 2024
1 parent 9c0aaa9 commit 093834d
Show file tree
Hide file tree
Showing 18 changed files with 7,387 additions and 2,053 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"react-app"
]
}
9,391 changes: 7,359 additions & 2,032 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@
"react-router-dom": "^6.23.1"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@tailwindcss/forms": "^0.5.7",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-react-app": "^7.0.1",
"parcel": "^2.12.0",
"parcel-reporter-static-files-copy": "^1.5.3",
"postcss": "^8.4.38",
Expand Down
2 changes: 2 additions & 0 deletions src/components/DropZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const DropZone = ({ children, isDragActive, isDragReject, errorCode }) => {
case 'reading-file-failed':
errorMsg = 'File reading has failed. Please try again.';
break;
default:
break;
}

return (
Expand Down
3 changes: 2 additions & 1 deletion src/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pkg from '../../package.json' with { type: 'json' };
// eslint-disable-next-line no-undef
import pkg from '../../package.json';

const navigation = [
{
Expand Down
1 change: 1 addition & 0 deletions src/components/PaletteSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const PaletteSelector = ({ palette, paletteOptions, setPalette }) => {
<img
src={palette.img}
className="w-48 rounded"
alt={`Preview of a room with palette ${palette.name}.`}
/>
</RadioGroup.Description>
<span
Expand Down
14 changes: 3 additions & 11 deletions src/components/ScriptCodeInstruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ const prettifyArguments = (operation) => {
];
break;
case 0x28: // equalZero
case 0xa8: // notEqualZero
args = [
args[0],
<Link
className="underline"
to={`#L${args[1]}`}>
0x{args[1]}
</Link>,
];
break;
case 0x28: // equalZero
case 0xa8: // notEqualZero
args = [
args[0],
Expand Down Expand Up @@ -119,6 +108,9 @@ const prettifyArguments = (operation) => {
</Link>,
];
break;

default:
break;
}
return args;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScriptsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ScriptsList = ({ scripts, currentId }) => {
{scripts
.sort((a, b) => a.num > b.num)
.map(({ metadata, code }) => {
if (code.length == 0) {
if (code.length === 0) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/containers/DropZoneContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const DropZoneContainer = ({ onFile }) => {
if (acceptedFiles.length === 1 && rom && res) {
onFile(rom, res);
}
}, [acceptedFiles, rom, res]);
}, [acceptedFiles, rom, res, onFile]);

return (
<Main>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/GfxCanvasContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const GfxCanvasContainer = ({
);
setIsComputing(false);
});
}, [gfx, nametable]);
}, [gfx, nametable, nametableStart, objectImages, rowLength, spacing]);

return (
<canvas
Expand Down
2 changes: 1 addition & 1 deletion src/containers/RoomsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const RoomsContainer = ({ rooms, titles, roomgfx, globdata }) => {
selectedObjects[i] = !!(initialState & 0b10000000);
}
setSelectedObjects(selectedObjects);
}, [id]);
}, [currentId, globdata, rooms]);

const setSelectedObjectState = (id, state) => {
const newSelectedObjects = [...selectedObjects];
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ScreenCanvasContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ScreenCanvasContainer = ({
drawBoxes(ctx, screen.boxes, hoveredBox);
setIsComputing(false);
});
}, [screen, selectedObjects, hoveredBox, crop]);
}, [screen, selectedObjects, hoveredBox, crop, baseTiles, gfc]);

return (
<canvas
Expand Down
2 changes: 1 addition & 1 deletion src/containers/TitlesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const TitlesContainer = ({ rooms, titles }) => {
};

setTitle(title);
}, [id]);
}, [id, titles]);

const updatePalette = (i, colourId) => {
const newRoom = structuredClone(title);
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ root.render(

setColourTheme(localStorage.getItem('theme'));

// eslint-disable-next-line no-undef
if (process.env.NODE_ENV === 'production' && insights) {
// Load the analytics.
// eslint-disable-next-line no-undef
insights.init('OTy7QFoUv4bUuKzo');
// eslint-disable-next-line no-undef
insights.trackPages();
}
2 changes: 1 addition & 1 deletion src/lib/paletteUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getPalette = (palette = [], forceColour = false) => {
}
});

case 'dmg': // Unused
case 'dmg-alt': // Unused
// Method 2: Sort the colours by brightness and maps to DMG's palette.
// May result in the same colour being mapped to 2 different DMG colour on different palettes.
// The colours looks harsher and there are some artefacts.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser/parseRom.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const parseRom = (arrayBuffer, res) => {

// The title screens are stored outside of SCUMM.
for (let i = 0; i < res?.titleoffs?.length; i++) {
const [offset, length] = res.titleoffs[i];
const [offset] = res.titleoffs[i];

// @todo Figure out the length of the title chunks.
const buffer = arrayBuffer.slice(offset); //, offset + length);
Expand Down
1 change: 1 addition & 0 deletions src/lib/parser/parseScriptCode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-fallthrough */
import { opCodes, varNames } from '../opcodes.js';
import { hex } from '../utils.js';

Expand Down
1 change: 0 additions & 1 deletion src/lib/parser/parseTitles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Parser from './parser.js';
import { hex } from '../utils.js';

const assert = console.assert;

Expand Down

0 comments on commit 093834d

Please sign in to comment.