Skip to content

Commit 8b93928

Browse files
authored
Merge pull request #22 from texttree/fix-foxprogs-linter
Fix foxprogs linter
2 parents 1990abc + fd476f4 commit 8b93928

30 files changed

Lines changed: 3294 additions & 2075 deletions

.eslintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
"parser": "@babel/eslint-parser",
6+
"extends": [
7+
"plugin:react/recommended",
8+
"plugin:jsx-a11y/recommended",
9+
"plugin:prettier/recommended"
10+
],
11+
"settings": {
12+
"react": {
13+
"version": "detect"
14+
},
15+
"linkComponents": [
16+
"Hyperlink",
17+
{
18+
"name": "Link",
19+
"linkAttribute": "to"
20+
}
21+
]
22+
},
23+
"parserOptions": {
24+
"ecmaFeatures": {
25+
"jsx": true
26+
},
27+
"ecmaVersion": 11,
28+
"sourceType": "module"
29+
},
30+
"plugins": [],
31+
"rules": {
32+
"prettier/prettier": [
33+
"error",
34+
{
35+
"endOfLine": "auto"
36+
}
37+
],
38+
"react/prop-types": 0
39+
}
40+
}

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
.*

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"useTabs": false,
3+
"printWidth": 90,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"singleQuote": true,
7+
"jsxBracketSameLine": false,
8+
"semi": true
9+
}

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode"
5+
]
6+
}

.vscode/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"[json]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
},
5+
"[jsonc]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[md]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
},
11+
"eslint.format.enable": true,
12+
"[javascript]": {
13+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
14+
},
15+
"[javascriptreact]": {
16+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
17+
},
18+
"eslint.alwaysShowStatus": true,
19+
"editor.formatOnSave": true,
20+
"editor.detectIndentation": false,
21+
"editor.formatOnPaste": true,
22+
"files.insertFinalNewline": true,
23+
"files.eol": "\n",
24+
"files.trimTrailingWhitespace": true,
25+
"editor.tabSize": 2,
26+
}

package.json

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
{
22
"name": "@texttree/tt-reference-rcl",
3+
"author": "TextTree.org",
34
"version": "1.0.1",
5+
"description": "This library of components was made as part of the development of the Bible Study App and helps to display books and chapters from the books of the Bible.",
6+
"keywords": [
7+
"bible",
8+
"reference"
9+
],
10+
"license": "MIT",
411
"private": false,
512
"main": "dist/index.js",
6-
"license": "MIT",
713
"url": "https://github.com/texttree/tt-reference-rcl",
14+
"homepage": "https://github.com/texttree/tt-reference-rcl#readme",
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/texttree/tt-reference-rcl.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/texttree/tt-reference-rcl/issues"
21+
},
22+
"lint-staged": {
23+
"src/**/*.js": [
24+
"eslint --fix"
25+
],
26+
"*.+(json|md)": [
27+
"prettier --write"
28+
]
29+
},
830
"scripts": {
31+
"prepare": "husky install",
932
"start": "styleguidist server",
1033
"build": "styleguidist build",
11-
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline"
34+
"lint": "eslint --fix .",
35+
"prettier": "prettier --write .",
36+
"prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline",
37+
"precommit": "lint-staged"
1238
},
1339
"peerDependencies": {
1440
"@material-ui/core": "^4.x",
@@ -18,29 +44,25 @@
1844
},
1945
"devDependencies": {
2046
"@babel/cli": "^7.13.14",
21-
"@babel/core": "^7.13.15",
47+
"@babel/core": "^7.14.3",
48+
"@babel/eslint-parser": "^7.14.4",
2249
"@babel/preset-env": "^7.13.15",
2350
"@babel/preset-react": "^7.13.13",
2451
"@material-ui/core": "^4.11.3",
2552
"babel-loader": "^8.2.2",
53+
"eslint": "^7.28.0",
54+
"eslint-config-prettier": "^8.3.0",
55+
"eslint-plugin-jsx-a11y": "^6.4.1",
56+
"eslint-plugin-prettier": "^3.4.0",
57+
"eslint-plugin-react": "^7.24.0",
58+
"eslint-plugin-react-hooks": "^4.2.0",
59+
"husky": "^6.0.0",
60+
"lint-staged": "^11.0.0",
61+
"prettier": "^2.3.1",
2662
"prop-types": "^15.7.2",
2763
"react": "^17.0.2",
2864
"react-dom": "^17.0.2",
29-
"react-styleguidist": "^11.1.6",
30-
"webpack": "^5.32.0"
31-
},
32-
"description": "This library of components was made as part of the development of the Bible Study App and helps to display books and chapters from the books of the Bible.",
33-
"repository": {
34-
"type": "git",
35-
"url": "git+https://github.com/texttree/tt-reference-rcl.git"
36-
},
37-
"author": "texttree",
38-
"bugs": {
39-
"url": "https://github.com/texttree/tt-reference-rcl/issues"
40-
},
41-
"homepage": "https://github.com/texttree/tt-reference-rcl#readme",
42-
"keywords": [
43-
"bible",
44-
"reference"
45-
]
65+
"react-styleguidist": "^11.1.7",
66+
"webpack": "^5.38.1"
67+
}
4668
}

