Run eslint

This commit is contained in:
Greg Shuflin 2021-09-11 22:34:15 -07:00
parent 617e26112c
commit 5f11ed8e3a
4 changed files with 1688 additions and 3703 deletions

22
App.jsx
View File

@ -1,15 +1,15 @@
import React, { Component } from "react";
import './App.scss';
import { declineSaimiar } from './saimiar_morphology.js';
import "./App.scss";
import { declineSaimiar } from "./saimiar_morphology.js";
const backendUrl = "https://kucinakobackend.ichigo.everydayimshuflin.com";
function makeRequest(queryString, jsonHandler) {
const effectiveUrl = `${backendUrl}/${queryString}`
const effectiveUrl = `${backendUrl}/${queryString}`;
fetch(`${effectiveUrl}`)
.then((resp) => {
return resp.json()
return resp.json();
})
.then((json) => {
jsonHandler(json);
@ -43,7 +43,7 @@ function Entry(props) {
function SaiEntry(props) {
const entry = props.entry;
const synCategory = entry.syn_category;
const isNominal = synCategory == 'nominal';
const isNominal = synCategory == "nominal";
console.log(isNominal);
return (
<div className="searchResult" key={ entry.id }>
@ -62,9 +62,9 @@ function SaiEntry(props) {
function formatMorphology(entry) {
const decl = declineSaimiar(entry);
if (!decl) {
return '';
return "";
}
return (<span style={ {fontSize: 'medium', color: '#6a3131'} } >
return (<span style={ {fontSize: "medium", color: "#6a3131"} } >
Abs: <i>{decl.abs}</i>, Erg: <i>{decl.erg}</i>,
Adp: <i>{decl.adp}</i>,
All: <i>{decl.all}</i>,
@ -91,7 +91,7 @@ class Results extends Component {
Searched for <b>{ this.props.searchTerm }</b>, { searchType }, found { num } result(s)
</div>);
const entries = this.props.searchResults.map(
(entry, idx) => <Entry entry={ entry } key= { entry.id } conlang={ conlang } />
(entry) => <Entry entry={ entry } key= { entry.id } conlang={ conlang } />
);
return [header].concat(entries);
}
@ -125,7 +125,7 @@ class App extends Component {
searchSaimiar(evt) {
const searchTerm = this.input.current.value;
const request = `saimiar?sai=like.*${searchTerm}*`
const request = `saimiar?sai=like.*${searchTerm}*`;
if (searchTerm === "") {
this.setState({ searchResults: null, searchTerm: null, direction: null });
} else {
@ -137,7 +137,7 @@ class App extends Component {
searchEng(evt) {
const searchTerm = this.input.current.value;
const request = `saimiar?eng=like.*${searchTerm}*`
const request = `saimiar?eng=like.*${searchTerm}*`;
if (searchTerm === "") {
this.setState({ searchResults: null, searchTerm: null, });
} else {
@ -184,6 +184,4 @@ class App extends Component {
}
}
export default App;

View File

@ -15,6 +15,8 @@
"@babel/core": "^7.0.0-0",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.0.0",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.25.1",
"parcel-bundler": "^1.11.0",
"sass": "^1.16.1"
},

View File

@ -1,5 +1,3 @@
const vowelLetters = ['a', 'e', 'ê', 'i', 'o', 'ô', 'u', 'y', 'ø'];
const rootEndingPair = (str) => {
return { root: str.slice(0, -1), ending: str.slice(-1) };
};
@ -7,17 +5,17 @@ const rootEndingPair = (str) => {
function declineSaimiar(entry) {
const sai = entry.sai;
const morph = entry.morph_type;
if (morph == '-V') {
if (morph == "-V") {
return vowelDeclension(sai);
} else if (morph == '-a/i') {
return aiDeclension(sai)
} else if (morph == "-a/i") {
return aiDeclension(sai);
} else if (morph == "e-") {
return initalDeclension(sai);
} else if (morph == "-C") {
return consonantDeclension(sai);
} else {
console.warn(`Can't decline entry '${entry.sai}'`);
console.log(entry)
console.log(entry);
return null;
}
}
@ -54,8 +52,8 @@ function aiDeclension(sai) {
function consonantDeclension(sai) {
const split = rootEndingPair(sai);
const root = split.ending == 'ø' ? split.root : sai;
const absFinal = split.ending == 'ø' ? 'ø' : '';
const root = split.ending == "ø" ? split.root : sai;
const absFinal = split.ending == "ø" ? "ø" : "";
return {
"abs": `${root}${absFinal}`,

4989
yarn.lock

File diff suppressed because it is too large Load Diff