From 3a29bb7bca72613060d61830e3a2029dbf4a976c Mon Sep 17 00:00:00 2001 From: Kenny Daniel Date: Thu, 20 Mar 2025 12:21:52 -0700 Subject: [PATCH] Initial JS project --- .github/workflows/ci.yml | 26 ++++++++++++++++ .gitignore | 5 ++++ LICENSE | 7 +++++ eslint.config.js | 64 ++++++++++++++++++++++++++++++++++++++++ package.json | 38 ++++++++++++++++++++++++ src/index.js | 0 test/package.test.js | 24 +++++++++++++++ tsconfig.json | 14 +++++++++ 8 files changed, 178 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 eslint.config.js create mode 100644 package.json create mode 100644 src/index.js create mode 100644 test/package.test.js create mode 100644 tsconfig.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6eb5edb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI +on: + pull_request: + push: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: npm i + - run: npm run lint + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: npm i + - run: npx tsc + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: npm i + - run: npm run coverage diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e5a8a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +coverage +node_modules +package-lock.json +dist +*.tgz diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5523c36 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +The MIT License (MIT) + +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. diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..b4bcb8e --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,64 @@ +import javascript from '@eslint/js' +import jsdoc from 'eslint-plugin-jsdoc' + +export default [ + { + plugins: { + jsdoc, + }, + + languageOptions: { + globals: { + 'atob': false, + }, + }, + + rules: { + ...javascript.configs.recommended.rules, + 'arrow-spacing': 'error', + camelcase: 'off', + 'comma-spacing': 'error', + 'comma-dangle': ['error', { + arrays: 'always-multiline', + objects: 'always-multiline', + imports: 'always-multiline', + exports: 'always-multiline', + functions: 'never', + }], + 'eol-last': 'error', + eqeqeq: 'error', + 'func-style': ['error', 'declaration'], + indent: ['error', 2], + 'jsdoc/check-param-names': 'error', + 'jsdoc/check-property-names': 'error', + 'jsdoc/check-tag-names': 'error', + 'jsdoc/require-param': 'error', + 'jsdoc/require-param-type': 'error', + 'jsdoc/require-returns': 'error', + 'jsdoc/require-returns-type': 'error', + 'jsdoc/sort-tags': 'error', + 'no-constant-condition': 'off', + 'no-extra-parens': 'error', + 'no-multi-spaces': 'error', + 'no-trailing-spaces': 'error', + 'no-undef': 'error', + 'no-unused-vars': 'error', + 'no-useless-concat': 'error', + 'no-useless-rename': 'error', + 'no-useless-return': 'error', + 'no-var': 'error', + 'object-curly-spacing': ['error', 'always'], + 'prefer-const': 'error', + 'prefer-promise-reject-errors': 'error', + quotes: ['error', 'single'], + 'require-await': 'warn', + semi: ['error', 'never'], + 'sort-imports': ['error', { + ignoreDeclarationSort: true, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + }], + 'space-infix-ops': 'error', + }, + }, +] diff --git a/package.json b/package.json new file mode 100644 index 0000000..a176b9b --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "hyparquet-writer", + "version": "0.1.0", + "description": "Parquet file writer for JavaScript", + "author": "Hyperparam", + "homepage": "https://hyperparam.app", + "keywords": [ + "hyparquet", + "parquet" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/hyparam/hyparquet-writer.git" + }, + "main": "src/index.js", + "files": [ + "src" + ], + "type": "module", + "types": "src/index.d.ts", + "scripts": { + "coverage": "vitest run --coverage", + "lint": "eslint", + "lint:fix": "eslint --fix", + "test": "vitest run" + }, + "devDependencies": { + "@babel/eslint-parser": "7.26.10", + "@types/node": "22.13.10", + "@vitest/coverage-v8": "3.0.9", + "eslint": "9.22.0", + "eslint-plugin-jsdoc": "50.6.8", + "hyparquet": "1.9.1", + "typescript": "5.8.2", + "vitest": "3.0.9" + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..e69de29 diff --git a/test/package.test.js b/test/package.test.js new file mode 100644 index 0000000..d1c3e28 --- /dev/null +++ b/test/package.test.js @@ -0,0 +1,24 @@ +import { describe, expect, it } from 'vitest' +import packageJson from '../package.json' with { type: 'json' } + +describe('package.json', () => { + it('should have the correct name', () => { + expect(packageJson.name).toBe('hyparquet-writer') + }) + 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 dev dependency versions', () => { + const { devDependencies } = packageJson + Object.values(devDependencies).forEach(version => { + expect(version).toMatch(/^\d+\.\d+\.\d+$/) + }) + }) + it('should have no dependencies', () => { + expect('dependencies' in packageJson).toBe(false) + expect('peerDependencies' in packageJson).toBe(false) + }) +}) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..03324cb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "lib": ["esnext", "dom"], + "module": "nodenext", + "noEmit": true, + "resolveJsonModule": true, + "skipLibCheck": false, + "strict": true, + "target": "esnext" + }, + "include": ["src", "test"] +}