Skip to content

Commit 3f2b0fd

Browse files
committed
chore/add linting
1 parent 99288bd commit 3f2b0fd

File tree

6 files changed

+79
-34
lines changed

6 files changed

+79
-34
lines changed

.eslintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"parserOptions": {
3+
"sourceType": "module",
4+
"ecmaVersion": 2017,
5+
"ecmaFeatures": {
6+
"jsx": true
7+
}
8+
},
9+
"plugins": ["react-hooks"],
10+
"extends": [
11+
"eslint:recommended",
12+
"plugin:react/recommended",
13+
"plugin:react/jsx-runtime",
14+
"plugin:@typescript-eslint/recommended"
15+
],
16+
"rules": {
17+
"@typescript-eslint/no-explicit-any": "warn",
18+
"@typescript-eslint/no-unused-vars": "warn",
19+
"react-hooks/rules-of-hooks": "error",
20+
"react/display-name": "off"
21+
},
22+
"settings": {
23+
"react": {
24+
"version": "17"
25+
}
26+
}
27+
}

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ repos:
1010
rev: v3.0.0
1111
hooks:
1212
- id: prettier
13+
14+
- repo: https://github.com/pre-commit/mirrors-eslint
15+
rev: v8.55.0
16+
hooks:
17+
- id: eslint
18+
additional_dependencies:
19+
20+
21+
22+
23+
exclude: |
24+
(?x)^(
25+
package.json|
26+
tests/.*
27+
)$

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package.json
2+
package-lock.json

.prettierrc.json

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
11
{
2-
"proseWrap": "always",
3-
"singleQuote": true,
4-
"printWidth": 120,
5-
"trailingComma": "all",
6-
"tabWidth": 4,
7-
"overrides": [
8-
{
9-
"files": "**/*.md",
10-
"options": {
11-
"tabWidth": 1
12-
}
13-
},
14-
{
15-
"files": ["**/*.yml", "**/*.yaml"],
16-
"options": {
17-
"tabWidth": 2
18-
}
19-
}
20-
]
2+
"printWidth": 100
213
}

flagsmith-jira-app/README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Flagsmith Jira App
22

