Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 10, 2024
2 parents 2e742a8 + 5395da2 commit 542af94
Show file tree
Hide file tree
Showing 16 changed files with 2,484 additions and 2,220 deletions.
23 changes: 0 additions & 23 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc.json

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: push

jobs:
test:
name: Lint, build, and test on node 14.x and ubuntu-latest
name: Lint, build, and test on node 20.x and ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 14.x
node-version: 20.x
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Lint codebase
Expand Down
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
## [5.0.10](https://github.com/GMOD/vcf-js/compare/v5.0.9...v5.0.10) (2022-12-17)



- Use es2015 for nodejs build

## [5.0.9](https://github.com/GMOD/vcf-js/compare/v5.0.8...v5.0.9) (2022-11-23)



- Fix erroneous parsing of symbolic alleles as breakends

## [5.0.8](https://github.com/GMOD/vcf-js/compare/v5.0.7...v5.0.8) (2022-11-20)



- Parse single breakends and large insertion shorthand notation (#95)

<a name="5.0.7"></a>
Expand Down
46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{
ignores: ['esm/**/*', 'dist/**/*', '*.js', '*.mjs', 'example/*'],
},
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.lint.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.strictTypeChecked,
{
rules: {
curly: 'error',

'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
caughtErrors: 'none',
ignoreRestSiblings: true,
},
],

'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-base-to-string': 'off',
},
},
)
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
}
39 changes: 22 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,40 @@
"node": ">=6"
},
"scripts": {
"test": "jest",
"coverage": "npm test -- --coverage",
"lint": "eslint . --ext .ts,.js",
"test": "vitest",
"lint": "eslint --report-unused-disable-directives --max-warnings 0",
"docs": "documentation readme src/parse.ts --section=API --shallow",
"postdocs": "prettier --write README.md",
"clean": "rimraf dist esm",
"build:esm": "tsc --module esnext --outDir esm",
"build:es5": "tsc --module commonjs --outDir dist",
"build": "npm run build:esm && npm run build:es5",
"prebuild": "npm run clean && npm run lint",
"preversion": "npm run lint && npm test && npm run build",
"preversion": "npm run lint && npm test --run && npm run build",
"version": "standard-changelog && git add CHANGELOG.md",
"postversion": "git push --follow-tags"
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@types/jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@babel/core": "^7.20.5",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@types/jest": "^29.2.4",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@vitest/coverage-v8": "^2.1.3",
"documentation": "^14.0.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"prettier": "^2.8.4",
"rimraf": "^4.4.0",
"standard-changelog": "^2.0.27",
"ts-jest": "^29.0.5",
"typescript": "^5.0.2"
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^56.0.0",
"jest": "^29.3.1",
"prettier": "^3.2.4",
"rimraf": "^6.0.1",
"standard-changelog": "^6.0.0",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3",
"typescript-eslint": "^8.8.1",
"vitest": "^2.1.3"
},
"keywords": [
"vcf",
Expand Down
17 changes: 8 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export function parseBreakend(breakendString: string): Breakend | undefined {
let Join
let Replacement
let MatePosition
for (let i = 0; i < tokens.length; i += 1) {
const tok = tokens[i]
for (const tok of tokens) {
if (tok) {
if (tok.includes(':')) {
// this is the remote location
Expand Down Expand Up @@ -45,32 +44,32 @@ export function parseBreakend(breakendString: string): Breakend | undefined {
SingleBreakend: true,
Replacement: breakendString.slice(0, breakendString.length - 1),
}
} else if (breakendString[0] === '<') {
const res = breakendString.match('<(.*)>(.*)')
} else if (breakendString.startsWith('<')) {
const res = /<(.*)>(.*)/.exec(breakendString)
if (!res) {
throw new Error(`failed to parse ${breakendString}`)
}
const Replacement = res?.[2]
const Replacement = res[2]
return Replacement
? {
Join: 'left',
Replacement,
MateDirection: 'right',
MatePosition: `<${res?.[1]}>:1`,
MatePosition: `<${res[1]!}>:1`,
}
: undefined
} else if (breakendString.includes('<')) {
const res = breakendString.match('(.*)<(.*)>')
const res = /(.*)<(.*)>/.exec(breakendString)
if (!res) {
throw new Error(`failed to parse ${breakendString}`)
}
const Replacement = res?.[1]
const Replacement = res[1]
return Replacement
? {
Join: 'right',
Replacement,
MateDirection: 'right',
MatePosition: `<${res?.[2]}>:1`,
MatePosition: `<${res[2]!}>:1`,
}
: undefined
}
Expand Down
Loading

0 comments on commit 542af94

Please sign in to comment.