Skip to content

Commit

Permalink
chore: add slightly stricter ts types (#603)
Browse files Browse the repository at this point in the history
* chore: add slightly stricter tsconfig

* chore(prettier): run on full codebase

* chore: setup lint-staged, husky and include tsc lint

* chore(tsconfig); enable no-implicit-override

* chore(tsconfig): setup project references for src/test

* test(layers): fix typescript errors
  • Loading branch information
venikx authored May 30, 2023
1 parent 3b7cad2 commit 1da4a2b
Show file tree
Hide file tree
Showing 63 changed files with 2,674 additions and 389 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"root": true,
"plugins": ["@typescript-eslint/eslint-plugin", "prettier"],
"env": {
"es6": true,
Expand All @@ -11,11 +12,6 @@
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.test.json"
},
"rules": {
"prettier/prettier": "error",

Expand Down
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Report a bug
title: ''
labels: "\U0001F41B bug"
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
name: Task
about: This issue represents a task
title: ''
labels: "⚙️ task"
labels: '⚙️ task'
assignees: ''

---


3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/user-story.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ about: This issue represents a user story
title: As a [subject] I want to [do something] so that [I add business value]
labels: "\U0001F4C7 user story"
assignees: ''

---

## Acceptance criteria

1. [Criteria 1]
1. [Criteria 2]

## In order to ensure good quality we should (Keep the ones we need for this US)

- [ ] Perform integration testing
- [ ] Perform functional testing
- [ ] Extra focus on usability
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 25
versioning-strategy: increase
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '16 10 * * 4'

Expand All @@ -28,40 +28,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
68 changes: 34 additions & 34 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@ name: Deploy Storybook
on:
workflow_dispatch:
push:
branches: [ master ]
branches: [master]

jobs:
deploy-docs-n-storybook:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Info
run: echo "Running on branch ${{ github.ref_name }}"

- name: Install dependencies
run: npm ci --prefer-offline

- name: Create build dir
run: mkdir docs_out

- name: Generate storybook
run: npx storybook build -c .storybook -o docs_out/storybook/${{ github.ref_name }}
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Publish GH pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to
FOLDER: docs_out/storybook/${{ github.ref_name }} # The folder the action should deploy
TARGET-FOLDER: storybook/${{ github.ref_name }} # The destination folder to deploy to
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
persist-credentials: false

- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Info
run: echo "Running on branch ${{ github.ref_name }}"

- name: Install dependencies
run: npm ci --prefer-offline

- name: Create build dir
run: mkdir docs_out

- name: Generate storybook
run: npx storybook build -c .storybook -o docs_out/storybook/${{ github.ref_name }}
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Publish GH pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to
FOLDER: docs_out/storybook/${{ github.ref_name }} # The folder the action should deploy
TARGET-FOLDER: storybook/${{ github.ref_name }} # The destination folder to deploy to
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
.storybook/src/exampledata/**
storybook-static
report*
docs_out
docs_out
tsconfig.tsbuildinfo
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.storybook/src/esv-intersection-data
docs_out
dist
2 changes: 1 addition & 1 deletion .storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ module.exports = {
staticDirs: ['../public'],
framework: {
name: '@storybook/html-vite',
options: {}
options: {},
},
};
4 changes: 2 additions & 2 deletions .storybook/src/complete-example/intersection.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,5 +455,5 @@ function createButtonWithCb(label: string, cb: any, initialStyle = '') {

export default {
title: 'ESV Intersection/Complete example',
component: intersection
}
component: intersection,
};
6 changes: 3 additions & 3 deletions .storybook/src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const getPicks = (): Promise<any[]> => {
};

export const getCementSqueezes = (): Promise<any[]> => {
return Promise.resolve(cementSqueezes)
}
return Promise.resolve(cementSqueezes);
};

// Nothing for mock
export const fetchData = async (fileName: string) => { };
export const fetchData = async (fileName: string) => {};
10 changes: 7 additions & 3 deletions .storybook/src/features/axis.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const AxisUsingLowLevelInterface = () => {
const root = createRootContainer(width);
const container = createLayerContainer(width, height);

const mainGroup = (select(container).append('svg').attr('height', `${height}px`).attr('width', `${width}px`).style('background-color', '#eee') as unknown) as Selection<SVGElement, unknown, null, undefined>;
const mainGroup = select(container)
.append('svg')
.attr('height', `${height}px`)
.attr('width', `${width}px`)
.style('background-color', '#eee') as unknown as Selection<SVGElement, unknown, null, undefined>;
const showLabels = true;

const xLabel = 'x';
Expand Down Expand Up @@ -58,5 +62,5 @@ export const AxisUsingHighLevelInterface = () => {

export default {
title: 'ESV Intersection/Features/Axis',
component: AxisUsingLowLevelInterface
}
component: AxisUsingLowLevelInterface,
};
18 changes: 13 additions & 5 deletions .storybook/src/features/callout-layer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export const CalloutUsingLowLevelInterface = () => {
zoompanHandler.setViewport(1500, 1500, 3000);
});

root.appendChild(createHelpText('Low level interface for creating and displaying a callout layer. We have also added a wellbore path to show the picks along its path. This layer is made using canvas.'));
root.appendChild(
createHelpText(
'Low level interface for creating and displaying a callout layer. We have also added a wellbore path to show the picks along its path. This layer is made using canvas.',
),
);
root.appendChild(container);
root.appendChild(createFPSLabel());

Expand Down Expand Up @@ -68,14 +72,18 @@ export const CalloutUsingHighLevelInterface = () => {
controller.setViewport(1500, 1500, 3000);
});

root.appendChild(createHelpText('High level interface for creating and displaying a callout layer. We have also added a wellbore path to show the picks along its path. This layer is made using canvas.'));
root.appendChild(
createHelpText(
'High level interface for creating and displaying a callout layer. We have also added a wellbore path to show the picks along its path. This layer is made using canvas.',
),
);
root.appendChild(container);
root.appendChild(createFPSLabel());

return root;
}
};

export default {
title: 'ESV Intersection/Features/Callout',
component: CalloutUsingLowLevelInterface
}
component: CalloutUsingLowLevelInterface,
};
4 changes: 2 additions & 2 deletions .storybook/src/features/geomodel-layer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,5 @@ export const GeoModelCanvasUsingHighLevelInterface = () => {

export default {
title: 'ESV Intersection/Features/Geo Model',
component: GeoModelUsingLowLevelInterface
}
component: GeoModelUsingLowLevelInterface,
};
4 changes: 2 additions & 2 deletions .storybook/src/features/grid-layer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ export const GridUsingHighLevelInterface = () => {

export default {
title: 'ESV Intersection/Features/Grid',
component: GridUsingLowLevelInterface
}
component: GridUsingLowLevelInterface,
};
5 changes: 2 additions & 3 deletions .storybook/src/features/highlight.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ const createSlider = (cb: any, opts: any) => {
return slider;
};


export default {
title: 'ESV Intersection/Features/Highlight',
component: HighlightWellborepath
}
component: HighlightWellborepath,
};
Loading

0 comments on commit 1da4a2b

Please sign in to comment.