Skip to content

Commit

Permalink
add prettier, format script and apply it
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-james-watson committed Jan 29, 2022
1 parent 9259e71 commit a00af2d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build files
.next
7 changes: 5 additions & 2 deletions components/board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ export default function Board(props: Props) {
...state.next,
played: { correct },
});

const newNext = state.nextButOne;
const newNextButOne = getRandomItem(newDeck, newNext ? [...newPlayed, newNext] : newPlayed);
const newNextButOne = getRandomItem(
newDeck,
newNext ? [...newPlayed, newNext] : newPlayed
);
const newImageCache = [preloadImage(newNextButOne.image)];

setState({
Expand Down
5 changes: 2 additions & 3 deletions lib/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export function getRandomItem(deck: Item[], played: Item[]): Item {
[1850, 1930],
[1930, 2020],
];
const [fromYear, toYear] = periods[
Math.floor(Math.random() * periods.length)
];
const [fromYear, toYear] =
periods[Math.floor(Math.random() * periods.length)];
const avoidPeople = Math.random() > 0.5;

while (item === undefined) {
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"build": "next build",
"dev": "next dev",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css,scss,json,yml}\"",
"lint": "eslint --max-warnings=0 --cache --ext .js,.ts,.tsx .",
"lint-fix": "eslint --fix --cache --ext .js,.ts,.tsx .",
"start": "next start"
Expand Down Expand Up @@ -32,6 +33,7 @@
"eslint": "^7.24.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.5.1",
"sass": "^1.32.10",
"typescript": "^4.4.4"
}
Expand Down
21 changes: 4 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
{
"compilerOptions": {
"typeRoots": [
"@types",
"node_modules/@types"
],
"typeRoots": ["@types", "node_modules/@types"],
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -23,12 +16,6 @@
"jsx": "preserve",
"incremental": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

0 comments on commit a00af2d

Please sign in to comment.