Skip to content

Commit

Permalink
chore: Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWendelborn committed Apr 18, 2024
0 parents commit ed6bcdc
Show file tree
Hide file tree
Showing 65 changed files with 2,012 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
indent_style = space
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI
on:
- push
jobs:
check-eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check:eslint
check-knip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check:knip
check-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check:prettier
check-publint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check:publint
validate-schemas:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run turbo run start --filter=schemas
28 changes: 28 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# see https://github.com/contributor-assistant/github-action
name: 'CLA Assistant'
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
permissions:
actions: write
contents: write
pull-requests: write
statuses: write

jobs:
cla-assistant:
runs-on: ubuntu-latest
steps:
- name: 'CLA Assistant'
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
uses: contributor-assistant/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path-to-signatures: 'signatures/version1/cla.json'
path-to-document: 'https://github.com/skyblock-finance/skyblock-finance-opensource/blob/master/CLA.md'
branch: 'main' # branch should not be protected
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# global
dist/

# per-package

packages/schemas/data/*.json

################################################################################

# bun
node_modules/

# ide:intellij
.idea

# os:macOS
.DS_Store

# turborepo
.turbo/

# typescript
*.tsbuildinfo
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"Vercel.turbo-vsc"
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"json",
"jsonc",
"typescript",
"typescriptreact"
]
}
13 changes: 13 additions & 0 deletions CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Contributor License Agreement (CLA)

By submitting a pull request (PR) to this project, you agree to the following:

- License Grant: You grant the project a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your contributed code and any derivative works thereof.
- License Acceptance: You accept that your contributed code will be licensed under the MIT License.
- Code Ownership: You assert that you have the right to license the code under the terms of the MIT License and that your contributions do not violate any third-party rights, including intellectual property rights.
- Originality: You affirm that your contributions are your original work and do not infringe upon the rights of any third party.
- No Warranty: Your contributions are provided on an "as-is" basis, without any warranties or conditions, express or implied, including, but not limited to, warranties of merchantability, fitness for a particular purpose, and non-infringement.
- No Obligation: You understand and agree that submitting a pull request does not create any obligation on the part of the project maintainers to accept or incorporate your contributions into the project.
- Modification of Terms: The project maintainers reserve the right to modify the terms of this agreement at any time by posting a revised version on this repository. Your continued participation in the project after such modification constitutes acceptance of the modified terms.

By submitting a pull request to this project, you acknowledge that you have read, understood, and agree to the terms of this agreement.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) `2024` Florian Wendelborn

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.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Skyblock Finance Opensource

This repo contains the opensource parts of <https://skyblock.finance>

## Contributing

1. Install [`bun`](https://bun.sh)
2. `bun install`
3. `bun run watch --filter=schemas`
4. Make your changes
5. Submit a pull request and [agree to the CLA](/CLA.md) so we can publish and use your improvements
Binary file added bun.lockb
Binary file not shown.
53 changes: 53 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import tseslint from 'typescript-eslint'
import eslintConfig from '@skyblock-finance/eslint-config'
import { fileURLToPath } from 'node:url'
import path from 'node:path'

const root = (() => {
const cause = []

try {
// eslint-disable-next-line no-undef
const result = __dirname
if (result) return result
} catch (error) {
cause.push(error)
}

try {
const result = import.meta.dirname
if (result) return result
} catch (error) {
cause.push(error)
}

try {
const result = path.dirname(fileURLToPath(import.meta.url))
if (result) return result
} catch (error) {
cause.push(error)
}

throw new Error('could not determine project root', { cause })
})()

export default tseslint.config(
/**
* DO NOT ADD ANY OTHER KEYS TO THIS FIRST OBJECT
*
* @see {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files}
*/
{
ignores: ['**/dist/**', '**/.turbo/**', 'packages/schemas/data/*.json'],
},
{
extends: [...eslintConfig.configs.default],
languageOptions: {
parserOptions: {
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
tsconfigRootDir: root,
},
},
},
...eslintConfig.configs.json,
)
51 changes: 51 additions & 0 deletions internals/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"bugs": {
"url": "https://github.com/skyblock-finance/skyblock-finance-opensource/issues"
},
"dependencies": {
"@eslint/js": "^9.0.0",
"eslint-plugin-jsonc": "^2.15.0",
"jsonc-eslint-parser": "^2.4.0",
"typescript-eslint": "^7.6.0"
},
"description": "Skyblock Finance Shared ESLint Config",
"devDependencies": {
"@types/eslint__js": "^8.42.3",
"@typescript-eslint/utils": "^7.6.0"
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist/**/!(*.tsbuildinfo)"
],
"homepage": "https://github.com/skyblock-finance/skyblock-finance-opensource/tree/master/packages/eslint-config",
"keywords": [
"eslint",
"eslint-config"
],
"license": "MIT",
"module": "./dist/index.js",
"name": "@skyblock-finance/eslint-config",
"peerDependencies": {
"eslint": ">= 9",
"typescript": ">= 4"
},
"repository": "git+https://github.com/skyblock-finance/skyblock-finance-opensource.git",
"scripts": {
"build": "tsc --build",
"check:eslint": "bun run eslint --max-warnings=0 .",
"check:prettier": "bun --bun run --cwd ../.. prettier --check internals/eslint-config",
"check:publint": "bun --bun run publint",
"fix:eslint": "bun run check:eslint -- --fix",
"fix:prettier": "bun --bun run check:prettier -- --write"
},
"type": "module",
"types": "./dist/index.d.ts",
"version": "0.0.1"
}
85 changes: 85 additions & 0 deletions internals/eslint-config/source/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import jsonc from 'eslint-plugin-jsonc'
import jsoncEslintParser from 'jsonc-eslint-parser'
import { TSESLint } from '@typescript-eslint/utils'

export default {
configs: {
default: tseslint.config({
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
ignores: ['**/*.json'],
languageOptions: {
parser: tseslint.parser,
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
}),
json: tseslint.config(
{
files: ['**/*.json'],
ignores: ['**/tsconfig*.json'],
languageOptions: {
parser: jsoncEslintParser,
},
plugins: {
jsonc,
},
rules: {
...(jsonc.configs['recommended-with-json']
.rules as TSESLint.FlatConfig.Rules),
'jsonc/sort-keys': [
'warn',
{
pathPattern: '^exports(?:\\[[^\\]]+\\]|\\.[^.]+)+$',
order: ['types', 'default', 'import', 'require'],
},
{
pathPattern: '.*',
order: { type: 'asc' },
},
],
},
},
{
files: ['**/tsconfig*.json'],
languageOptions: {
parser: jsoncEslintParser,
},
plugins: {
jsonc,
},
rules: {
...(jsonc.configs['recommended-with-jsonc']
.rules as TSESLint.FlatConfig.Rules),
'jsonc/sort-keys': [
'warn',
{
pathPattern: '.*',
order: { type: 'asc' },
},
],
},
},
),
},
}
23 changes: 23 additions & 0 deletions internals/eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"lib": ["ES2022"],
"module": "ESNext",
"moduleResolution": "node",
"noImplicitAny": true,
"noUncheckedIndexedAccess": true,
"outDir": "dist",
"resolveJsonModule": true,
"rootDir": "source",
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ESNext",
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"exclude": ["node_modules", "dist"],
"include": ["source/*.ts", "source/**/*.ts"]
}
Loading

0 comments on commit ed6bcdc

Please sign in to comment.