Skip to content

Commit

Permalink
Setup initial repository structure (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
roluk authored Aug 4, 2023
1 parent d0cc1b8 commit a364d20
Show file tree
Hide file tree
Showing 57 changed files with 7,769 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"project": [ "./tsconfig.json" ]
},
"plugins": [ "@typescript-eslint" ],
"rules": {
"consistent-return": "warn",
"eqeqeq": "warn",
"no-alert": "warn",
"no-empty": [ "warn", { "allowEmptyCatch": true } ],
"no-eval": "error",
"@typescript-eslint/comma-dangle": [
"warn",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "never",
"exports": "always-multiline",
"functions": "always-multiline",
"enums": "always-multiline",
"generics": "always-multiline",
"tuples": "always-multiline"
}
],
"@typescript-eslint/member-delimiter-style": [ "warn", { "singleline": { "requireLast": true } } ],
"@typescript-eslint/no-confusing-void-expression": [ "warn", { "ignoreArrowShorthand": true } ],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-misused-promises": [ "error", { "checksVoidReturn": false } ],
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unused-vars": [ "warn", { "argsIgnorePattern": "^_" } ],
"@typescript-eslint/quotes": "warn",
"@typescript-eslint/return-await": "warn",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/unbound-method": "off"
},
"overrides": [
{
"files": [ "*.test.ts", "*.test.tsx" ],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
},
{
"files": [ "*.tsx" ],
"rules": {
"consistent-return": "off"
}
}
]
}
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report 🐞
about: Create a bug report to help us improve
title: ''
labels: bug
assignees: ''
---

<!--
Thank you for contributing to iTwin/saved-views-react by creating an issue!
Make sure you first do a search for existing issues to avoid duplicates.
-->

#### Bug description (actual behavior)
<!-- A clear and concise description of what the bug is. -->

#### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

#### Steps to reproduce
<!-- Provide a code example that reproduces the bug or a list of steps one should follow to invoke bad behavior in the package. -->

#### Additional information
<!-- Add anything else you want to mention (package version, environment info, possible solution, etc.) -->
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Questions 🤔
url: https://github.com/iTwin/saved-views-react/discussions/categories/q-a
about: Ask questions and get help from contributors through GitHub Discussions.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request ⚡
about: Request a feature from this project
title: ''
labels: enhancement
assignees: ''
---

#### Feature

<!-- A clear and concise description of the new feature. -->

#### Examples

<!-- Provide some examples of how you would like the feature to work. -->
45 changes: 45 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
node-version: [18]

name: Build and run tests
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: ESLint
run: npm run lint -- --max-warnings 0

- name: Typecheck
run: npm run typecheck

- name: Check saved-views-react unit test coverage
run: npm run test:cover --prefix ./packages/saved-views-react
63 changes: 63 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '31 14 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- 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.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, 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.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@bentley:registry=https://registry.npmjs.org/
@itwin:registry=https://registry.npmjs.org/
engine-strict=true
30 changes: 30 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,

"files.associations": {
".env.*": "properties",
},
"files.exclude": {
"**/coverage": true,
"**/node_modules": true,
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,

"json.format.enable": true,
"json.format.keepLines": true,

"typescript.format.semicolons": "insert",
"typescript.reportStyleChecksAsWarnings": true,

"[javascript][typescript][typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
},

"[json][jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features",
},
}
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# iTwin Saved Views

[![CI](https://github.com/iTwin/saved-views-react/actions/workflows/CI.yaml/badge.svg)](https://github.com/iTwin/saved-views-react/actions/workflows/CI.yaml) [![CodeQL](https://github.com/iTwin/saved-views-react/actions/workflows/codeql.yml/badge.svg)](https://github.com/iTwin/saved-views-react/actions/workflows/codeql.yml)

## Packages

[@itwin/saved-views-react](./packages/saved-views-react/)

## Setup

```shell
npx pnpm install
```

## Commands

* `npm start` – starts the test app, available on [http://localhost:7948](http://localhost:7948)
* To enable iTwin Platform features, create `packages/test-app-frontend/.env.local` file based on contents of `packages/test-app-frontend/.env`
* `npm test` – runs all unit tests
* `npm run cover` – runs all unit tests and calculates test coverage
* `npm run lint` – runs ESLint on all TypeScript files in this repository
* `npm run typecheck` – type checks all packages in this repository

## Contributing

We welcome contributions to make this project better. You can submit feature requests or report bugs by creating an [issue](https://github.com/iTwin/saved-views/issues).

---

Copyright © Bentley Systems, Incorporated. All rights reserved. See [LICENSE.md](./LICENSE.md) for license terms and full copyright notice.
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"type": "module",
"scripts": {
"start": "run-p --silent start:*",
"start:backend": "npm start --prefix packages/test-app-backend",
"start:frontend": "npm start --prefix packages/test-app-frontend",
"test": "run-p --silent test:*",
"test:components": "npm test --prefix packages/saved-views-react",
"cover": "run-p --silent cover:*",
"cover:components": "npm run test:cover --prefix packages/saved-views-react",
"lint": "eslint '**/*.{ts,tsx}'",
"typecheck": "run-p --silent typecheck:*",
"typecheck:components": "npm run typecheck --prefix packages/saved-views-react",
"typecheck:backend": "npm run typecheck --prefix packages/test-app-backend",
"typecheck:frontend": "npm run typecheck --prefix packages/test-app-frontend",
"release": "ts-node --esm scripts/release.ts"
},
"engines": {
"pnpm": ">=8",
"npm": "<0",
"node": ">=18"
},
"dependencies": {
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.45.0",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"npm-run-all": "^4.1.5",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
}
14 changes: 14 additions & 0 deletions packages/saved-views-react/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
],
"settings": {
"react": { "version": "detect" }
},
"rules": {
"no-console": "warn",
"react/function-component-definition": "warn"
}
}
9 changes: 9 additions & 0 deletions packages/saved-views-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/iTwin/saved-views-react/tree/HEAD/packages/saved-views-react)

Initial package release.
9 changes: 9 additions & 0 deletions packages/saved-views-react/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MIT License

Copyright © 2023 Bentley Systems, Incorporated. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 changes: 17 additions & 0 deletions packages/saved-views-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @itwin/saved-views-react

## About

## Installation

```shell
npm install @itwin/saved-views-react
```

## Contributing

We welcome contributions to make this package better. You can submit feature requests or report bugs by creating an [issue](https://github.com/iTwin/saved-views-react/issues).

---

Copyright © Bentley Systems, Incorporated. All rights reserved. See [LICENSE.md](./LICENSE.md) for license terms and full copyright notice.
Loading

0 comments on commit a364d20

Please sign in to comment.