src/components/BibleBookList/BibleBookList.js

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ function BibleBookList({
2929
};
3030
});
3131

32-
const currentBookListOT = currentBookList.filter(
33-
(el) => el.categories === "bible-ot"
34-
);
32+
const currentBookListOT = currentBookList.filter((el) => el.categories === 'bible-ot');
3533

36-
const currentBookListNT = currentBookList.filter(
37-
(el) => el.categories === "bible-nt"
38-
);
34+
const currentBookListNT = currentBookList.filter((el) => el.categories === 'bible-nt');
3935
const handleChange = () => {
4036
setCheckState((prev) => !prev);
4137
};
@@ -48,7 +44,7 @@ function BibleBookList({
4844
let testamentList = [];
4945

5046
switch (testaments) {
51-
case "nt":
47+
case 'nt':
5248
testamentList = [
5349
{
5450
title: titleNT,
@@ -60,7 +56,7 @@ function BibleBookList({
6056
}
6157
break;
6258

63-
case "ot":
59+
case 'ot':
6460
testamentList = [
6561
{
6662
title: titleOT,
@@ -71,7 +67,7 @@ function BibleBookList({
7167
showCheckbox = allBooksIsSet(currentBookListOT);
7268
}
7369
break;
74-
case "all":
70+
case 'all':
7571
testamentList = [
7672
{ title: titleOT, bookList: currentBookListOT },
7773
{ title: titleNT, bookList: currentBookListNT },
@@ -94,17 +90,11 @@ function BibleBookList({
9490
classes={{
9591
label: BibleBookListClasses?.label,
9692
}}
97-
control={
98-
<Checkbox
99-
checked={checkState}
100-
onChange={handleChange}
101-
color="primary"
102-
/>
103-
}
93+
control={<Checkbox checked={checkState} color="primary" onChange={handleChange} />}
10494
label={labelForCheckbox}
10595
/>
10696
) : (
107-
""
97+
''
10898
);
10999

110100
return (
@@ -113,18 +103,18 @@ function BibleBookList({
113103
{testamentList.map((el, index) => {
114104
return (
115105
<BookList
116-
title={el.title}
106+
bookClasses={bookClasses}
117107
bookList={el.bookList}
118-
showInactive={!checkState}
119-
onClickBook={onClickBook}
120-
selectedBookId={selectedBookId}
121108
bookListClasses={{
122109
title: BibleBookListClasses?.title,
123110
book: BibleBookListClasses?.book,
124111
bookList: BibleBookListClasses?.bookList,
125112
}}
126-
bookClasses={bookClasses}
127113
key={index}
114+
onClickBook={onClickBook}
115+
selectedBookId={selectedBookId}
116+
showInactive={!checkState}
117+
title={el.title}
128118
/>
129119
);
130120
})}
@@ -135,18 +125,18 @@ function BibleBookList({
135125
BibleBookList.defaultProps = {
136126
showCheckbox: true,
137127
sortFirstNT: false,
138-
testaments: "all",
139-
titleOT: "",
140-
titleNT: "",
128+
testaments: 'all',
129+
titleOT: '',
130+
titleNT: '',
141131
showInactive: true,
142132
onClickBook: (bookId) => {},
143-
labelForCheckbox: "Show only existing books",
133+
labelForCheckbox: 'Show only existing books',
144134
titleBooks: {},
145135
availableBookList: [],
146136
};
147137

148138
BibleBookList.propTypes = {
149-
testaments: PropTypes.oneOf(["all", "nt", "ot"]),
139+
testaments: PropTypes.oneOf(['all', 'nt', 'ot']),
150140
/** block header of "New Testament" */
151141
titleNT: PropTypes.string,
152142
/** block header of "Old Testament" */

0 commit comments

Comments
 (0)