Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .copilot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copilot Suggestions

This directory contains GitHub Copilot-specific configuration to help maintain consistent code quality and style.

## Features

- Pattern-based file filtering
- TypeScript-specific suggestions
- Naming convention enforcement
- Best practices suggestions

## Configuration

The `settings.json` file contains:

- File patterns to include/exclude
- Language-specific rules
- Coding style preferences
- Type checking preferences
42 changes: 42 additions & 0 deletions .copilot/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Standing Instructions for GitHub Copilot

- Follow the project's coding standards and style guides.
- Use TypeScript for all new code.
- Use descriptive variable and function names.
- Avoid using any deprecated APIs or libraries.
- Use the projects linting rules, don't suggest code breaking them.
- Always have a namespace when creating a type, even if empty
- For all exported `type` and `interface` declarations provide `type`, `is` and `flaw` definitions.

# Coding Standards

- Functions only return in one place.
- Use the name `result` for what the function returns even when it is modified on the last line.
- Never use abbreviations except "UI", "Id", "max", "min".
- Prefer fewer lines of code over shorter lines.
- Prefer expressions over statements.
- Never use unnecessary braces.
- Rely on type system and only use `===` and `!==` when strictly necessary.
- In tests, always import the top level export from the packages index file like this: `import { isoly } from "../index"` with adjustments for path.
- In tests, prefer using `it.each` where possible.
- Don't use braces in lambda function when not required.
- Prefer single word identifier names.
- Only use single letter identifiers if usage is kept within a maximum of 3 lines.
- Make test descriptions short, use function names and single words describing test.
- No blank lines between test cases in test files.

# Test File Structure Example

```typescript
describe("isoly.Something", () => {
it.each([
["input1", "output1"],
["input2", "output2"],
])("test description %s", (input, output) => expect(something(input)).toBe(output))
it.each([
["input3", "output3"],
["input4", "output4"],
])("another test %s", (input, output) => expect(something(input)).toBe(output))
it("single test", () => expect(something()).toBe(true))
})
```
28 changes: 28 additions & 0 deletions .copilot/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"patterns": [
"**/*.ts",
"**/*.json",
"**/*.md",
"!**/node_modules/**",
"!**/dist/**"
],
"suggestions": {
"typescript": {
"description": "TypeScript suggestions:",
"rules": {
"identifier-pattern": {
"interfaces": "PascalCase",
"types": "PascalCase",
"variables": "camelCase",
"functions": "camelCase",
"enum-members": "PascalCase"
},
"no-duplicate-generics": true,
"no-implicit-any": true,
"no-unused-variables": true,
"prefer-const": true,
"strict-boolean-expressions": true
}
}
}
}
15 changes: 13 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettierx/default"
],
"rules": {
Expand All @@ -21,18 +22,28 @@
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"prefer-const": 1,
"prefer-const": "warn",
"@typescript-eslint/no-unused-vars": [
2,
"error",
{
"vars": "all",
"args": "none",
"varsIgnorePattern": "h"
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"]
}
],
"no-case-declarations": "off",
"no-inner-declarations": "off",
"no-console": "warn",
"sort-imports": "off",
"simple-import-sort/imports": [
"error",
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/workflows/bump-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Bump Alpha"

on:
push:
branches:
- "master-alpha"
- "master-1"
jobs:
bump-version:
name: "Bump Alpha Version"
timeout-minutes: 60
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci: version bump to ')"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v4"
with:
ref: ${{ github.ref }}
token: ${{ secrets.ADMIN_TOKEN }}
- name: "Setup Node"
uses: "actions/setup-node@v3"
with:
node-version: current
cache: "npm"
- name: "Version Bump"
id: version-bump
uses: "phips28/gh-action-bump-version@master"
with:
default: prerelease
version-type: "prerelease"
preid: alpha
rc-wording: ""
tag-prefix: "release-"
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Bump"

on:
push:
branches:
- "master"
- "master-0"
jobs:
bump-version:
name: "Bump version on master"
timeout-minutes: 60
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci: version bump to ')"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"
with:
token: ${{ secrets.ADMIN_TOKEN }}
- name: "Setup Node"
uses: "actions/setup-node@v3"
with:
node-version: current
cache: 'npm'
- name: Update NPM
run: npm install -g npm
- name: "Version Bump"
id: version-bump
uses: "phips28/gh-action-bump-version@master"
with:
tag-prefix: 'release-'
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.10.0
cache: 'npm'
- run: npm install
- run: npm run build
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.10.0
cache: 'npm'
- run: npm install
- run: npm run test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.10.0
cache: 'npm'
- run: npm install
- run: npm run lint
audit:
name: Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: current
cache: 'npm'
- run: npm audit
39 changes: 39 additions & 0 deletions .github/workflows/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Publish"

on:
push:
tags:
- "release-*"
jobs:
publish:
name: "Publish"
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"
- name: "Setup Node"
uses: "actions/setup-node@v3"
with:
node-version: current
cache: "npm"
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install
run: npm install
- name: Build
run: npm run build
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" == *-* ]]; then
npm publish --access public --tag prerelease
else
npm publish --access public
fi
shell: bash
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 4 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"semi": false,
"singleQuote": false,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"endOfLine": "lf",
"breakBeforeStatement": "always"
}
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "strict"
}
Loading
Loading