3-
This project contains a Forge app written in TypeScript that provides a table of Flagsmith features in a Jira issue panel.
4-
The app is based on the [Jira hello world app](https://developer.atlassian.com/platform/forge/build-a-hello-world-app-in-jira/) so any oddities in its configuration are as created by following those instructions.
3+
This project contains a Forge app written in TypeScript that provides a table of Flagsmith features in a Jira issue
4+
panel. The app is based on the
5+
[Jira hello world app](https://developer.atlassian.com/platform/forge/build-a-hello-world-app-in-jira/) so any oddities
6+
in its configuration are as created by following those instructions.
57

6-
See [developer.atlassian.com/platform/forge](https://developer.atlassian.com/platform/forge) for documentation and tutorials explaining Forge.
8+
See [developer.atlassian.com/platform/forge](https://developer.atlassian.com/platform/forge) for documentation and
9+
tutorials explaining Forge.
710

811
## Overview
912

@@ -23,21 +26,25 @@ See [README.md](../README.md) in the containing folder for instructions to get s
2326

2427
### Developer Console
2528

26-
Manage, distribute and monitor Forge apps using the [Developer console](https://developer.atlassian.com/platform/forge/manage-your-apps/).
29+
Manage, distribute and monitor Forge apps using the
30+
[Developer console](https://developer.atlassian.com/platform/forge/manage-your-apps/).
2731

2832
### Manifest
2933

3034
The app is defined in the `manifest.yml` file.
3135

32-
This includes the `id` of the app within Atlassian Cloud. Change this value to deploy code to a different app, e.g. one created in a developer account.
36+
This includes the `id` of the app within Atlassian Cloud. Change this value to deploy code to a different app, e.g. one
37+
created in a developer account.
3338

3439
### Source Code
3540

36-
The three entry points to the app are contained in the `src/index.jsx` file. These define React components for App Settings, Project Settings and Issue Panel.
41+
The three entry points to the app are contained in the `src/index.jsx` file. These define React components for App
42+
Settings, Project Settings and Issue Panel.
3743

3844
### Linting and Formatting
3945

40-
The Atlassian template provided some basic eslint config, to which sensible TypeScript/React/Prettier defaults have been added.
46+
The Atlassian template provided some basic eslint config, to which sensible TypeScript/React/Prettier defaults have been
47+
added.
4148

4249
Execute `npm run eslint` to check linting and formatting.
4350

@@ -51,23 +58,29 @@ Forge apps may be deployed to one of three environments:
5158

5259
Once an app is running in an environment, you can install it from that environment onto an Atlassian site.
5360

54-
By default, the CLI commands affect the development environment unless you specify another with the `--environment` flag. All the commands provide help given the `--help` flag.
61+
By default, the CLI commands affect the development environment unless you specify another with the `--environment`
62+
flag. All the commands provide help given the `--help` flag.
5563

5664
First ensure you're in the `flagsmith-jira-app` folder, not the containing folder.
5765

5866
Use the `deploy` command and follow the prompts to persist code changes:
5967

6068
forge deploy
6169

62-
Forge handles version numbering itself - the version number in `package.json` is not used. Generally, deployments that involve a change to permissions or authn/authz in `manifest.yml` cause a major increment and require the user to accept these changes to upgrade their installation. Other deployments cause a minor increment and upgrades are installed automatically.
70+
Forge handles version numbering itself - the version number in `package.json` is not used. Generally, deployments that
71+
involve a change to permissions or authn/authz in `manifest.yml` cause a major increment and require the user to accept
72+
these changes to upgrade their installation. Other deployments cause a minor increment and upgrades are installed
73+
automatically.
6374

64-
See [Environments and versions](https://developer.atlassian.com/platform/forge/environments-and-versions/) for more information.
75+
See [Environments and versions](https://developer.atlassian.com/platform/forge/environments-and-versions/) for more
76+
information.
6577

6678
Use the `install` command and follow the prompts to install the app on a new site:
6779

6880
forge install
6981

70-
Once the app is installed on a site, the site picks up changes you deploy without needing to rerun the install command. For major version changes the `--upgrade` flag must be used.
82+
Once the app is installed on a site, the site picks up changes you deploy without needing to rerun the install command.
83+
For major version changes the `--upgrade` flag must be used.
7184

7285
### Debugging and Development
7386

@@ -79,12 +92,16 @@ To switch this off again:
7992

8093
forge variables unset DEBUG
8194

82-
Use the `tunnel` command to test code (but not manifest) changes without having to deploy them (development environment only). This proxies invocations when you use the app to your local environment. To set environment variables, prefix them with `FORGE_USER_VAR_`:
95+
Use the `tunnel` command to test code (but not manifest) changes without having to deploy them (development environment
96+
only). This proxies invocations when you use the app to your local environment. To set environment variables, prefix
97+
them with `FORGE_USER_VAR_`:
8398

8499
FORGE_USER_VAR_DEBUG=1 forge tunnel
85100

86-
This command may report a "Checking Docker image... failed" error and then work anyway. This [may be resolved](https://community.developer.atlassian.com/t/forge-tunnel-error-checking-docker-image/45490/14) by typing `export DOCKER_CLI_HINTS=false` first.
87-
See [Tunneling](https://developer.atlassian.com/platform/forge/tunneling/) for more information on testing using local files and servers.
101+
This command may report a "Checking Docker image... failed" error and then work anyway. This
102+
[may be resolved](https://community.developer.atlassian.com/t/forge-tunnel-error-checking-docker-image/45490/14) by
103+
typing `export DOCKER_CLI_HINTS=false` first. See [Tunneling](https://developer.atlassian.com/platform/forge/tunneling/)
104+
for more information on testing using local files and servers.
88105

89106
Use the `logs` command to see logs (development/staging environment only):
90107

flagsmith-jira-app/src/jira.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const getEntityProperty = async <T>(
5252
const entityId = String(jiraContext[`${entityType}Id`]);
5353
const data = (await jiraApi(
5454
route`/rest/api/3/${entityType}/${entityId}/properties/${propertyKey}`,
55-
{ codes: [404] },
55+
{
56+
codes: [404],
57+
},
5658
)) as { value?: T };
5759
return data?.value;
5860
};

0 commit comments

Comments
 (0)