Skip to content

Commit e7c53ea

Browse files
Initial commit
0 parents  commit e7c53ea

49 files changed

Lines changed: 27994 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
max_line_length = 100
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.cs]
16+
indent_size = 4

.eslintignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.eslintignore
2+
3+
# Please keep this file in sync with .prettierignore and .stylelintignore
4+
5+
# Logs
6+
logs
7+
*.log
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
14+
# Dependency directory
15+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
16+
node_modules
17+
18+
# OSX
19+
.DS_Store
20+
21+
.idea
22+
npm-debug.log.*
23+
*.css.d.ts
24+
*.sass.d.ts
25+
*.scss.d.ts
26+
27+
# Built files
28+
dist
29+
release
30+
temp-build
31+
32+
# generated files
33+
package-lock.json
34+
35+
# #endregion

.eslintrc.js

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
// #region shared with https://github.com/paranext/paranext-multi-extension-template/blob/main/.eslintrc.cjs
2+
3+
module.exports = {
4+
extends: [
5+
// https://github.com/electron-react-boilerplate/eslint-config-erb/blob/main/index.js
6+
// airbnb rules are embedded in erb https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
7+
'erb',
8+
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#typescript
9+
'plugin:import/recommended',
10+
'plugin:import/typescript',
11+
// Make sure this is last so it gets the chance to override other configs.
12+
// See https://github.com/prettier/eslint-config-prettier and https://github.com/prettier/eslint-plugin-prettier
13+
'plugin:prettier/recommended',
14+
],
15+
16+
rules: {
17+
// Some rules in this following shared region are not applied since they are overridden in subsequent regions
18+
// #region shared with https://github.com/paranext/paranext-core/blob/main/.eslintrc.js
19+
20+
// #region ERB rules
21+
22+
// Use `noImplicitReturns` instead. See https://typescript-eslint.io/rules/consistent-return/.
23+
'consistent-return': 'off',
24+
'import/default': 'off',
25+
'import/extensions': 'off',
26+
// A temporary hack related to IDE not resolving correct package.json
27+
'import/no-extraneous-dependencies': 'off',
28+
'import/no-import-module-exports': 'off',
29+
'import/no-unresolved': 'error',
30+
'import/prefer-default-export': 'off',
31+
'react/jsx-filename-extension': 'off',
32+
'react/react-in-jsx-scope': 'off',
33+
34+
// #endregion
35+
36+
// #region Platform.Bible rules
37+
38+
// Rules in each section are generally in alphabetical order. However, several
39+
// `@typescript-eslint` rules require disabling the equivalent ESLint rule. So in these cases
40+
// each ESLint rule is turned off immediately above the corresponding `@typescript-eslint` rule.
41+
'class-methods-use-this': 'off',
42+
'@typescript-eslint/class-methods-use-this': [
43+
'error',
44+
{ ignoreOverrideMethods: true, ignoreClassesThatImplementAnInterface: false },
45+
],
46+
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
47+
'lines-between-class-members': 'off',
48+
'@typescript-eslint/lines-between-class-members': [
49+
'error',
50+
'always',
51+
{ exceptAfterSingleLine: true, exceptAfterOverload: true },
52+
],
53+
'@typescript-eslint/member-ordering': 'error',
54+
'no-empty-function': 'off',
55+
'@typescript-eslint/no-empty-function': [
56+
'error',
57+
{
58+
allow: ['arrowFunctions', 'functions', 'methods'],
59+
},
60+
],
61+
'@typescript-eslint/no-explicit-any': 'error',
62+
'no-redeclare': 'off',
63+
'@typescript-eslint/no-redeclare': 'error',
64+
'no-restricted-imports': [
65+
'error',
66+
{
67+
patterns: [
68+
{
69+
group: ['shared/*', 'renderer/*', 'extension-host/*', 'node/*', 'client/*', 'main/*'],
70+
message: `Importing from this path is not allowed. Try importing from @papi/core. Imports from paths like 'shared', 'renderer', 'node', 'client' and 'main' are not allowed to prevent unnecessary import break.`,
71+
},
72+
],
73+
},
74+
],
75+
'no-shadow': 'off',
76+
'@typescript-eslint/no-shadow': 'error',
77+
'no-use-before-define': 'off',
78+
'@typescript-eslint/no-use-before-define': [
79+
'error',
80+
{ functions: false, allowNamedExports: true, typedefs: false, ignoreTypeReferences: true },
81+
],
82+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
83+
'no-unused-vars': 'off',
84+
'@typescript-eslint/no-unused-vars': 'error',
85+
'no-useless-constructor': 'off',
86+
'@typescript-eslint/no-useless-constructor': 'error',
87+
'comma-dangle': ['error', 'always-multiline'],
88+
'import/no-anonymous-default-export': ['error', { allowCallExpression: false }],
89+
indent: 'off',
90+
'jsx-a11y/label-has-associated-control': [
91+
'error',
92+
{
93+
assert: 'either',
94+
},
95+
],
96+
// Should use our logger anytime you want logs that persist. Otherwise use console only in testing
97+
'no-console': 'warn',
98+
'no-null/no-null': 2,
99+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
100+
'no-type-assertion/no-type-assertion': 'error',
101+
'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }],
102+
'react/jsx-indent-props': ['warn', 2],
103+
'react/jsx-props-no-spreading': ['error', { custom: 'ignore' }],
104+
'react/require-default-props': 'off',
105+
106+
// #endregion
107+
108+
// #endregion
109+
110+
// #region Overrides to rules from paranext-core
111+
112+
'import/no-unresolved': ['error', { ignore: ['@papi'] }],
113+
114+
// #endregion
115+
},
116+
globals: {
117+
globalThis: 'readonly',
118+
},
119+
overrides: [
120+
{
121+
files: ['*.ts', '*.tsx'],
122+
rules: {
123+
// #region shared with https://github.com/paranext/paranext-core/blob/main/.eslintrc.js
124+
125+
// These are already handled by TypeScript
126+
'no-dupe-class-members': 'off',
127+
128+
// #endregion
129+
},
130+
},
131+
{
132+
// Allow this file to have overrides to rules from paranext-core
133+
files: ['.eslintrc.*js'],
134+
rules: {
135+
'no-dupe-keys': 'off',
136+
},
137+
},
138+
{
139+
files: ['*.js'],
140+
rules: {
141+
strict: 'off',
142+
},
143+
},
144+
{
145+
files: ['./lib/*', './webpack/*'],
146+
rules: {
147+
// These files are scripts not running in Platform.Bible, so they can't use the logger
148+
'no-console': 'off',
149+
},
150+
},
151+
{
152+
files: ['*.d.ts'],
153+
rules: {
154+
// Allow .d.ts files to self import so they can refer to their types in `papi-shared-types`
155+
'import/no-self-import': 'off',
156+
},
157+
},
158+
],
159+
parserOptions: {
160+
ecmaVersion: 2022,
161+
sourceType: 'module',
162+
project: './tsconfig.lint.json',
163+
tsconfigRootDir: __dirname,
164+
createDefaultProgram: true,
165+
},
166+
plugins: ['@typescript-eslint', 'no-type-assertion', 'no-null'],
167+
settings: {
168+
'import/resolver': {
169+
typescript: {
170+
alwaysTryTypes: true,
171+
},
172+
},
173+
'import/parsers': {
174+
'@typescript-eslint/parser': ['.ts', '.tsx'],
175+
},
176+
},
177+
};
178+
179+
// #endregion

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
* text eol=lf
2+
*.exe binary
3+
*.png binary
4+
*.jpg binary
5+
*.jpeg binary
6+
*.ico binary
7+
*.icns binary
8+
*.eot binary
9+
*.otf binary
10+
*.ttf binary
11+
*.woff binary
12+
*.woff2 binary
13+
*.ldml binary
14+
*.zip binary

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @tjcouch-sil @lyonsil @irahopkinson
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Bump Versions Action
2+
description: |
3+
Runs bump-versions.ts script
4+
5+
inputs:
6+
newVersion:
7+
description: "Version to bump all the repo's versions to on a new branch (called `bump-versions-<version>`), e.g. 0.3.0-alpha.0."
8+
required: true
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Bump repo versions
14+
# Bump versions using the built-in git token https://github.com/actions/checkout/tree/v4/?tab=readme-ov-file#push-a-commit-using-the-built-in-token
15+
shell: bash
16+
run: |
17+
cd ${GITHUB_ACTION_PATH}/../../..
18+
git config user.name "github-actions[bot]"
19+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
20+
npm run bump-versions -- ${{ inputs.newVersion }}

