Skip to content

Commit a3dd3c1

Browse files
authored
Merge pull request #5 from Flagsmith/chore/add-linting
chore: add linting
2 parents 413db03 + 1f93eb5 commit a3dd3c1

18 files changed

+10082
-9953
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+
}

.github/workflows/lint.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint with pre-commit
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pre-commit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-python@v4
12+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: check-json
7+
- id: check-toml
8+
9+
- repo: https://github.com/pre-commit/mirrors-prettier
10+
rev: v3.0.0
11+
hooks:
12+
- 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"printWidth": 100
3+
}

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ suggesting the next steps.
1111

1212
### A couple things to keep in mind
1313

14+
- Please check your files for styling with pre-commit (`pre-commit install` in the root of the repo).
1415
- If you've changed APIs, update the documentation.
1516
- Keep the code style (indents, wrapping) consistent.
1617
- If your PR involves a lot of commits, squash them using `git rebase -i` as this makes it easier for us to review.

LICENSE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
Copyright 2023 Bullet Train Ltd
22

3-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4+
following conditions are met:
45

5-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7+
disclaimer.
68

7-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided with the distribution.
811

9-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
1014

11-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
16+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
# Flagsmith Jira Integration
22

3-
This repository contains an outer folder to install and configure the Forge CLI with an inner folder containing the Jira app itself.
3+
This repository contains an outer folder to install and configure the Forge CLI with an inner folder containing the Jira
4+
app itself.
45

