Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jul 2, 2024
1 parent 461cfec commit 9ab7bb2
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 1,193 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

82 changes: 0 additions & 82 deletions .eslintrc.js

This file was deleted.

114 changes: 114 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import prettier from 'eslint-plugin-prettier'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: ['src/binary-parser/*.js'],
},
...compat.extends(
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:prettier/recommended',
'plugin:unicorn/recommended',
),
{
plugins: {
prettier,
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
tsconfigRootDir: '/home/cdiesh/src/gmod/cram-js',
project: './tsconfig.lint.json',
},
},

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

'no-underscore-dangle': 0,
curly: 'error',
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-ts-comment': 0,
semi: ['error', 'never'],
'unicorn/no-new-array': 'off',
'unicorn/no-empty-file': 'off',
'unicorn/prefer-type-error': 'off',
'unicorn/prefer-modern-math-apis': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/no-unreadable-array-destructuring': 'off',
'unicorn/no-abusive-eslint-disable': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/number-literal-case': 'off',
'unicorn/prefer-add-event-listener': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-lonely-if': 'off',
'unicorn/consistent-destructuring': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-optional-catch-binding': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/no-null': 'off',
'unicorn/no-nested-ternary': 'off',
'unicorn/filename-case': 'off',
'unicorn/catch-error-name': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/explicit-length-check': 'off',
'unicorn/prefer-regexp-test': 'off',
'unicorn/relative-url-style': 'off',
'unicorn/prefer-math-trunc': 'off',
'unicorn/prefer-query-selector': 'off',
'unicorn/no-negated-condition': 'off',
'unicorn/switch-case-braces': 'off',
'unicorn/prefer-switch': 'off',
'unicorn/better-regex': 'off',
'unicorn/no-for-loop': 'off',
'unicorn/escape-case': 'off',
'unicorn/prefer-number-properties': 'off',
'unicorn/no-process-exit': 'off',
'unicorn/prefer-at': 'off',
'unicorn/prefer-string-replace-all': 'off',
'unicorn/no-array-reduce': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
},
},
]
11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,25 @@
"xz-decompress": "^0.2.1"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@gmod/indexedfasta": "^2.1.0",
"@types/jest": "^29.5.12",
"@types/long": "^4.0.2",
"@types/long": "^4.0.0",
"@types/md5": "^2.3.2",
"@types/pako": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"buffer": "^6.0.3",
"documentation": "^14.0.3",
"eslint": "^8.30.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^51.0.1",
"glob": "^10.3.1",
"eslint-plugin-unicorn": "^54.0.0",
"jest": "^29.3.1",
"mock-fs": "^5.2.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.2",
"typescript": "^5.0.3",
"url": "^0.11.0",
"webpack": "^5.90.3",
"webpack-cli": "^5.0.1"
},
Expand Down
4 changes: 1 addition & 3 deletions src/indexedCramFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CramSizeLimitError, CramUnimplementedError } from './errors'

import { CramUnimplementedError } from './errors'
import CramFile from './cramFile'
import CramRecord from './cramFile/record'
import { SeqFetch } from './cramFile/file'
Expand Down Expand Up @@ -98,7 +97,6 @@ export default class IndexedCramFile {
}
const seqId = seq
const slices = await this.index.getEntriesForRange(seqId, start, end)
const totalSize = slices.map(s => s.sliceBytes).reduce((a, b) => a + b, 0)

// TODO: do we need to merge or de-duplicate the blocks?

Expand Down
6 changes: 3 additions & 3 deletions test/cram2sam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ function tags2str(record: CramRecord, RG: string[]) {
for (const type in record.tags) {
str += '\t'
if (typeof record.tags[type] === 'number') {
str += type + ':i:' + record.tags[type]
str += `${type}:i:${record.tags[type]}`
} else if (typeof record.tags[type] === 'string') {
str +=
record.tags[type].length === 1
? type + ':A:' + record.tags[type]
: type + ':Z:' + record.tags[type]
? `${type}:A:${record.tags[type]}`
: `${type}:Z:${record.tags[type]}`
} else {
console.error(
type,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/syncLocalFile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ts-nocheck
// don't load fs native module if running in webpacked code
const fs = typeof __webpack_require__ !== 'function' ? require('fs') : null // eslint-disable-line camelcase
const fs = typeof __webpack_require__ !== 'function' ? require('fs') : null

const fsOpen = fs.openSync
const fsRead = fs.readSync
Expand Down
Loading

0 comments on commit 9ab7bb2

Please sign in to comment.