Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linting workflow #6

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ module.exports = {
rules: {
"react/prop-types": "off",
},
settings: {
react: {
version: "detect",
},
},
};
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
pull_request:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install requirements
run: npm ci

- name: Prettier
run: npx prettier -c src/ README.md .github/workflows

- name: ES lint
run: npx eslint --ignore-path .gitignore .

- name: Stylelint
run: npx stylelint '**/*.css'
3 changes: 2 additions & 1 deletion src/components/Heart.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import Share from "./Share";
import packageJson from "../../package.json";

export default function Heart({setDisplay}) {
const feedbackLink = 'https://github.com/skedwards88/logic-grid/issues/new/choose';
const feedbackLink =
"https://github.com/skedwards88/logic-grid/issues/new/choose";

return (
<div className="App heart">
Expand Down
132 changes: 29 additions & 103 deletions src/logic/puzzleGeneration/allCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2572,15 +2572,10 @@ export const allCategories = [
],
[
{
values: [
"bean salad",
"brownies",
"fruit platter",
"sliders",
"tacos",
],
values: ["bean salad", "brownies", "fruit platter", "sliders", "tacos"],
descriptionTemplates: {
description: (value) => `the person who contributed the ${value} to the potluck`,
description: (value) =>
`the person who contributed the ${value} to the potluck`,
},
},
{
Expand All @@ -2592,7 +2587,8 @@ export const allCategories = [
"transportation",
],
descriptionTemplates: {
description: (value) => `the person who organized the ${value} for the potluck`,
description: (value) =>
`the person who organized the ${value} for the potluck`,
},
},
{
Expand All @@ -2615,64 +2611,34 @@ export const allCategories = [
],
[
{
values: [
"RV",
"tent",
"campervan",
"yurt",
"hammock",
],
values: ["RV", "tent", "campervan", "yurt", "hammock"],
descriptionTemplates: {
description: (value) => `the person who camped in the ${value}`,
},
},
{
values: [
"beach",
"lake",
"mountains",
"forest",
"creek",
"desert",
],
values: ["beach", "lake", "mountains", "forest", "creek", "desert"],
descriptionTemplates: {
description: (value) => `the person who camped by the ${value}`,
},
},
{
values: [
"stars",
"solitude",
"clean air",
"flowers",
"wildlife",
],
values: ["stars", "solitude", "clean air", "flowers", "wildlife"],
descriptionTemplates: {
description: (value) => `the person who appreciated the ${value}`,
},
},
{
values: [
"bugs",
"generator",
"music",
"smoke",
"kids",
],
values: ["bugs", "generator", "music", "smoke", "kids"],
descriptionTemplates: {
description: (value) => `the person who was annoyed by the neighboring ${value}`,
description: (value) =>
`the person who was annoyed by the neighboring ${value}`,
},
},
],
[
{
values: [
"guitar",
"piano",
"violin",
"cello",
"oboe",
],
values: ["guitar", "piano", "violin", "cello", "oboe"],
descriptionTemplates: {
description: (value) => `the person who plays the the ${value}`,
},
Expand All @@ -2688,18 +2654,12 @@ export const allCategories = [
"Verdi",
],
descriptionTemplates: {
description: (value) => `the person who plays music inspired by ${value}`,
description: (value) =>
`the person who plays music inspired by ${value}`,
},
},
{
values: [
"folk",
"rock",
"jazz",
"country",
"electronic",
"blues",
],
values: ["folk", "rock", "jazz", "country", "electronic", "blues"],
descriptionTemplates: {
description: (value) => `the person who plays ${value}-style music`,
},
Expand Down Expand Up @@ -2737,20 +2697,24 @@ export const allCategories = [
"contemplative",
],
descriptionTemplates: {
description: (value) => `the person who likes novels that make them feel ${value}`,
description: (value) =>
`the person who likes novels that make them feel ${value}`,
},
},
{
values: [1, 2, 3, 4, 5],
display: (value) => `${value} books`,
descriptionTemplates: {
description: (value) => `the person who reads ${value} ${basicPluralize(value, "book")} a month`,
description: (value) =>
`the person who reads ${value} ${basicPluralize(
value,
"book",
)} a month`,
diffGreaterDescription: (value) =>
`${value} more ${basicPluralize(value, "book")}`,
diffLesserDescription: (value) =>
`${value} less ${basicPluralize(value, "book")}`,
verb: "reads",

},
},
{
Expand All @@ -2762,14 +2726,7 @@ export const allCategories = [
],
[
{
values: [
"arugula",
"spinach",
"kale",
"lettuce",
"bok choy",
"fennel",
],
values: ["arugula", "spinach", "kale", "lettuce", "bok choy", "fennel"],
descriptionTemplates: {
description: (value) => `the salad made on a base of ${value}`,
},
Expand All @@ -2788,25 +2745,13 @@ export const allCategories = [
},
},
{
values: [
"pear",
"apple",
"fig",
"orange",
"strawberries",
],
values: ["pear", "apple", "fig", "orange", "strawberries"],
descriptionTemplates: {
description: (value) => `the salad sweetened with ${value}`,
},
},
{
values: [
"tumeric",
"balsamic",
"pepper",
"salt",
"soy sauce",
],
values: ["tumeric", "balsamic", "pepper", "salt", "soy sauce"],
descriptionTemplates: {
description: (value) => `the salad flavored with ${value}`,
},
Expand Down Expand Up @@ -2846,13 +2791,7 @@ export const allCategories = [
},
},
{
values: [
"scarlet",
"maroon",
"crimson",
"burgundy",
"vermilion",
],
values: ["scarlet", "maroon", "crimson", "burgundy", "vermilion"],
descriptionTemplates: {
description: (value) => `the vampire whose favorite color is ${value}`,
},
Expand All @@ -2873,14 +2812,7 @@ export const allCategories = [
],
[
{
values: [
"roses",
"daisies",
"carnations",
"lilies",
"tulips",
"dahlias",
],
values: ["roses", "daisies", "carnations", "lilies", "tulips", "dahlias"],
descriptionTemplates: {
description: (value) => `the bouquet of ${value}`,
},
Expand All @@ -2892,7 +2824,7 @@ export const allCategories = [
},
},
{
values: [4,5,6,7,8],
values: [4, 5, 6, 7, 8],
display: (value) => `${value} flowers`,
descriptionTemplates: {
description: (value) => `the bouquet of ${value} flowers`,
Expand All @@ -2904,13 +2836,7 @@ export const allCategories = [
},
},
{
values: [
"birthday",
"anniversary",
"wedding",
"graduation",
"recital",
],
values: ["birthday", "anniversary", "wedding", "graduation", "recital"],
descriptionTemplates: {
description: (value) => `the bouquet for the ${value}`,
},
Expand Down
4 changes: 3 additions & 1 deletion src/logic/puzzleGeneration/chooseCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export function chooseCategories(numCats, numItemsPerCat) {
// omit the "first name" category
// to prevent this common category from feeling overused
if (categorySet.length > numCats) {
categorySet = categorySet.filter(category => !category.values.includes("Aaron"));
categorySet = categorySet.filter(
(category) => !category.values.includes("Aaron"),
);
}

const categories = shuffleArray(categorySet).slice(0, numCats);
Expand Down
Loading