5-
See [developer.atlassian.com/platform/forge](https://developer.atlassian.com/platform/forge) for documentation and tutorials explaining Forge.
6+
See [developer.atlassian.com/platform/forge](https://developer.atlassian.com/platform/forge) for documentation and
7+
tutorials explaining Forge.
68

79
## Architectural Decisions
810

911
See [docs/decisions/README.md](docs/decisions/README.md) for decision records.
1012

1113
## Forge CLI installation
1214

13-
The following steps reflect the usual [Getting started](https://developer.atlassian.com/platform/forge/getting-started/) instructions but diverge for reproducability and portability reasons.
15+
The following steps reflect the usual [Getting started](https://developer.atlassian.com/platform/forge/getting-started/)
16+
instructions but diverge for reproducability and portability reasons.
1417

1518
### Before you begin
1619

@@ -19,14 +22,17 @@ Forge CLI requires [Docker](https://docs.docker.com/get-docker/) and Node.js 20
1922
- [Apple macOS](https://developer.atlassian.com/platform/forge/installing-forge-on-macos)
2023
- [Linux](https://developer.atlassian.com/platform/forge/installing-forge-on-linux)
2124

22-
Forge recommend installing Node using using [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) but [asdf](https://asdf-vm.com/) also works.
23-
Ensure you are using the correct Node.js version before executing any other commands:
25+
Forge recommend installing Node using using [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) but
26+
[asdf](https://asdf-vm.com/) also works. Ensure you are using the correct Node.js version before executing any other
27+
commands:
2428

2529
nvm use
2630

2731
### Install the Forge CLI
2832

29-
Forge instructions start by [installing the CLI globally](https://developer.atlassian.com/platform/forge/getting-started/#install-the-forge-cli) but instead we will use a local installation with pinned requirements:
33+
Forge instructions start by
34+
[installing the CLI globally](https://developer.atlassian.com/platform/forge/getting-started/#install-the-forge-cli) but
35+
instead we will use a local installation with pinned requirements:
3036

3137
npm ci
3238

@@ -42,17 +48,20 @@ Create an Atlassian API token to log in to the CLI. The CLI uses your token when
4248
1. Click Create.
4349
1. Click Copy to clipboard and close the dialog.
4450

45-
The `forge login` command attempts to store credentials in your operating system keychain and may not work on all platforms. Instead, we can skip this command and set environment variables instead.
51+
The `forge login` command attempts to store credentials in your operating system keychain and may not work on all
52+
platforms. Instead, we can skip this command and set environment variables instead.
4653

4754
### Using environment variables to login
4855

4956
Copy `.env-example` to `.env` and complete your Atlassian account email address and API token.
5057

51-
If you use [direnv](https://direnv.net/) these values should be picked up automatically. Alternatively use the activate script:
58+
If you use [direnv](https://direnv.net/) these values should be picked up automatically. Alternatively use the activate
59+
script:
5260

5361
source <(./bin/activate)
5462

55-
This reads `.env` values into your shell environment and also sets an alias so you can execute Forge CLI commands by typing `forge` without needing an `npx` prefix or to or mess with your path variable.
63+
This reads `.env` values into your shell environment and also sets an alias so you can execute Forge CLI commands by
64+
typing `forge` without needing an `npx` prefix or to or mess with your path variable.
5665

5766
Check installation and authentication by typing e.g.:
5867

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
# Use Atlassian Forge
22

3-
* Status: Accepted
3+
- Status: Accepted
44

55
## Context and Problem Statement
66

7-
Need to choose a development platform which allows UI modules to be added to Jira and to be distributed as an app in the Atlassian Marketplace.
7+
Need to choose a development platform which allows UI modules to be added to Jira and to be distributed as an app in the
8+
Atlassian Marketplace.
89

910
## Decision Drivers
1011

11-
* Overall requirement to quickly tick the box that Flagsmith has a Jira integration and offer MVP functionality which can be iterated on later.
12+
- Overall requirement to quickly tick the box that Flagsmith has a Jira integration and offer MVP functionality which
13+
can be iterated on later.
1214

1315
## Considered Options
1416

15-
* Atlassian Forge (newer mechanism, app hosted by Atlassian)
16-
* Atlassian Connect (older mechanism, iframe only, app hosted by Flagsmith)
17+
- Atlassian Forge (newer mechanism, app hosted by Atlassian)
18+
- Atlassian Connect (older mechanism, iframe only, app hosted by Flagsmith)
1719

1820
## Decision Outcome
1921

20-
Chosen option: "Atlassian Forge", because it allows for faster development of an app that meets requirements with capacity to scale to meet future requirements.
22+
Chosen option: "Atlassian Forge", because it allows for faster development of an app that meets requirements with
23+
capacity to scale to meet future requirements.
2124

2225
### Positive Consequences
2326

24-
* Use of recommended platform with roadmap
25-
* Built-in authentication, sandboxing, and hosting environments
26-
* Built-in console to manage, distribute, and monitor apps
27-
* CLI tooling for testing, deployment and installation
28-
* Allows for Connect-style iframe apps if required
27+
- Use of recommended platform with roadmap
28+
- Built-in authentication, sandboxing, and hosting environments
29+
- Built-in console to manage, distribute, and monitor apps
30+
- CLI tooling for testing, deployment and installation
31+
- Allows for Connect-style iframe apps if required
2932

3033
### Negative Consequences
3134

32-
* Limited to JavaScript/TypeScript but that is the UI stack we use anyway
33-
* Less control over (but less responsibility for) hosting as it is provided by Atlassian
35+
- Limited to JavaScript/TypeScript but that is the UI stack we use anyway
36+
- Less control over (but less responsibility for) hosting as it is provided by Atlassian
3437

3538
## Links
3639

37-
* https://developer.atlassian.com/developer-guide/cloud-development-options/
40+
- https://developer.atlassian.com/developer-guide/cloud-development-options/
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
# Use Current Forge Runtime
22

3-
* Status: Accepted
3+
- Status: Accepted
44

55
## Context and Problem Statement
66

7-
Need to choose a JavaScript runtime that executes the app code and provides libraries for Jira and Flagsmith REST API calls, storage, authorisation, etc.
7+
Need to choose a JavaScript runtime that executes the app code and provides libraries for Jira and Flagsmith REST API
8+
calls, storage, authorisation, etc.
89

910
## Decision Drivers
1011

11-
* Overall requirement to quickly tick the box that Flagsmith has a Jira integration and offer MVP functionality which can be iterated on later.
12+
- Overall requirement to quickly tick the box that Flagsmith has a Jira integration and offer MVP functionality which
13+
can be iterated on later.
1214

1315
## Considered Options
1416

15-
* Current runtime (limited Node.js 14, generally available)
16-
* Native runtime (full Node.js 18, in preview)
17+
- Current runtime (limited Node.js 14, generally available)
18+
- Native runtime (full Node.js 18, in preview)
1719

1820
## Decision Outcome
1921

20-
Chosen option: "Current runtime", while avoiding falling into any of the breaking changes between the runtimes, i.e. use latest Forge libraries, set Content-Type on API calls, don't rely on snapshotting. This allows for faster, more reliable, development without ruling out a future change of runtime.
22+
Chosen option: "Current runtime", while avoiding falling into any of the breaking changes between the runtimes, i.e. use
23+
latest Forge libraries, set Content-Type on API calls, don't rely on snapshotting. This allows for faster, more
24+
reliable, development without ruling out a future change of runtime.
2125

2226
### Positive Consequences
2327

24-
* Stability as preview releases are subject to change
25-
* Reliable tunnelling as local environment is same as deployment environment
26-
* Ability to use runtime features (e.g. debugging) not yet available in new runtime
27-
* Avoids confusion between Forge CLI Node.js (20) and Runtime Node.js (18)
28-
* Minimal obstacles to migrate to the new runtime later
28+
- Stability as preview releases are subject to change
29+
- Reliable tunnelling as local environment is same as deployment environment
30+
- Ability to use runtime features (e.g. debugging) not yet available in new runtime
31+
- Avoids confusion between Forge CLI Node.js (20) and Runtime Node.js (18)
32+
- Minimal obstacles to migrate to the new runtime later
2933

3034
### Negative Consequences
3135

32-
* Potentially slower but should be fast enough, if not we can re-evaluate this decision
33-
* Less Node features in the older runtime but we don't need them now
36+
- Potentially slower but should be fast enough, if not we can re-evaluate this decision
37+
- Less Node features in the older runtime but we don't need them now
3438

3539
## Links
3640

37-
* https://developer.atlassian.com/platform/forge/runtime-reference/native-nodejs-runtime/
41+
- https://developer.atlassian.com/platform/forge/runtime-reference/native-nodejs-runtime/

0 commit comments

Comments
 (0)