Skip to content

Commit

Permalink
Basic js project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed May 5, 2024
1 parent b9af7d7 commit 000f0bd
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended"
],
"rules": {
"no-multi-spaces": "error",
"no-trailing-spaces": "error",
"no-var": "error",
"object-curly-spacing": ["error", "always"],
"prefer-const": "error",
"prefer-destructuring": ["warn", {"object": true, "array": false}],
"quotes": ["error", "single"],
"require-await": "warn",
"semi": ["error", "never"],
"space-infix-ops": "error"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI
on:
pull_request:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm i
- run: npm run build

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm i
- run: npm run lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm i
- run: npm test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
package-lock.json
coverage
/dist
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# HyTable
# HypeTable

A dynamic windowed scrolling table component for react
42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "hypetable",
"version": "0.1.0",
"description": "A dynamic windowed scrolling table component for react",
"keywords": [
"react",
"table",
"windowed",
"scrolling"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/hyparam/hypetable.git"
},
"main": "dist/hypetable.js",
"files": [
"src"
],
"type": "module",
"types": "dist/hypetable.d.ts",
"scripts": {
"build": "tsc",
"coverage": "vitest run --coverage --coverage.include=src",
"lint": "eslint src/**/*.{ts,tsx}",
"test": "vitest run"
},
"devDependencies": {
"@types/node": "20.12.8",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@vitest/coverage-v8": "1.6.0",
"eslint": "8.57.0",
"typescript": "5.4.5",
"vitest": "1.6.0"
},
"peerDependencies": {
"react": "18.3.1",
"react-dom": "18.3.1"
}
}
4 changes: 4 additions & 0 deletions src/hypetable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export default function HypeTable() {
return <></>
}
20 changes: 20 additions & 0 deletions test/package.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest'
import packageJson from '../package.json'

describe('package.json', () => {
it('should have the correct name', () => {
expect(packageJson.name).toBe('hypetable')
})
it('should have a valid version', () => {
expect(packageJson.version).toMatch(/^\d+\.\d+\.\d+$/)
})
it('should have MIT license', () => {
expect(packageJson.license).toBe('MIT')
})
it('should have precise dependency versions', () => {
const { devDependencies } = packageJson
Object.values(devDependencies).forEach(version => {
expect(version).toMatch(/^\d+\.\d+\.\d+$/)
})
})
})
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"declaration": true,
"module": "nodenext",
"resolveJsonModule": true,
"skipLibCheck": false,
"strict": true,
"target": "esnext",
"outDir": "dist",
"rootDir": "src",
"jsx": "react-jsx"
},
"include": ["src"]
}

0 comments on commit 000f0bd

Please sign in to comment.