.github/assets/release-body.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Includes:
2+
3+
- Extension template
4+
5+
Tested on Platform.Bible vX.Y.Z. Expected to be compatible with at least vX.Y.\*.
6+
7+
Install instructions:
8+
9+
1. Download the `.zip` file of the extension.
10+
2. Follow the [install instructions on the Wiki](https://github.com/paranext/paranext-extension-template/wiki/Debugging-Your-Extension-in-the-Production-Application#running-your-extension-in-an-app).
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Bump Versions
2+
run-name: Bump versions on ${{ github.head_ref || github.ref_name }} to ${{ github.event.inputs.newVersion }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
newVersion:
8+
description: "Version to bump all the repo's versions to on a new branch (called `bump-versions-<version>`), e.g. 0.3.0-alpha.0."
9+
required: true
10+
11+
jobs:
12+
bump-versions:
13+
name: Bump versions on ${{ matrix.os }}
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
permissions:
18+
contents: write
19+
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
24+
steps:
25+
- name: Output Workflow Dispatch Inputs
26+
run: echo "${{ toJSON(github.event.inputs) }}"
27+
28+
- name: Checkout git repo
29+
uses: actions/checkout@v4
30+
31+
- name: Read package.json
32+
id: package_json
33+
uses: zoexx/github-action-json-file-properties@1.0.6
34+
with:
35+
file_path: 'package.json'
36+
37+
- name: Install Node and NPM
38+
uses: actions/setup-node@v4
39+
with:
40+
cache: npm
41+
node-version: ${{ fromJson(steps.package_json.outputs.volta).node }}
42+
43+
- name: Install packages
44+
run: |
45+
npm ci
46+
47+
- name: Bump repo versions
48+
if: ${{ inputs.newVersion != '' }}
49+
uses: ./.github/actions/bump-versions-action
50+
with:
51+
newVersion: ${{ inputs.newVersion }}

0 commit comments

Comments
 (0)