From 1dcd56cc2cfbed6c07d2d00573f1b694da0eea22 Mon Sep 17 00:00:00 2001 From: Gregor Anders Date: Wed, 2 Feb 2022 19:05:26 +0100 Subject: [PATCH] 0.0.9 release (#125) * npm: bump @microsoft/api-documenter from 7.8.17 to 7.8.19 Bumps [@microsoft/api-documenter](https://github.com/microsoft/rushstack) from 7.8.17 to 7.8.19. - [Release notes](https://github.com/microsoft/rushstack/releases) - [Commits](https://github.com/microsoft/rushstack/compare/@microsoft/api-documenter_v7.8.17...@microsoft/api-documenter_v7.8.19) Signed-off-by: dependabot[bot] * npm: bump eslint-plugin-react from 7.20.0 to 7.20.1 Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.20.0 to 7.20.1. - [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases) - [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md) - [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.20.0...v7.20.1) Signed-off-by: dependabot[bot] * npm: bump @typescript-eslint/eslint-plugin from 3.4.0 to 3.5.0 Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v3.5.0/packages/eslint-plugin) Signed-off-by: dependabot[bot] * npm: bump eslint-plugin-jest from 23.17.1 to 23.18.0 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.17.1 to 23.18.0. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.17.1...v23.18.0) Signed-off-by: dependabot[bot] * npm: bump @microsoft/api-documenter from 7.8.19 to 7.8.21 Bumps [@microsoft/api-documenter](https://github.com/microsoft/rushstack) from 7.8.19 to 7.8.21. - [Release notes](https://github.com/microsoft/rushstack/releases) - [Commits](https://github.com/microsoft/rushstack/compare/@microsoft/api-documenter_v7.8.19...@microsoft/api-documenter_v7.8.21) Signed-off-by: dependabot[bot] * npm: bump eslint-plugin-react from 7.20.1 to 7.20.3 Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.20.1 to 7.20.3. - [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases) - [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md) - [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.20.1...v7.20.3) Signed-off-by: dependabot[bot] * npm: bump eslint-plugin-react-hooks from 4.0.4 to 4.0.5 Bumps [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks) from 4.0.4 to 4.0.5. - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/HEAD/packages/eslint-plugin-react-hooks) Signed-off-by: dependabot[bot] * chore(dependecies): update dev dependencies * chore(dependencies): update dev dependencies * chore(dependencies): update dependencies * chore(dev dependencies): :arrow_up: updates dependencies * ci(dev dependencies): :bug: runs ci on node 12, 16 and 17 * ci: :bug: adds codacy config * ci: :bug: fixes executable bit on hooks * chore: :bookmark: bumps version * docs(docs): :arrow_up: bumps version * ci(workflows): :construction_worker: refactors GitHub workflows * revert: :recycle: reverts auto fix * ci(workflows): :construction_worker: test previous node versions * ci(workflows): :bug: removes node 15.x * ci(workflows): :bug: removes node 10.x * fix: :bug: fixes json with comments issue * refactor(dependencies): :arrow_up: removes node 10 support * fix(script): :bug: fixes copy and paste issue * chore(release): :bookmark: 0.0.9 release * ci(workflows): :construction_worker: adds node 13 and 14 to ci workflow Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .circleci/config.yml | 2 + .codacy.yml | 24 ++++++ .codeclimate.yml | 3 +- .eslintignore | 1 + .eslintrc.json | 5 +- .github/PULL_REQUEST_TEMPLATE.md | 7 +- .github/dependabot.yml | 13 ++++ .github/workflows/codeql-analysis.yml | 36 +++++++++ .github/workflows/development.yml | 36 ++++++++- .github/workflows/feature.yml | 38 +++++++++- .github/workflows/master.yml | 35 +++++++-- .github/workflows/release.yml | 16 +++- .gitignore | 1 - .husky/commit-msg | 4 + .husky/pre-commit | 5 ++ .husky/pre-push | 4 + .vscode/extensions.json | 19 +++++ .vscode/settings.json | 14 +++- .vscode/workspace.code-workspace | 29 +------ CHANGELOG.md | 47 ++++++++++++ CODE_OF_CONDUCT.md | 57 +++++--------- CONTRIBUTING.md | 49 ++++++++---- LICENSE | 2 +- README.md | 21 +++--- SECURITY.md | 19 +++-- api-extractor.json | 5 -- commitlint.config.js | 1 + docs/csv.configuration.md | 6 +- docs/csv.libversion.md | 2 +- docs/csv.parser.md | 1 - docs/csv.row.md | 2 + etc/csv.api.md | 7 +- package.json | 105 ++++++++++++-------------- src/index.spec.ts | 12 ++- src/index.ts | 12 +-- 35 files changed, 427 insertions(+), 213 deletions(-) create mode 100644 .codacy.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100755 .husky/commit-msg create mode 100755 .husky/pre-commit create mode 100755 .husky/pre-push create mode 100644 .vscode/extensions.json create mode 100644 commitlint.config.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 06da088..142561c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,6 +10,8 @@ jobs: - node/with-cache: steps: - run: npm install + - run: npm test + - run: npm build workflows: build-and-test: jobs: diff --git a/.codacy.yml b/.codacy.yml new file mode 100644 index 0000000..d1939a7 --- /dev/null +++ b/.codacy.yml @@ -0,0 +1,24 @@ +--- +engines: + duplication: + exclude_paths: + - config/engines.yml + metric: + exclude_paths: + - config/engines.yml + remark-int: + exclude_paths: + - config/engines.yml + coverage: + exclude_paths: + - config/engines.yml +exclude_paths: + - '.circleci/**' + - '.github/**' + - '.vscode/**' + - 'src/index.ts' + - 'src/fixtures/**' + - 'src/*.spec.*' + - '**.json' + - '**.yml' + - '**.md' diff --git a/.codeclimate.yml b/.codeclimate.yml index 8ee7dc2..0331887 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -10,7 +10,6 @@ plugins: enabled: false eslint: enabled: true - channel: 'eslint-6' config: config: .eslintrc-cc.json extensions: @@ -35,3 +34,5 @@ exclude_patterns: - '**/test' - '**/docs' - '**/node_modules/' + - '**/.husky' + - '**/commitlint.config.js' diff --git a/.eslintignore b/.eslintignore index 3f62030..2a6a9ef 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,3 +8,4 @@ README.md SECURITY.md CHANGELOG.md LICENSE +commitlint.config.js diff --git a/.eslintrc.json b/.eslintrc.json index ca4ed20..d94a90b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,11 +3,9 @@ "parser": "@typescript-eslint/parser", "plugins": ["prettier", "jest", "unicorn", "@typescript-eslint"], "extends": [ - "plugin:@typescript-eslint/recommended", "plugin:jest/recommended", "plugin:unicorn/recommended", - "plugin:prettier/recommended", - "prettier/@typescript-eslint" + "plugin:prettier/recommended" ], "parserOptions": { "ecmaVersion": 2020, @@ -22,7 +20,6 @@ }, "rules": { "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "createElement" }], "sort-imports": [ "error", { diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index de24bc4..7f2cdd9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ -## Description +# Description @@ -21,17 +21,18 @@ -## Screenshots (if appropriate): +## Screenshots (if appropriate) ## Types of changes +- [ ] Dependencies (non-breaking change which updates dependencies) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) -## Checklist: +## Checklist diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 265eec5..fb42b5b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,18 @@ version: 2 updates: + + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + labels: + - 'npm dependencies' + commit-message: + prefix: 'github-actions' + assignees: + - 'gregoranders' + target-branch: 'development' + - package-ecosystem: 'npm' directory: '/' schedule: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..ec8a6e5 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,36 @@ +name: "CodeQL" +on: + push: + branches: [ main, development, feature/* ] + pull_request: + branches: [ main, development, feature/* ] + schedule: + - cron: '43 7 * * 0' +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-node@v2 + with: + node-version: 16.x + - name: Echo Node.js version + run: node --version + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 2fae6aa..af79013 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -7,6 +7,10 @@ on: env: CI: true + GITHUB_BRANCH: ${{ github.ref }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_COMMIT: ${{ github.sha }} jobs: build: @@ -15,12 +19,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [10.x, 12.x, 13.x, 14.x] + node-version: [12.x, 13.x, 14.x, 16.x, 17.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: nodejs project information @@ -29,9 +33,35 @@ jobs: - name: npm install run: | npm install + - name: npm test + run: | + npm test + - name: npm run build + run: | + npm run build - name: code coverage - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./test/coverage/lcov.info + - name: publish code coverage to code climate + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: paambaati/codeclimate-action@v3.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageCommand: npm test + coverageLocations: | + ./test/coverage/lcov.info:lcov + - name: run codacy-coverage-reporter + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./test/coverage/lcov.info + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action/composite@v1 + with: + check_name: Unit Test Results node${{ matrix.node-version }}-${{ matrix.os }} + files: test/junit.xml diff --git a/.github/workflows/feature.yml b/.github/workflows/feature.yml index a9469db..9d50c3e 100644 --- a/.github/workflows/feature.yml +++ b/.github/workflows/feature.yml @@ -7,6 +7,10 @@ on: env: CI: true + GITHUB_BRANCH: ${{ github.ref }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_COMMIT: ${{ github.sha }} jobs: build: @@ -14,13 +18,13 @@ jobs: strategy: matrix: - os: [ubuntu-latest] - node-version: [14.x] + os: [ubuntu-latest, macos-latest, windows-latest] + node-version: [12.x, 16.x, 17.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: nodejs project information @@ -29,9 +33,35 @@ jobs: - name: npm install run: | npm install + - name: npm test + run: | + npm test + - name: npm run build + run: | + npm run build - name: code coverage - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./test/coverage/lcov.info + - name: publish code coverage to code climate + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: paambaati/codeclimate-action@v3.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageCommand: npm test + coverageLocations: | + ./test/coverage/lcov.info:lcov + - name: run codacy-coverage-reporter + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./test/coverage/lcov.info + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action/composite@v1 + with: + check_name: Unit Test Results node${{ matrix.node-version }}-${{ matrix.os }} + files: test/junit.xml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 48d812f..6f1ae8f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -7,6 +7,10 @@ on: env: CI: true + GITHUB_BRANCH: ${{ github.ref }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_COMMIT: ${{ github.sha }} jobs: build: @@ -15,12 +19,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node-version: [10.x, 12.x, 13.x, 14.x] + node-version: [12.x, 13.x, 14.x, 16.x, 17.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: nodejs project information @@ -29,23 +33,40 @@ jobs: - name: npm install run: | npm install + - name: npm test + run: | + npm test + - name: npm run build + run: | + npm run build - name: code coverage - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./test/coverage/lcov.info - name: publish code coverage to code climate - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' - uses: paambaati/codeclimate-action@v2.6.0 + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: paambaati/codeclimate-action@v3.0.0 env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} with: - coverageCommand: npm run test + coverageCommand: npm test coverageLocations: | ./test/coverage/lcov.info:lcov + - name: run codacy-coverage-reporter + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./test/coverage/lcov.info + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action/composite@v1 + with: + check_name: Unit Test Results node${{ matrix.node-version }}-${{ matrix.os }} + files: test/junit.xml - name: create release - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' + if: matrix.os == 'ubuntu-latest' && matrix.node-version == '16.x' id: createrelease uses: gregoranders/nodejs-create-release@master env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cad5405..efe1291 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,10 @@ on: env: CI: true + GITHUB_BRANCH: ${{ github.ref }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_COMMIT: ${{ github.sha }} jobs: build: @@ -15,12 +19,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node-version: [14.x] + node-version: [16.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org/' @@ -30,12 +34,18 @@ jobs: - name: npm install run: | npm install + - name: npm test + run: | + npm test + - name: npm run build + run: | + npm run build - name: npm publish npm run: | npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: registry-url: 'https://npm.pkg.github.com' - run: npm publish diff --git a/.gitignore b/.gitignore index e2c5e91..a7a72f6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ test/ docs-tmp/ package-lock.json -junit.xml diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..b78c75d --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no -- commitlint --edit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..8e796bf --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ + +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +lint-staged && npm test && npm run build diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..339122a --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run clear && npm install && lint-staged && npm test && npm run build && npm run codeclimate diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..b388fbe --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,19 @@ +{ + "recommendations": [ + "davidanson.vscode-markdownlint", + "vivaxy.vscode-conventional-commits", + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint", + "orta.vscode-jest", + "pkief.material-icon-theme", + "marlosirapuan.nord-deep", + "eg2.vscode-npm-script", + "esbenp.prettier-vscode", + "rvest.vs-code-prettier-eslint", + "pflannery.vscode-versionlens", + "visualstudioexptteam.vscodeintellicode", + "ms-azuretools.vscode-docker", + "cschleiden.vscode-github-actions", + "github.vscode-pull-request-github" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 0d5b011..81574ad 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,14 @@ { - "editor.tabSize": 2, - "editor.wordWrapColumn": 120, + "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { - "source.fixAll": true + "source.fixAll.eslint": true }, - "files.associations": { "*.json": "jsonc" } + "eslint.validate": ["javascript", "typescript"], + "typescript.tsdk": "node_modules/typescript/lib", + "files.associations": { + "*.json": "jsonc" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/.vscode/workspace.code-workspace b/.vscode/workspace.code-workspace index ee4ce85..551fb2c 100644 --- a/.vscode/workspace.code-workspace +++ b/.vscode/workspace.code-workspace @@ -3,32 +3,5 @@ { "path": "../" } - ], - "settings": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - "eslint.validate": ["javascript", "typescript"], - "typescript.tsdk": "node_modules/typescript/lib", - "files.associations": { - "*.json": "jsonc" - }, - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - } - }, - "extensions": { - "recommendations": [ - "coenraads.bracket-pair-colorizer", - "editorconfig.editorconfig", - "dbaeumer.vscode-eslint", - "orta.vscode-jest", - "eg2.vscode-npm-script", - "esbenp.prettier-vscode", - "rvest.vs-code-prettier-eslint", - "pflannery.vscode-versionlens", - "visualstudioexptteam.vscodeintellicode" - ] - } + ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 022441c..423534f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +#### 0.0.9 (2022-02-02) + +##### Chores + +* **dev dependencies:** :arrow_up: updates dependencies ([cd464fe2](https://github.com/gregoranders/ts-csv/commit/cd464fe2cd7fbbfbee611839037124b2f1f3cfdb)) +* **dependencies:** + * update dependencies ([cf1d9dcc](https://github.com/gregoranders/ts-csv/commit/cf1d9dcc8af8ae822d6b97948d0a8d27052b5cc0)) + * update dev dependencies ([e6a6b9fb](https://github.com/gregoranders/ts-csv/commit/e6a6b9fbe52c3fbc54607733eb64bd89caaaadfa)) +* **dependecies:** update dev dependencies ([2451ec3a](https://github.com/gregoranders/ts-csv/commit/2451ec3abdb5b55837803971a0f8b541dc797741)) + +##### Continuous Integration + +* **workflows:** + * :bug: removes node 10.x ([d36094b4](https://github.com/gregoranders/ts-csv/commit/d36094b498c5485bdd5a154cbc528c9df373409d)) + * :bug: removes node 15.x ([29907820](https://github.com/gregoranders/ts-csv/commit/299078205dd8c2c5bf21ad7ab5bd47dff099a3a7)) + * :construction_worker: test previous node versions ([7bc68779](https://github.com/gregoranders/ts-csv/commit/7bc687790fc7edc0061a456e64fe52d0cba5be8f)) + * :construction_worker: refactors GitHub workflows ([8c82a593](https://github.com/gregoranders/ts-csv/commit/8c82a593694b321bc21a7acafa28fbf0e9095833)) +* **dev dependencies:** :bug: runs ci on node 12, 16 and 17 ([cb47be59](https://github.com/gregoranders/ts-csv/commit/cb47be59398212f1a4e1d82a174fad3616d0c6bb)) + +##### Documentation Changes + +* **docs:** :arrow_up: bumps version ([a8c21802](https://github.com/gregoranders/ts-csv/commit/a8c218027672c0c4c9433776b6e140ebfd2fd9bb)) + +##### Bug Fixes + +* **script:** :bug: fixes copy and paste issue ([f296579a](https://github.com/gregoranders/ts-csv/commit/f296579a1a80927db39f92d01bb29624b3167909)) + +##### Other Changes + +* fixes json with comments issue ([01c7bf8f](https://github.com/gregoranders/ts-csv/commit/01c7bf8f88f2eeb36723da18057d45127ca3d444)) +* reverts auto fix ([aa634805](https://github.com/gregoranders/ts-csv/commit/aa63480566429ced8f9e6fed72dc7ca3d10d806f)) +* bumps version ([bb2abec5](https://github.com/gregoranders/ts-csv/commit/bb2abec5252e1ee158b6d31cce7c7888ddfa66c9)) +* fixes executable bit on hooks ([38b0cf93](https://github.com/gregoranders/ts-csv/commit/38b0cf9328540d3df1647957fffc242a3d9e9a2b)) +* adds codacy config ([3bb8e06a](https://github.com/gregoranders/ts-csv/commit/3bb8e06ab6467b706042eaaf4d737b98e3494fcf)) +* gregoranders/ts-csv into development ([204e1d00](https://github.com/gregoranders/ts-csv/commit/204e1d005b7aba75628b3481fc51f209fd139b98)) +* bump eslint-plugin-react-hooks from 4.0.4 to 4.0.5 ([822d7708](https://github.com/gregoranders/ts-csv/commit/822d77088164ee2a28b0fd91025aac8a45430e04)) +* bump eslint-plugin-react from 7.20.1 to 7.20.3 ([a4bd2925](https://github.com/gregoranders/ts-csv/commit/a4bd2925376dc5809948698fe66a8f61186356d6)) +* bump @microsoft/api-documenter from 7.8.19 to 7.8.21 ([8ea5e299](https://github.com/gregoranders/ts-csv/commit/8ea5e2992d90adce720cfe38eb12b27fc6053c3b)) +* bump eslint-plugin-jest from 23.17.1 to 23.18.0 ([958c3147](https://github.com/gregoranders/ts-csv/commit/958c3147ebb5907463bc7b74e4920be477d57aac)) +* bump @typescript-eslint/eslint-plugin from 3.4.0 to 3.5.0 ([38f461c9](https://github.com/gregoranders/ts-csv/commit/38f461c990fd5a354b4cb7aecdab71b09bfc9859)) +* bump eslint-plugin-react from 7.20.0 to 7.20.1 ([e772636e](https://github.com/gregoranders/ts-csv/commit/e772636e6c1b6c34235a8c5978ed93c8f5d77ef5)) +* bump @microsoft/api-documenter from 7.8.17 to 7.8.19 ([e61e2d24](https://github.com/gregoranders/ts-csv/commit/e61e2d241283cd44d3d2b7e152ffb5b6d244beab)) + +##### Refactors + +* **dependencies:** :arrow_up: removes node 10 support ([995a7d9f](https://github.com/gregoranders/ts-csv/commit/995a7d9f1ca5ed4a9255ecb8e5294dd404acf8e6)) + #### 0.0.7 (2020-06-20) ##### Chores diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b16e98b..d2912e7 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,17 +2,13 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free +experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic +status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards -Examples of behavior that contributes to creating a positive environment -include: +Examples of behavior that contributes to creating a positive environment include: - Using welcoming and inclusive language - Being respectful of differing viewpoints and experiences @@ -22,53 +18,38 @@ include: Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances +- The use of sexualized language or imagery and unwelcome sexual attention or advances - Trolling, insulting/derogatory comments, and personal or political attacks - Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances +of unacceptable behavior. -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this +Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or +community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. +Representation of a project may be further defined and clarified by project maintainers. ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. All complaints will be reviewed and investigated and will result +in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's +leadership. ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c961d84..93d58bd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,9 @@ # Contributing Guide -Contributing to `@gregoranders/csv` is fairly easy. This document shows you how to +Contributing to `ts-csv` is fairly easy. This document shows you how to get the project, run all provided tests and generate a production-ready build. -It also covers provided tasks that help you develop with `@gregoranders/csv`. +It also covers provided tasks that help you develop with `ts-csv`. ## Dependencies @@ -15,49 +15,68 @@ on you machine: ## Installation -To get the source of `@gregoranders/csv`, clone the git repository via: +To get the source of `ts-csv`, clone the git repository via: -``` -$ git clone https://github.com/gregoranders/@gregoranders/csv +```sh +git clone https://github.com/gregoranders/ts-csv ``` This will clone the complete source to your local machine. Navigate to the project folder and install all needed dependencies via **npm**: -``` -$ npm install +```sh +npm install ``` -This commands installs everything which is required for building and testing the project. +This command installs everything which is required for building and testing the project. ## Testing +### Unit testing using [Jest][jest-url] + `npm test` executes the unit tests. ## Building -`npm build` executes the build. +`npm run build` executes the build. + +## Developing + +`npm run watch` executes the build in watch mode. + +## Ensure code quality [`docker required`](docs/index.md) + +`npm run codeclimate` executes the code quality checks ## Contributing/Submitting changes - Check out a new branch based on development and name it to what you intend to do: - Example: + + ```sh + git checkout -b BRANCH_NAME origin/development ``` - $ git checkout -b BRANCH_NAME origin/development - ``` + If you get an error, you may need to fetch development first by using + + ```sh + git remote update && git fetch ``` - $ git remote update && git fetch - ``` + - Use one branch per fix/feature - Make your changes - Make sure to provide a spec for unit tests. - Run your tests with npm test. + - Save integration time and run code quality checks locally with npm run codeclimate - When all tests pass, everything's fine. - Commit your changes - - Please provide a git message that explains what you've done. - - @gregoranders/csv uses [generate-changelog](https://www.npmjs.com/package/generate-changelog), so please make sure your commits follow the [conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) + - Please provide a git message that explains what you've done following the [conventional commits][commit-url] pattern. + - nodejs-project-info uses [generate-changelog](https://www.npmjs.com/package/generate-changelog), so please make sure your commits follow the [conventional commit][commit-url] pattern. - Commit to the forked repository. + - Sign your commit. - Make a pull request - Make sure you send the PR to the development branch. - CI is watching you! + +[jest-url]: https://jestjs.io/ +[commit-url]: https://www.conventionalcommits.org diff --git a/LICENSE b/LICENSE index 36f7e72..c934907 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Gregor Anders +Copyright (c) 2022 Gregor Anders Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 807b439..2559899 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [][typescript-url] +[][typescript-url] # @gregoranders/csv @@ -6,7 +6,6 @@ ## [API Docs](./docs/index.md) -[![Dependency Status][daviddm-image]][daviddm-url] [![License][license-image]][license-url] [![Issues][issues-image]][issues-url] [![Code maintainability][code-maintainability-image]][code-maintainability-url] [![Code issues][code-issues-image]][code-issues-url] [![Code Technical Debt][code-tech-debt-image]][code-tech-debt-url] @@ -42,6 +41,7 @@ import Parser from '@gregoranders/csv'; const parser = new Parser(); const rows = parser.parse('a,b,c\n1,2,3\n4,5,6'); ``` + ```ts console.log(JSON.stringify(rows, null, 2)); @@ -63,6 +63,7 @@ console.log(JSON.stringify(rows, null, 2)); ] ] ``` + ```ts console.log(JSON.stringify(parser.rows, null, 2)); @@ -84,6 +85,7 @@ console.log(JSON.stringify(parser.rows, null, 2)); ] ] ``` + ```ts console.log(JSON.stringify(parser.json, null, 2)); @@ -103,38 +105,39 @@ console.log(JSON.stringify(parser.json, null, 2)); ### Clone repository -``` +```sh git clone https://github.com/gregoranders/ts-csv ``` ### Install dependencies -``` +```sh npm install ``` ### Build -``` +```sh npm run build ``` ### Testing #### Test using [Jest][jest-url] -``` + +```sh npm test ``` ### Code Climate Checks [docker required](docs/CODECLIMATE.md) -``` +```sh npm run codeclimate ``` ### Clear -``` +```sh npm run clear ``` @@ -145,8 +148,6 @@ npm run clear [code-metric-url]: https://github.com/gregoranders/ts-csv/search?l=TypeScript [travis-url]: https://travis-ci.org/gregoranders/ts-csv [travis-image]: https://travis-ci.org/gregoranders/ts-csv.svg?branch=master -[daviddm-url]: https://david-dm.org/gregoranders/ts-csv -[daviddm-image]: https://david-dm.org/gregoranders/ts-csv.svg?branch=master [license-url]: https://github.com/gregoranders/ts-csv/blob/master/LICENSE [license-image]: https://img.shields.io/github/license/gregoranders/ts-csv.svg [master-version-url]: https://github.com/gregoranders/ts-csv/blob/master/package.json diff --git a/SECURITY.md b/SECURITY.md index 2dfed0d..cdabc60 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,18 +2,17 @@ ## Supported Versions -​ | Version | Supported | | ------- | ------------------ | -| 0.0.8 | :white_check_mark: | -| 0.0.7 | :x: | -| 0.0.6 | :x: | -| 0.0.5 | :x: | -| 0.0.4 | :x: | -| 0.0.3 | :x: | -| 0.0.2 | :x: | -| 0.0.1 | :x: | -​ +| 0.0.9 | :white_check_mark: | +| 0.0.8 | :x: | +| 0.0.7 | :x: | +| 0.0.6 | :x: | +| 0.0.5 | :x: | +| 0.0.4 | :x: | +| 0.0.3 | :x: | +| 0.0.2 | :x: | +| 0.0.1 | :x: | ## Reporting a Vulnerability diff --git a/api-extractor.json b/api-extractor.json index 36bbbbc..612c9c4 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -1,13 +1,8 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - // "extends": "./api-extractor.json", - "projectFolder": ".", - /** - * SUPPORTED TOKENS: , , - */ "mainEntryPointFilePath": "/dist/esm/index.d.ts", "bundledPackages": [], diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..422b194 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/docs/csv.configuration.md b/docs/csv.configuration.md index 3e61ec3..0b2d26a 100644 --- a/docs/csv.configuration.md +++ b/docs/csv.configuration.md @@ -16,7 +16,7 @@ export interface Configuration | Property | Type | Description | | --- | --- | --- | -| [fieldSeparator](./csv.configuration.fieldseparator.md) | string | field separator | -| [lineSeparator](./csv.configuration.lineseparator.md) | string | line separator | -| [quote](./csv.configuration.quote.md) | string | quote character | +| [fieldSeparator?](./csv.configuration.fieldseparator.md) | string | (Optional) field separator | +| [lineSeparator?](./csv.configuration.lineseparator.md) | string | (Optional) line separator | +| [quote?](./csv.configuration.quote.md) | string | (Optional) quote character | diff --git a/docs/csv.libversion.md b/docs/csv.libversion.md index ed60e57..b917b0a 100644 --- a/docs/csv.libversion.md +++ b/docs/csv.libversion.md @@ -9,5 +9,5 @@ library version Signature: ```typescript -libversion = "0.0.8" +libversion = "0.0.9" ``` diff --git a/docs/csv.parser.md b/docs/csv.parser.md index e70f3ea..be421a0 100644 --- a/docs/csv.parser.md +++ b/docs/csv.parser.md @@ -20,7 +20,6 @@ import Parser from '@gregoranders/csv'; const parser = new Parser(); const rows = parser.parse('a,b,c\n1,2,3\n4,5,6'); - ``` ## Constructors diff --git a/docs/csv.row.md b/docs/csv.row.md index fba4ab9..b879fd9 100644 --- a/docs/csv.row.md +++ b/docs/csv.row.md @@ -11,3 +11,5 @@ csv row ```typescript export declare type Row = Array; ``` +References: [Field](./csv.field.md) + diff --git a/etc/csv.api.md b/etc/csv.api.md index 8a5287e..6b8e713 100644 --- a/etc/csv.api.md +++ b/etc/csv.api.md @@ -21,7 +21,7 @@ export const libname = "@gregoranders/csv"; export const liburl = "https://gregoranders.github.io/ts-csv/"; // @public -export const libversion = "0.0.8"; +export const libversion = "0.0.9"; // @public class Parser> { @@ -31,14 +31,11 @@ class Parser> { parse(text: string): readonly Row[]; // @virtual get rows(): readonly Row[]; - } - +} export { Parser } - export default Parser; // @public export type Row = Array; - ``` diff --git a/package.json b/package.json index 8a8e385..ce69977 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,22 @@ { "name": "@gregoranders/csv", - "version": "0.0.8", + "version": "0.0.9", "description": "Simple CSV parser in TypeScript", "scripts": { - "clear": "npm run prescript && npm run pretest && rimraf ./node_modules ./package-lock.json ./temp", + "clear": "rimraf ./node_modules ./dist ./test ./package-lock.json ./temp ./docs-tmp", + "prebuild": "eslint ./src/**/*.ts --quiet --fix && rimraf ./build/esm/index.d.ts", "build": "cross-env NODE_ENV=production npm run script", - "postbuild": "eslint src/**/* --fix --quiet", + "postbuild": "npm run api-extractor && npm run api-documenter && eslint --ext .ts ./src && rimraf ./build/esm/index.d.ts", "pretest": "rimraf ./test junit.xml", - "test": "jest --runInBand --coverage --coverageDirectory ../test/coverage --rootDir ./src", - "prescript": "rimraf ./dist", + "test": "jest", "script": "npm run script:cjs && npm run script:esm", "script:cjs": "tsc --project ./ --module commonjs --target es5 --outDir ./dist/cjs", "script:esm": "tsc --project ./ --module es6 --declaration --declarationDir ./dist/esm --outDir ./dist/esm", - "prepare": "npm test && npm run build && npm run api-extractor && npm run api-documenter && eslint --ext .ts ./src && rimraf ./build/esm/index.d.ts", + "prepare": "husky install", "api-extractor": "api-extractor run --local --verbose", "api-documenter": "api-documenter markdown --input ./dist --output ./docs-tmp && cpx 'docs-tmp/**/*.*' docs", - "codeclimate": "docker run --interactive --tty --rm --env CODECLIMATE_CODE=\"$PWD\" --volume \"$PWD\":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze" + "codeclimate": "docker run --interactive --rm --env CODECLIMATE_CODE=\"$PWD\" --volume \"$PWD\":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze", + "changelog": "changelog" }, "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -24,7 +25,7 @@ "dist" ], "engines": { - "node": ">=0.10.0" + "node": ">=12.0" }, "private": false, "repository": { @@ -38,42 +39,34 @@ "jest", "typescript" ], - "husky": { - "hooks": { - "pre-commit": "lint-staged && npm run prepare", - "pre-push": "npm run test" - } - }, "lint-staged": { "*.ts": [ - "eslint --ext .ts --fix --quiet" + "eslint --ext .ts" ] }, "jest-html-reporter": { "pageTitle": "ts-csv", - "outputPath": "./test/index.html" + "outputPath": "/test/index.html" }, "jest-junit": { - "outputDirectory": "./test" + "outputDirectory": "/test" }, "jest": { "collectCoverage": true, + "coverageDirectory": "/test/coverage", "collectCoverageFrom": [ - "!**/node_modules/**", - "!**/dist/**", - "!**/coverage/**", - "!**/results/**" + "/src/**/*.ts", + "!/node_modules/**", + "!/dist/**", + "!/temp/**", + "!/test/**" ], "coverageReporters": [ "lcovonly", + "html", "text", "text-summary" ], - "reporters": [ - "jest-html-reporter", - "jest-spec-reporter", - "jest-junit" - ], "coverageThreshold": { "global": { "branches": 100, @@ -82,19 +75,20 @@ "statements": 100 } }, - "globals": { - "ts-jest": { - "tsConfig": "tsconfig.json" - } - }, "moduleFileExtensions": [ "ts", "js", "json" ], + "reporters": [ + "jest-html-reporter", + "jest-spec-reporter", + "jest-junit" + ], "transform": { "\\.ts$": "ts-jest" - } + }, + "testRegex": "/src/.*\\.spec\\.ts$" }, "author": "Gregor Anders ", "license": "MIT", @@ -103,33 +97,30 @@ }, "homepage": "https://gregoranders.github.io/ts-csv/", "devDependencies": { - "@microsoft/api-documenter": "7.8.17", - "@microsoft/api-extractor": "7.8.15", - "@types/jest": "26.0.3", - "@types/node": "14.0.14", - "@typescript-eslint/eslint-plugin": "3.4.0", - "@typescript-eslint/parser": "3.4.0", + "@commitlint/cli": "16.1.0", + "@commitlint/config-conventional": "16.0.0", + "@microsoft/api-documenter": "7.15.1", + "@microsoft/api-extractor": "7.19.4", + "@typescript-eslint/eslint-plugin": "5.10.2", + "@typescript-eslint/parser": "5.10.2", "cpx": "1.5.0", - "cross-env": "7.0.2", - "eslint": "7.3.1", - "eslint-config-prettier": "6.11.0", - "eslint-plugin-jest": "23.17.1", - "eslint-plugin-prettier": "3.1.4", - "eslint-plugin-react": "7.20.0", - "eslint-plugin-react-hooks": "4.0.4", - "eslint-plugin-unicorn": "20.1.0", + "cross-env": "7.0.3", + "eslint": "8.8.0", + "eslint-config-prettier": "8.3.0", + "eslint-plugin-jest": "26.0.0", + "eslint-plugin-prettier": "4.0.0", + "eslint-plugin-unicorn": "40.1.0", "generate-changelog": "1.8.0", - "husky": "4.2.5", - "jest": "26.1.0", - "jest-cli": "26.1.0", - "jest-html-reporter": "3.1.3", - "jest-junit": "11.0.1", - "jest-spec-reporter": "1.0.14", - "lint-staged": "10.2.11", - "prettier": "2.0.5", + "husky": "7.0.4", + "jest": "27.4.7", + "jest-cli": "27.4.7", + "jest-html-reporter": "3.4.2", + "jest-junit": "13.0.0", + "jest-spec-reporter": "1.0.17", + "lint-staged": "12.3.3", + "prettier": "2.5.1", "rimraf": "3.0.2", - "ts-jest": "26.1.1", - "ts-node": "8.10.2", - "typescript": "3.9.5" + "ts-jest": "27.1.3", + "typescript": "4.5.5" } } diff --git a/src/index.spec.ts b/src/index.spec.ts index de6fb18..1b92dd9 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -1,12 +1,13 @@ +/* eslint-disable jest/no-conditional-expect */ import * as TestSubject from '.'; const toJson = (keys: string[], row: string[]) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const object = {} as any; - keys.forEach((key, keyIdx) => { - object[key] = row[keyIdx]; + // eslint-disable-next-line unicorn/no-array-for-each + keys.forEach((key, keyIndex) => { + object[key] = row[keyIndex]; }); - return object; }; @@ -17,7 +18,7 @@ describe(`${TestSubject.libname} ${TestSubject.libversion} - csv`, () => { }); it('libversion', () => { - expect(TestSubject.libversion).toBe('0.0.8'); + expect(TestSubject.libversion).toBe('0.0.9'); }); it('liburl', () => { @@ -201,6 +202,7 @@ describe(`${TestSubject.libname} ${TestSubject.libversion} - csv`, () => { const testSubject = new TestSubject.Parser(); const rows = testSubject.parse('1,2,3\n,b,c'); + // eslint-disable-next-line prettier/prettier const wrows = (rows as unknown) as Array; expect.assertions(3); @@ -229,6 +231,7 @@ describe(`${TestSubject.libname} ${TestSubject.libversion} - csv`, () => { const testSubject = new TestSubject.Parser(); testSubject.parse('1,2,3\n,b,c'); + // eslint-disable-next-line prettier/prettier const wrows = (testSubject.rows as unknown) as Array; expect.assertions(3); @@ -257,6 +260,7 @@ describe(`${TestSubject.libname} ${TestSubject.libversion} - csv`, () => { const testSubject = new TestSubject.Parser(); testSubject.parse('1,2,3\n,b,c'); + // eslint-disable-next-line prettier/prettier const wrows = (testSubject.json as unknown) as Array< Record >; diff --git a/src/index.ts b/src/index.ts index 9853fe5..7469f80 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,7 @@ export const libname = '@gregoranders/csv'; * @public * @readonly */ -export const libversion = '0.0.8'; +export const libversion = '0.0.9'; /** * library homepage @@ -206,14 +206,14 @@ export class Parser> { return Object.freeze( this.rows - .filter((row, idx) => row && idx > 0) + .filter((row, index) => row && index > 0) .map((row) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const object = {} as any; - keys.forEach((key, keyIdx) => { - object[key] = row[keyIdx]; + // eslint-disable-next-line unicorn/no-array-for-each + keys.forEach((key, keyIndex) => { + object[key] = row[keyIndex]; }); - return Object.freeze(object); }), ); @@ -321,7 +321,9 @@ export class Parser> { } private makeImmutable() { + // eslint-disable-next-line unicorn/no-array-for-each this.rows.forEach((row) => { + // eslint-disable-next-line unicorn/no-array-for-each row.forEach((value) => Object.freeze(value)); Object.freeze(row); });