Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Nov 29, 2024
0 parents commit 10765f3
Show file tree
Hide file tree
Showing 14 changed files with 2,515 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{js,ts}]
indent_style = tab
indent_size = 4

[*.yaml]
indent_style = space
indent_size = 4
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .github/codeowners
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @james-pre
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Continuous Integration

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
pull_request:

jobs:
ci:
name: CI
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Formatting
run: npm run format:check

- name: Linting
run: npm run lint

- name: Build
run: npm run build

- name: Unit tests
run: npm run test
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release
on:
release:
types: [created]
workflow_call:
secrets:
npm_token:
required: true
jobs:
ci:
name: CI Checks
uses: ./.github/workflows/ci.yaml
release:
runs-on: ubuntu-latest
needs: ci
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup npm authentication
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Publish
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
docs
*.log
tmp
build
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"useTabs": true,
"trailingComma": "es5",
"tabWidth": 4,
"printWidth": 180,
"arrowParens": "avoid"
}
20 changes: 20 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},

"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true
}
50 changes: 50 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';
import globals from 'globals';

export default tseslint.config({
name: 'xsea',
extends: [eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
files: ['src/**/*.ts'],
languageOptions: {
globals: { ...globals.browser, ...globals.node },
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'no-useless-escape': 'warn',
'no-unreachable': 'warn',
'no-fallthrough': 'warn',
'no-empty': 'warn',
'no-case-declarations': 'warn',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'prefer-spread': 'warn',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-wrapper-object-types': 'warn',
'@typescript-eslint/triple-slash-reference': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/prefer-as-const': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
});
Loading

0 comments on commit 10765f3

Please sign in to comment.